Hello. I am new in using Ionic and in creating mobile apps so I would appreciate your help for multilanguag app.
How can i have 2 languages in the app? I will have some static content in some different pages, so i want the user to be able to choose the language that he wants to see the app.
before someone is posting some external angular-modules for that.
you can simply check the browserlanguage:
var userLang = navigator.language || navigator.userLanguage;
After that you can only use the first two chars --> “de”, “en”, …
Then you can decide if you provide translations for the language --> if not use your default language.
How you store your translations?
you can put them in external files and load them over $http or set them in services. --> if the user switches the language -> load the correct translations and thats it.
$rootScope.dict = currentTranslations;
You can put current translations on the $rootScope. so you have them everywhere in your app. In templates you can use them like that {{dict.myKey}}
How will i check the browser language? From which browser will that check that? Will that check the default browser app language of the user smartphone?
yep , because your hybrid app is running in the webview of your OS browser.
So you will get the language of the browser/device of the user.