How do I access the default language files?

Is it possible to use the default language files installed on the device to retrieve text labels for data fields in whatever language the user has selected?

If for instance I want to make my own data field showing the current speed (enhanced to show the speed in various colors), then there is a tag in each xml language file named TXT_Speed_STR_M which contains the label for the speed.

Can I use this to show the label in my data field, or are these xml files only for use in Garmins own internal data fields?

  • I'm not sure what you really want to achieve. You can add translatable="false" in any of the strings in your default language xml. I.e:

    <string id="TXT_Speed_STR_M" translatable="false>m</string>

    But strange as it seams there are languages that even translate that. Think about languages that don't use lating script. So maybe this non-translatable string better fits strings like "--". However if you really don't want it to be translated, then maybe you can just use a hard-coded string constant in your code instead of using Rez.Strings

  • I do want it to be translated. That is the whole point. Let me try to explain a bit more then.

    My Garmin device (Edge 1030 Plus) has a build in data field that shows the current speed. This field has the label text "Speed" shown in the display above the number. This label text is taken from the xml file located in the folder Garmin/Text that matches the currently selected language on the device. I have selected Danish on my Garmin, so it uses the file Garmin/Text/Danish.gtt when looking up label texts for data fields. If I select another language, it uses another xml file with another text.

    Now, if I want to create my own data field, which also needs to have the label text "Speed" in it, and have it be automatically translated, I would prefer to use the text in the currently active xml file in the same way, instead of having to code the word "Speed" into my local ressource file in all the different languages (there are 19 of them). The word "speed" is not the only one I need to have translated, so it can quickly become a lot of ressource strings.

    It would be neat if I could use the translate mechanism that is already present on the device when it comes to simple text strings that are already defined there.

    Here is a snippet from the Danish xml file as an example:

    <str>
    <tag>TXT_Speed_STR_M</tag>
    <txt>Fart</txt>
    </str>

    So looking up with the id "TXT_Speed_STR_M" should give me the string "Fart". Yes, "Speed" is "Fart" in Danish. :-)

    I hope that explains it.

  • Yes, now it's clear. Good idea. I don't know if it's possible to use "default" strings from xml and/or code. If anyone knows, then I am also interested.

  • Haven’t looked but don’t know whether the translation files might be also hidden in the SDK somewhere. From those you could build an appropriate json file to use with your app. 

  • If I understand what you want to do, have you looked at the "Strings" sample in the SDK?  Different strings for different languages and devices.  You can run this in the sim and switch languages, or try it on a real device.  I sideloaded the prg and changed the language on the watch from English to German, so now the app shows stings in German

    The translated strings are in the prg file - they are not obtained from files in Garmin/text.

    There's no way for a CIQ app to directly access what's in the garmin/text files, but some things can be seen indirectly, like month and day of week names with Gregorian info.  Those are translated to the current language on the watch.