Internacionalization i18n with angular-localization


#1

Hi everybody, I need a help! I tried to change a defaultLocale in my controller.js and I’am using i18n with angular. The strutucture is:

angular.module('starter.controllers', ['ngLocalize', 'ngLocalize.Config']) .value('localeConf', { basePath: 'js/Locales', defaultLocale: 'pt-BR', sharedDictionary: 'common', fileExtension: '.lang.json',

the directive:

.controller('ConfiguracaoCtrl', function ($scope,... , locale, localeConf) {...

and the function:

` $scope.selecionaIdioma = function(idioma){

    localeConf.defaultLocale = idioma; //tried to set a language
    localStorage.setItem("appIdioma",idioma);

}`

I have the file to translate the languages: js > locales > es-CL > common.lang.json and js > locales > pt-BR > common.lang.json

The “defaultLocale” changed but not the language. Please, any idea what I’m doing wrong?

A point… in my app.js… I have too:

angular.module('starter', ['ionic', .., 'ngLocalize', 'ngLocalize.Config']) .value('localeConf', { basePath: 'js/Locales', defaultLocale: 'pt-BR', sharedDictionary: 'common', fileExtension: '.lang.json',

The “select language” is in my controller.js… So I need set “defaultLocale” in my app.js. Is this posible?