angular-unsavedChanges icon indicating copy to clipboard operation
angular-unsavedChanges copied to clipboard

Anyone using angular-gettext?

Open burakkilic opened this issue 9 years ago • 3 comments

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?

burakkilic avatar Jan 19 '16 11:01 burakkilic

Can't you use injector to inject gettext and use it? var getT = $injector.get('getText');

v0d1ch avatar May 30 '16 19:05 v0d1ch

Thank you, I'll try

burakkilic avatar May 31 '16 08:05 burakkilic

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?

arski avatar Sep 15 '16 07:09 arski