How to read metric/statute or language setting?

Former Member
Former Member
I can't seem to find any way of reading the settings chosen by the simulator? e.g., metric/statute units or the language setting.

Thanks
  • We are adding a getDeviceSettings() to the System API which will let you get the display units for various types (pace, distance, time) as well as whether or not vibration and tones are enabled or disabled. We don't plan on exposing the current language since Connect IQ will use any available translated strings based on the device's current language. What is your use case for wanting to know the current language?
  • Former Member
    Former Member over 10 years ago
    That sounds like it will be perfect, thanks.

    I don't have a use case for the current language - I was just lumping it in with other device settings. (And I didn't realise about the clever translated strings feature with the resource files).
  • You can still read the language - if you really wanted to, probably for other reasons ;)

    Create a string resource that has the name of the languages for values, and using loadResource(), connectIQ will pick the right string according to the language.

    Something like:

    <resources>
    <text id="language">
    <string lang="en_US" value="en"/>
    <string lang="fr_FR" value="fr" />
    <!-- other languages here... -->
    </text>
    </resources>


    then:

    lang = Ui.loadResource(Rez.strings.language)

    lang should be "en" if the user language is English, "fr" for French, etc... Kind of a hack, but should work. Tadaaa!
  • I had tried to do this (see this post), and it didn't work. The posts by Ken and Kyle gave me a workaround for the issue (one string resource file per language, each with just one resource which is the language). I would have posted this information earlier, but it sounded like the OP had seen that post already.