angular-unsavedChanges
angular-unsavedChanges copied to clipboard
Anyone using angular-gettext?
Hello;
I am using angular-gettext for translation.
I need to inject gettext service to configuration but it didn't work.
MetronicApp.config(function(unsavedWarningsConfigProvider){
unsavedWarningsConfigProvider.navigateMessage = gettext("Navigate message");
unsavedWarningsConfigProvider.reloadMessage = gettext("You will lose unsaved changes if you reload this page!");
});
What should I do to translate alert messages?
Can't you use injector to inject gettext and use it? var getT = $injector.get('getText');
Thank you, I'll try
doing the above works, but it only marks the string for translation. You cannot to gettextCatalog.getString inside the config because you can't inject another service (gettextCatalog) into the config.
What we need to do is replace
if ($injector.has('$translate') && useTranslateService) {
return $injector.get('$translate').instant(message);
} else {
return false;
}
with
if ($injector.has('$translate') && useTranslateService) {
return $injector.get('$translate').instant(message);
} else if ($injector.has('gettextCatalog') && useTranslateService) {
return $injector.get('gettextCatalog').getString(message);
} else {
return false;
}
could you guys do this please?