Detect device language

  • Hi there, I'm just sorting out the localisation side of things in my game. I can successfully load strings from a csv using rexrainbows excellent csv plugin.

    I'm intending to use separate csvs for each language.

    Does anyone know how to detect the language of the device (Specifically iOS and Android?

    I've searched around and found out how to detect Windows Language through a registry entry but cant find an equivalent for Android/iOS.

    Any help, as always, is massively appreciated!

  • Use "Browser" plugin, then use expression "Browser Language" to compare.

  • Thankyou!

  • My Android Tablet (4.4.2) always shows en-US as Browser.Language, allthough I changed the language in the settings.

    What can I do?

  • Sorry that i get up this posting, but

    how to use this Plugin?

    If i call the Browser Language, what i can do with this? I found no Option like

    "When Browser Language is en-US -> Set Text to "Hello" / or / Set Variable to 0"

    or

    "When Browser Language is de-DE -> Set Text to "Hallo" / or / Set Variable to 1"

  • system compare value "browser.language" = want you want then action

  • Is not working

    http://prntscr.com/7v1ofg

  • Now it works:

    Compare two Values: Browser.Language = Browser.Language

    Action: Set Variable Language to Browser.Language

    Now it autodetect the Language of the Browser

  • or

    1.on start of layout set glob text var 'language' = Browser.Language

    2.system compare var 'language'= "En-Us" then set text to "Hello"

    -else system compare var 'language'= "De-De" then set text to "Hallo" and so on...

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Edelplastic: Make sure to put all string text between quotes ( "" ).

    In your first screenshot you need to check for the value "en-US" not en-US.

    Also, instead of "Compare two values: Browser.Language = Browser.language" you can have the action in a "On start of layout" system condition instead.

    Comparing if 0 is 0 every frame is not a good habit to take honestly. See how events work.

  • I´m back on this. Now i have start a new project and have use this auto-detection again, but now the language not change

    Global Variable "language" - Type = text - Initial value = "" (empty)

    System -> set variable "language" to Browser.Language

    System go to Layout .....

    Next Layout:

    Variable "language" = "en-US" -> Set animation to frame "0"

    Else

    Variable "language" = "de-DE" -> Set animation to frame "1"

    But it not change the animation frame "0" to "1" (0 is a english picture - 1 is german a german picture)

    It also not work when i insert the Variable directly in the Layout where the language "de-DE" is requested. It also not work with "Texts" - What i´m doing wrong?

    EDIT:

    So, now i have test to use the "en-US" for the german pictures and when i say "variable "language" = "en-US" then the picture frame change to the german texts. I think Node Webkit do not detect the Language-Codes...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)