Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anyone using angular-gettext? #61

Open
burakkilic opened this issue Jan 19, 2016 · 3 comments
Open

Anyone using angular-gettext? #61

burakkilic opened this issue Jan 19, 2016 · 3 comments

Comments

@burakkilic
Copy link

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?

@v0d1ch
Copy link

v0d1ch commented May 30, 2016

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

@burakkilic
Copy link
Author

Thank you, I'll try

@arski
Copy link

arski commented Sep 15, 2016

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants