Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
elyphas opened this issue May 9, 2020 · 3 comments
Open

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

elyphas opened this issue May 9, 2020 · 3 comments

Comments

@elyphas
Copy link
Contributor

elyphas commented May 9, 2020

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
Copy link
Contributor Author

elyphas commented May 9, 2020

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

@cornerman
Copy link
Member

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
Copy link
Contributor Author

elyphas commented May 14, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants