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

local is ignored #56

Closed
Dr-Satan opened this issue Jul 19, 2018 · 1 comment
Closed

local is ignored #56

Dr-Satan opened this issue Jul 19, 2018 · 1 comment

Comments

@Dr-Satan
Copy link

Hello, I would like to pass this component in french but it seems that the local custom is ignored

` const options = {

        locales: {
            // create a new locale (text strings should be replaced with localized strings)
            mylocale: {
                current: 'current',
                time: 'time',
                months: 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split('_'),
                monthsShort: 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split('_'),
                monthsParseExact: true,
                weekdays: 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'),
                weekdaysShort: 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'),
                weekdaysMin: 'di_lu_ma_me_je_ve_sa'.split('_'),
            }
        },
        // use the new locale
        locale: 'mylocale',
        width: '100%',
        orientation: 'top',
        maxMinorChars: 3,
        zoomable: true,
        horizontalScroll: true,
        editable: true,
        start: this.state.startDate,
        end: this.state.endDate,
        stack: false,
        showMajorLabels: true,
        showCurrentTime: true,
        zoomMin: 1000000,
        type: 'range'
    }`
@Dr-Satan
Copy link
Author

So I finally found after a lot of testing.
Local was systematically ignored no matter what I did.

My solution to put in French (or in any other language)

  • download the file moment-with-locales.js
  • place it in the public directory (otherwise bug)
  • include it in the public/index.html page
  • and in your react component: moment.locale('fr') and locale: 'fr' in option

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

1 participant