How to add support for multiple (many) languages and devices

Hello,
I am trying to make a watchface, which will work for all devices and for many languages.
In order to do it I need to put some different pictures for different resolution and with different languages.
I could not find a good example or something in the documentation.

As I see when I create multilanguage project, system create some folders like
resources
resources-eng
resources-fre
resources-rus
and etc.

I have layout like this

<layout id="WatchFace">
<bitmap id="bgPicture" x="0" y="0" filename="../images/my_pic_round_watch_en.png"/>
</layout>

My question is where can I put and how can I make a relation for pictures with other languages and other devices?

In other words I need to put somewhere pictures like this

<bitmap id="bgPicture" x="0" y="0" filename="../images/my_pic_round_watch_fr.png"/>
<bitmap id="bgPicture" x="0" y="0" filename="../images/my_pic_round_watch_ru.png"/>

<bitmap id="bgPicture" x="0" y="0" filename="../images/my_pic_square_watch_en.png"/>
<bitmap id="bgPicture" x="0" y="0" filename="../images/my_pic_square_watch_fr.png"/>
<bitmap id="bgPicture" x="0" y="0" filename="../images/my_pic_square_watch_ru.png"/>

and I do not know where can I put them.
  • Have a look at this:

    http://developer.garmin.com/connect-iq/developer-tools/user-interface/

    Then also something to help jump start is to read the following thread:

    https://forums.garmin.com/showthread.php?228721-In-App-Device-Detection

    you need to follow some naming convention like

    resources-fenix3/strings.xml <- base language strings for fenix 3
    resources-fenix3-spa/strings.xml <- Spanish strings for fenix 3
    resources-fr920xt/strings.xml <- base language strings for 920
    resources-fr920xt-spa/strings.xml <- Spanish strings for 920
  • Former Member
    Former Member over 10 years ago
    HERMOT's post is a good starting point.

    My question is where can I put and how can I make a relation for pictures with other languages and other devices?

    In other words I need to put somewhere pictures like this

    <bitmap id="bgPicture" x="0" y="0" filename="../images/my_pic_round_watch_fr.png"/>
    <bitmap id="bgPicture" x="0" y="0" filename="../images/my_pic_round_watch_ru.png"/>

    <bitmap id="bgPicture" x="0" y="0" filename="../images/my_pic_square_watch_en.png"/>
    <bitmap id="bgPicture" x="0" y="0" filename="../images/my_pic_square_watch_fr.png"/>
    <bitmap id="bgPicture" x="0" y="0" filename="../images/my_pic_square_watch_ru.png"/>

    and I do not know where can I put them.


    I'll add in that you can only use language qualifiers for string resources. String resources are loading dynamically at run time to match the system language. The other resources' (bitmaps, drawables, layouts, etc) qualifiers are used at compile time to generate a different .prg based on the device. We just don't have enough memory to load everything dynamically.
  • HERMOT's post is a good starting point.



    I'll add in that you can only use language qualifiers for string resources. String resources are loading dynamically at run time to match the system language. The other resources' (bitmaps, drawables, layouts, etc) qualifiers are used at compile time to generate a different .prg based on the device. We just don't have enough memory to load everything dynamically.


    Do you mean, that I cannot make 2 different pictures for different languages? I can make different pictures only for different devices?
  • Former Member
    Former Member over 10 years ago
    Do you mean, that I cannot make 2 different pictures for different languages? I can make different pictures only for different devices?


    That is correct.
  • Thank you very much. Now I understand.
    Finally, let me explain for people, who will try to do it.

    To make a different pictures for different device it is required to create folders like this
    resources-fr920xt
    resources-epix
    resources-vivoactive
    resources-fenix3
    resources-square_watch
    resources-round_watch

    inside each folder should be 2 subfolders
    images
    layouts

    images folder for pictures (png files) for different devices.
    layouts folder should have layout.xml file with link to this resources-xxx/images/picture_name.png folder
    like this
    <layout id="WatchFace">
    <bitmap id="pic1" x="0" y="0" filename="../images/picture_for_xxx.png"/>
    </layout>

    As example full file structure can be like this

    resources-fr920xt/images/picture1_for_fr920xt.png
    resources-fr920xt/images/picture2_for_fr920xt.png
    resources-fr920xt/layouts/layout.xml
    resources-epix/images/picture1_for_epix.png
    resources-epix/images/picture2_for_epix.png
    resources-epix/layouts/layout.xml
    resources-vivoactive/images/picture1_for_vivoactive.png
    resources-vivoactive/images/picture2_for_vivoactive.png
    resources-vivoactive/layouts/layout.xml
    resources-fenix3/images/picture1_for_fenix3.png
    resources-fenix3/images/picture2_for_fenix3.png
    resources-fenix3/layouts/layout.xml
    resources-square_watch/images/picture1_for_square_watch.png
    resources-square_watch/images/picture2_for_square_watch.png
    resources-square_watch/layouts/layout.xml
    resources-round_watch/images/picture1_for_round_watch.png
    resources-round_watch/images/picture2_for_round_watch.png
    resources-round_watch/layouts/layout.xml


    each layout.xml should be like this

    <layout id="WatchFace">
    <bitmap id="pic1" x="0" y="0" filename="../images/picture1_for_fr920xt.png"/>
    <bitmap id="pic2" x="0" y="0" filename="../images/picture2_for_fr920xt.png"/>
    </layout>

    picture name can be anything but layout.xml should link to existing file inside resources-xxx/images device folder.
  • After creating the above folders, how do you ask Garmin to load the correct one?  E.g. if it's a fenix3, go to the resources-fenix3 and load the images.

  • The resource compiler does this automatically. This is explained in the Programmer's Guide here.