Skip to content
This repository was archived by the owner on Jan 29, 2024. It is now read-only.
This repository was archived by the owner on Jan 29, 2024. It is now read-only.

Update Languages registered in angular-translate #1842

Open
@noelyriosquantion

Description

@noelyriosquantion

I am using the angular-translate and in the configuration of my application I have the following:

`corporativas.config(['$translateProvider',
function ($translateProvider) {
//TRANSLATION SYSTEM
$translateProvider.useStaticFilesLoader({
prefix: 'locales/locale-',
suffix: '.json'
});

$translateProvider.registerAvailableLanguageKeys(['en', 'es']);
$translateProvider.preferredLanguage('en'); //manual decision of translation provider
$translateProvider.fallbackLanguage('en');
$translateProvider.useSanitizeValueStrategy('sanitize');
$translateProvider.useCookieStorage(); //use cookie storage to save the language of the user, updated everytime it changes

}]);`

But the languages that are defined in the function registerAvailableLanguageKeys () are static, but for my application these values must be obtained from the database.

I understand that in the angle config I can not make asynchronous calls because the angular life cycle executes the config first and may not return anything at run time.

So I was wondering if anyone knows how to update the values of the registerAvailableLanguageKeys () from a controller or from the run.

version:

Angularjs: 1.6.4
Angular-translate: 2.15.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions