You are reading a single comment by @Robin and its replies. Click here to read the full conversation.
  • Using glibc export for an example how locale could look

    So this peace of code is not a app but a locale saver

    • lives in Bangle.js App config page
    • User select his locale from a pull down
    • only store selected local in @locale
    • app can use it via reading @locale

    What do you think?

    var locales = {
        "en_US" : {
            mon   : "January,February,March,April,May,June,July,August,September,October,November,December",
            abmon : "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec",
            day   : "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday",
            abday : "Sun,Mon,Tue,Wed,Thu,Fri,Sat"
        },
    
        "de_DE" : {
            mon   : "Januar,Februar,März,April,Mai,Juni,Juli,August,September,Oktober,November,Dezember",
            abmon : "Jan,Feb,Mär,Apr,Mai,Jun,Jul,Aug,Sep,Okt,Nov,Dez",
            day   : "Sonntag,Montag,Dienstag,Mittwoch,Donnerstag,Freitag,Samstag",
            abday : "So,Mo,Di,Mi,Do,Fr,Sa"
        },
        "fr_FR": {
            mon   : "janvier,février,mars,avril,mai,juin,juillet,août,septembre,octobre,novembre,décembre",
            abmon : "anv.,févr.,mars,avril,mai,juin,juil.,août,sept.,oct.,nov.,déc.",
            day   : "dimanche,lundi,mardi,mercredi,jeudi,vendredi,samedi",
            abday : "dim.,lun.,mar.,mer.,jeu.,ven.sam."
        },
        "it_IT": {
            mon   : "gennaio,febbraio,marzo,aprile,maggio,giugno,luglio,agosto,settembre,ottobre,novembre,dicembre",
            abmon : "gen,feb,mar,apr,mag,giu,lug,ago,set,ott,nov,dic",
            day   : "domenica,lunedì,martedì,mercoledì,giovedì,venerdì, sabato",
            abday : "dom,lun,mar,mer,gio,ven,sab"
        }
    };
    
    
    // save my relevant locale setting for for day, abday, mon, abmon
    var locale = "en_US";
    require("Storage").write("@locale",JSON.stringify(locales[locale]));
    
    // read my locale setting for day, abday, mon, abmon
    myLocale = require("Storage").readJSON("@locale");
    //
    console.log(myLocale.day.split(','));
    console.log(myLocale.abday.split(','));
    console.log(myLocale.mon.split(','));
    console.log(myLocale.abmon.split(','));
    
    // output
    
    >[
      "Sunday",
      "Monday",
      "Tuesday",
      "Wednesday",
      "Thursday",
      "Friday",
      "Saturday"
     ]
    [
      "Sun",
      "Mon",
      "Tue",
      "Wed",
      "Thu",
      "Fri",
      "Sat"
     ]
    [
      "January",
      "February",
      "March",
      "April",
      "May",
      "June",
      "July",
      "August",
      "September",
      "October",
      "November",
      "December"
     ]
    [
      "Jan",
      "Feb",
      "Mar",
      "Apr",
      "May",
      "Jun",
      "Jul",
      "Aug",
      "Sep",
      "Oct",
      "Nov",
      "Dec"
     ]
    > 
    
    
  • Tue 2020.02.18

    'What do you think?'

    While I have only been taking sneak peaks at this Bangle.js development, I must say @MaBe that the concept and presentation are succinct, tidy and easy to understand. Nicely Done. Kudos!

    As I understand this then, for uncommon Locales, would a developer then use the Local Helper Library (link in #20 post) to create their own var locales assignment, thus reducing the code bloat and avoidance of unnecessary memory usage then?   or,  is the intent to make this part of the core, and somehow override the set of Locales?

    EDIT:   Wed 2020.03.04
    Answered in post #34

    Following the usage of that now defined Locale, that it's form would then be enhanced by the use of @allObjects Date Formatter code in post #2 or post #16?

About

Avatar for Robin @Robin started