Language select page Logic

Hi guyz,

I am trying to create a languauge Select page which should launch as first screen only when the app is launched for the first time and once the user has selected the language it should never come up again for any other launches of the ionic app.
Any Ideas???

Use localStorage to save Selected language.
When app loads check if localStorage contains selected language or not.
If not then you can show language selection screen, else skip.

Thank You…
Can you tell me how can I set the landing page to be language select page and skip code

Verify if language is present or not in Device ready event and set the path accordingly. use this pah variable in your app.config

1 Like

Thank you … I ll try this…
Can you help me with path setting feature?
Should I use $state.go() if the language is present in Device Ready…
Is that enough to skip the language select page without coming up?

In your Config function there will be some line indicating the default state as


Now the path for this function will be the one you set in device ready

[Ensure Path variable is declared as global]

1 Like

thanks for the help…

    var path = '';
    if (localStorage.getItem('appLanguage')) {
      path = '/playlists';
    } else {
      path = '/languageSelect';
    return '/app'+path;

I just did this and it works

Good to hear.
That’s what i was saying :slight_smile:

Can you please tell me how can I do this in IONIC 2?

What do you mean by ‘this’? Please be specific.

I meant to say that I have a language select page which should appear when the app is launched for the first time. Do you have any idea that how can I implement this in IONIC 2?

You can use localStorage to store language selection.
When App loads, check in localStorage if selected lang is stored or not.
If not then shows Language selection page, else show your root page.

Thanks for the solution.

You can mark answer as solution so that future user will directly goto solution.