Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49083

Internacionalization i18n with angular-localization

$
0
0

@edu_andrade wrote:

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?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49083

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>