outwatch / outwatch-libs

OutWatch Helpers for javascript libariers
Apache License 2.0
5 stars 1 forks source link

What would be the way to set the language? #2

Open elyphas opened 4 years ago

elyphas commented 4 years ago

What would be the way to pass in the language? seems is something like this:

   flatpickr('.js--input--date_register', {
      minDate: '1920-01-01',  
      locale: {
        firstDayOfWeek: 1,
        weekdays: {
          shorthand: ['Do', 'Lu', 'Ma', 'Mi', 'Ju', 'Vi', 'Sa'],
          longhand: ['Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],         
        }, 
        months: {
          shorthand: ['Ene', 'Feb', 'Mar', 'Abr', 'May', 'Jun', 'Jul', 'Ago', 'Sep', 'Оct', 'Nov', 'Dic'],
          longhand: ['Enero', 'Febreo', 'Мarzo', 'Abril', 'Mayo', 'Junio', 'Julio', 'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre'],
        },
      },
    }); 

or this way:

const flatpickr = require("flatpickr");
const Russian = require("flatpickr/dist/l10n/ru.js").default.ru;

flatpickr(myElem, {
    "locale": Russian // locale for this instance only
});

but I can't find local parameter

elyphas commented 4 years ago

and sorry, because I can't contribute. seems is easy to add parameter locale to the facade.

cornerman commented 4 years ago

Good point!

We could extend the facade to also have the locale, here: https://github.com/OutWatch/outwatch-libs/blob/master/flatpickr/src/main/scala/outwatch/libs/flatpickr/facade/Flatpickr.scala#L25

Then you could do flatpickrWithOptions(...) and add all the options you need. Can you give me a link to the documentation mentioning locale? Then we can just add it there :)

elyphas commented 4 years ago

hi, here is the official documentation. flatpicker locale thank you!