Quantcast
Channel: Ionic Forum - Latest posts
Viewing all articles
Browse latest Browse all 228595

How to change Internationalization of an Ionic App?

$
0
0

Hello guys and @andrewmcgivery, I refer to this link http://mcgivery.com/internationalization-of-an-ionic-app-multilanguage-support/ and then follow, but when run it in Chrome,It looks like working but some mistake "Change reload and lost" . I using radio button with ng-change.
In app.js

.config(function ($translateProvider) {
  $translateProvider.translations('English', {
    TITLE: 'Language'
  });
  $translateProvider.translations('Spain', {
    TITLE: 'Idioma'
  });
  $translateProvider.preferredLanguage('English');
})

In inside controller "TestCtrl"

 $scope.langs = [
    'English',
    'Spain'
  ];

  var selectedLang = $window.localStorage.appLang;
  if (selectedLang) {
    $scope.appLang = selectedLang;
  } else {
    $scope.appLang = 'English';
  }

  $scope.langChange = function (lang) {
    $translate.use(lang);
    // save language locally
    $window.localStorage.appLang = lang;
    // reload
    $window.location = '';
  }

In page test

Can you tell me what's wrong ? Thank you so much.


Viewing all articles
Browse latest Browse all 228595

Trending Articles