You are reading a single comment by @MaBe 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,J­uly,August,September,October,November,De­cember",
            abmon : "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct­,Nov,Dec",
            day   : "Sunday,Monday,Tuesday,Wednesday,Thursda­y,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,Dezem­ber",
            abmon : "Jan,Feb,Mär,Apr,Mai,Jun,Jul,Aug,Sep,Okt­,Nov,Dez",
            day   : "Sonntag,Montag,Dienstag,Mittwoch,Donner­stag,Freitag,Samstag",
            abday : "So,Mo,Di,Mi,Do,Fr,Sa"
        },
        "fr_FR": {
            mon   : "janvier,février,mars,avril,mai,juin,jui­llet,août,septembre,octobre,novembre,déc­embre",
            abmon : "anv.,févr.,mars,avril,mai,juin,juil.,ao­ût,sept.,oct.,nov.,déc.",
            day   : "dimanche,lundi,mardi,mercredi,jeudi,ven­dredi,samedi",
            abday : "dim.,lun.,mar.,mer.,jeu.,ven.sam."
        },
        "it_IT": {
            mon   : "gennaio,febbraio,marzo,aprile,maggio,gi­ugno,luglio,agosto,settembre,ottobre,nov­embre,dicembre",
            abmon : "gen,feb,mar,apr,mag,giu,lug,ago,set,ott­,nov,dic",
            day   : "domenica,lunedì,martedì,mercoledì,giove­dì,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 MaBe @MaBe started