Missing translation in js code for Angular Material mdToast
See original GitHub issueHey !
In my toast factory, I am looking for a string ‘CLOSE’ to put the translation in a toast. My problem is that it is always marked as [MISSING] when the key and value are in my translation json files !
Here is how I proceed :
function logger($log, $mdToast, gettext, gettextCatalog) {
var close = "CLOSE";
close = gettextCatalog.getString(close);
close = gettext(close);
var service = {
showToasts: true,
error: error
};
function error(message, data) {
message = gettext(message);
$mdToast.show(
$mdToast
.simple()
.textContent(message)
.theme('error-toast')
.action(close) // <-- MISSING
.highlightAction(true)
);
$log.error('Error: ' + message, data);
};
return service
}
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
TypeError: $translate.use is not a function - Stack Overflow
So i first added the languages en, fr & nl to my app.js file. This is horrible bad practice so i now got...
Read more >Services > $mdToast - AngularJS Material
$mdToast is a service to build a toast notification on any position on the screen with an optional duration, and provides a simple...
Read more >Angular(i18n): Missing Translations | by Sujana Pathuri
Everything looks fine, then what are these missing translations? When we are working with angular downloaded examples, git-hub source codes ...
Read more >Material Design implementation with AngularJS
of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, ... Step 1: Code “Hello World—Angular Material” .
Read more >angular-material | Yarn - Package Manager
This repository was used to publish the AngularJS Material v1.x library and localized installs using npm . You can find the component source-code...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
OK thanks, I understand now. Good day !
Yes.
Mostly you’d do something like:
That’s the best way to do things, since it’ll update the span if the language changes.
Only use
gettextCatalog.getString()
if you need a translated version to pass it into e.g. a library (such as$mdToast
).