Update Languages registered in angular-translate #1842
Description
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