Are partial resource overwritings supported

Is following safe?

Folder resources:

  • strings.xml
  • strings2.xml

Folder resources-deu:

  • strings2.xml

The sim supports this perfectly fine, if I select english as language I see the texts from resources/strings.xml + resources/strings2.xml. If I change the language to german I see the texts from resources/strings.xml + resources-deu/strings2.xml

I assume that connect iq supports fallbacks to the default language if a file is not defined inside a local resource folder, is this true? I'm unsure because

  • I did not find this documented anywhere
  • the IDE shows me a lot of warnings telling me that all texts from resources/strings.xml are missing for the german translation

Top Replies

All Replies

  • I used several properties files once in a datafield, so that higher end watches could have more settings. All watches used the same base properties file. The properties file for the high end watches contained the extra settings. It worked in the simulator but often not in the high end watches.

    After a while I just had different full properties files, which was a robust solution. But a pity that I have to change the same things in several properties files

  • I used several properties files once in a datafield, so that higher end watches could have more settings. All watches used the same base properties file. The properties file for the high end watches contained the extra settings. It worked in the simulator but often not in the high end watches.

    After a while I just had different full properties files, which was a robust solution. But a pity that I have to change the same things in several properties files

  • This is covered in the Programmer’s Guide section on Device, Family, and Localization Qualifiers

    https://developer.garmin.com/connect-iq/programmersguide/overriding-resources#devicefamilyandlocalizationqualifiers

    Resources with more specific qualifiers will always take precedence over less specific ones, so on a round, 218px x 218px device, any resources contained in the resources-round-218x218 resources folder will be used in place of those in resources-round if they share an ID. In addition any resource folder that carries a family qualifier will always defer to resource folders named with device qualifiers.

    Setting/Properties may be special, but this definitely works for strings. You don’t have to use the same file name in each resource folder, you just need to use the same resource ID.

  • link does not work, but I know what you mean - https://developer.garmin.com/connect-iq/programmers-guide/overriding-resources.

    To be more concrete, this is what my problems are:

    • the docs do not tell me that I can use different file names for strings (e.g. strings.xml, strings2.xml)
    • both string files get merged into Rez.Strings (after finding out it works, I would have assumed that I can access the strings via Rez.Strings and Rez.Strings2, maybe because that's what I'm used to from android)
    • the docs do not cover what happens if only parts of the contents of a file are overwritten by a more specific resource file + the compiler gives me a warning about every missing string in the more specific strings file

    Concrete questions:

    • is there any meaning in the file names? In my case, does strings.xml and strings2.xml have any effect? I assume not, I assume all string (no matter where they are defined) are compiled into Rez.Strings
    • what happens if my main strings.xml contains more strings than a more specific one, like e.g. the german strings.xml? Will Rez.Strings contain all strings from the main strings.xml and replaces only the ones with the german ones that it can find inside the german strings.xml? It looks like this in my tests in the sim and on my F6X. But then I'm confused - the comiler gives me a lot of warnings that I can't turn of. If this is supported then there either should not be warnings or there should be a way to define that a string does not need a translation