neuronetio / gantt-elastic

Gantt Chart [ javascript gantt chart, gantt component, vue gantt, vue gantt chart, responsive gantt, project manager , vue projects ]
https://neuronet.io/gantt-elastic/
MIT License
1.3k stars 315 forks source link

Locale options doesn't seem to work #20

Closed sandeepkumarmunige closed 5 years ago

sandeepkumarmunige commented 5 years ago

Locale options sent are as below but could not get them loaded Gantt elastic.

locale: { code: "en", Now: "Now", "X-Scale": "Zoom-X", "Y-Scale": "Zoom-Y", "Task list width": "Task list", "Before/After": "Expand", "Display task list": "Task list" } }

image

mdieudonne commented 5 years ago

Hey,

Works nice on my side :

        locale: {
            code: customLocale,
            'Now': 'Aujourd\'hui',
            'X-Scale': 'Zoom',
            'Y-Scale': 'Interligne',
            'Task list width': 'Liste',
            'Before/After': 'Période',
            'Display task list': 'Liste'
        },

image

Using dayjs:

<script>
        dayjs.locale('fr');
        dayjs().locale('fr').format();
        // get locale object
        var customLocale = window.dayjs_locale_fr
</script>
neuronetio commented 5 years ago

@sandeepkumarmunige take a look at this example You need to have header with sliders and labels to se translations for it.

You can also translate calendar dates as follows:

locale: {
  code:'fr',
  'Now': 'Aujourd\'hui',
  'X-Scale': 'Zoom',
  'Y-Scale': 'Interligne',
  'Task list width': 'Liste',
   'Before/After': 'Période',
   'Display task list': 'Liste',
  weekdays: 'Dimanche_Lundi_Mardi_Mercredi_Jeudi_Vendredi_Samedi'.split('_'),
  months: 'Janvier_Février_Mars_Avril_Mai_Juin_Juillet_Août_Septembre_Octobre_Novembre_Décembre'.split('_'),
  monthsShort: 'janv_févr_mars_avril_mai_juin_juil_août_sept_oct_nov_déc'.split('_'),
  relativeTime: {
    future: 'dans %s',
    past: 'il y a %s',
    s: 'quelques secondes',
    m: 'une minute',
    mm: '%d minutes',
    h: 'une heure',
    hh: '%d heures',
    d: 'un jour',
    dd: '%d jours',
    M: 'un mois',
    MM: '%d mois',
    y: 'un an',
    yy: '%d ans'
  },
  ordinal: (n) => {
    const o = n === 1 ? 'er' : ''
    return `${n}${o}`
  }
}