Language Resources & CustomFont

Hye everyone,

So I have 3 custom fonts (3 differents size)

for that everything works well,

I added a resources-round-218x218 folder with an other custom font where i copy the same Fonts.xml from main resources,

it works well too,

EDIT: the Fonts.xml and the custom font are in the same folder.

<fonts>
<font id="customFont" filename="custom.fnt"/>
<font id="customFontS" filename="customSmall.fnt"/>
<font id="customFontVS" filename="customVSmall.fnt"/>
</fonts>

But when I tried to do the same for resources-rus, it doesn't work at all...

Did I miss something?

  • hye everyone

    So I could find a trick to do it,

    May be is well known for master dev but in case there are beginner like me ,I put the method I found.

    First, after many test I figured out that to use less memory in case of custom font,

    it's better to have 1 custom font for each language than 1 with all characters.

    let's take latin and cyrillic (russian) as exemple.

    1. Create 2 font files (with BMfont)

     - CustomFont and CustomFontRUS

    put them in \resources\Fonts\

    2. in \Resources\Fonts\Fonts.xml

    put 

    <fonts>
    	<font id="customFont" filename="CustomFont.fnt"/>
    	<font id="customFontRUS" filename="CustomFontRUS.fnt"/>
    </fonts>

    3. in \resources\strings\strings.xml

    put 

    <string id="LANG">Global</string>

    4. Creat \resources-rus\ folder

    inside it create strings.xml and put inside

    <string id="LANG">RUS</string>

    5. Inside \source\SHNTacticalView.mc (the name or you app)

    inside "function initialize()" put or add

            switch (Ui.loadResource(Rez.Strings.LANG)) {
        		case "RUS" : {
    				customFontS = Ui.loadResource(Rez.Fonts.customFontRUS);
        			break;}
        		default:
    			customFontS = Ui.loadResource(Rez.Fonts.customFont);
    			break;
    		}

    This method cannot be tested in the simulator but it does work on watchface

    May be an other method exists a simpler one but this one works and memory is saved.

    I hope it will help.

    Have a good day.

  • Former Member
    Former Member in reply to Shent-Aurkhan (SHN)

    This method cannot be tested in the simulator but it does work on watchface

    Why can this not be tested on the simulator?

    You can change the language in the simulator via menu bar -> settings -> language -> <your language>

  • Yes I know about this but nothing change when you do That unless you put the string for date for exemple but not if you use date. Dayof week