Get the current language in device

About Monkey 2 Forums Monkey 2 Programming Help Get the current language in device

This topic contains 4 replies, has 3 voices, and was last updated by  cocon 1 month, 3 weeks ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #15128

    mac767
    Participant

    Hi,

    is there any build-in possibility to get the current selected system langauage at runtime?
    I want to pre-select the language of my app at first start to the system language (English, German, …).

    #15136

    nerobot
    Participant

    There is no.

    Mark recently closed the issue https://github.com/blitz-research/monkey2/issues/136

    don’t know why.

    #15184

    cocon
    Participant

    Perhaps there would be a new need for a module be created called “Localization”.

    I have spent a few minutes creating a module to let you get the raw system locale (you will have to interpret it with custom rules in your program).

    Basically it depends on this: http://www.cplusplus.com/reference/clocale/setlocale/

    But of course the module will have to properly designed and planned so it contains various useful features and a reasonable API. We can throw a bunch of high level ideas and then use them as a placeholder for implementation.

    Attachments:
    1. localization.zip
    #15192

    mac767
    Participant

    Hi cocon,

    thanks for sharing.

    I have to change the module.json this way to get the module availabe in Ted module manager:

    The return value are fine on my Windows machine but my tests on an Android 7 device failed. Android returns unfortunately ‘C.UTF-8’.

    Anyway thanks a lot for your effort!

    #15197

    cocon
    Participant

    Hmm, it’s bad that it does not work.

    It seems that for android we would have to interface with Java SDK.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.