• App Loader offers an app called Languages. This is customizable and gives you the choice to upload country specific settings, which are called locales. Take a look at local planet page eg en_GB

    By customizing means: Select a locale like de_DE and click on Upload. Now you have stored the information on your Bangle.js.

    Keep in mind that only the 6x8 font can handle char values > 127.

    The app Settings is using this locale to translate some words into you language , see attached pictures.

    Existing translation set:

    trans: { yes: "ja", Yes: "Ja", no: "nein", No: "Nein", ok: "ok", on: "an", off: "aus" }}
    

    That allows to display Yes as meaning in you local like Ja and so on.

    Code snippet

    var locale = require('locale');
    console.log(locale.translate("Yes"));
    Ja
    

    Or get the day and month name in the local language

            abmonth: "Jan,Feb,Mär,Apr,Mai,Jun,Jul,Aug,Sep,Okt­,Nov,Dez",
            month: "Januar,Februar,März,April,Mai,Juni,Juli­,August,September,Oktober,November,Dezem­ber",
            abday: "So,Mo,Di,Mi,Do,Fr,Sa",
            day: "Sonntag,Montag,Dienstag,Mittwoch,Donner­stag,Freitag,Samstag",
    

    Code snippet

    var locale = require('locale');
    //  day of  week for today 
            // normal
            console.log(locale.dow(new Date())); 
            // Mittwoch
            // short
            console.log(locale.dow(new Date(), 1)); 
            // Mi
    
    // name of month for today  
            // normal
           console.log(locale.month(new Date()));
           // März
           // short 
           console.log(locale.month(new Date(), 1));
           // Mär
    

    Snippet with all possible function for locale

    var locale = require('locale');
    
    console.log(locale.name);
    console.log(locale.currencySym);
    console.log(locale.dow(new Date()));
    console.log(locale.dow(new Date(), 1));
    console.log(locale.month(new Date()));
    console.log(locale.month(new Date(), 1));
    console.log(locale.number(4.98));
    console.log(locale.currency(4.98));
    console.log(locale.distance(150));
    console.log(locale.distance(15000));
    console.log(locale.speed(150));
    console.log(locale.temp(150));
    console.log(locale.translate("off"));
    console.log(locale.date(new Date()));
    console.log(locale.date(new Date(),1));
    console.log(locale.time(new Date()));
    console.log(locale.time(new Date(),1));
    
    /* output
    de_DE
    Mittwoch
    Mi
    März
    Mär
    4,98
    4,98€
    150m
    15km
    150kmh
    150°C
    aus
    Mittwoch, 25. März 2020
    25.03.2020
    08:11:09
    08:11
    */
    

    Hope you now have an idea what this app can be used for and you start adding locales to your apps.

    If your language is missing or has typos, please create issues or pull request on github.


    2 Attachments

    • Setting_Sample.jpg
    • Setting_without.jpg
About

Avatar for MaBe @MaBe started