ngx-gantt icon indicating copy to clipboard operation
ngx-gantt copied to clipboard

How to change language

Open Evercosta opened this issue 2 years ago • 11 comments

Evercosta avatar May 26 '22 13:05 Evercosta

You can configure dateFormat to implement language change

// example :

import { GANTT_GLOBAL_CONFIG } from 'ngx-gantt';

@NgModule({
  providers: [
    {
      provide: GANTT_GLOBAL_CONFIG,
      useValue: {
        dateFormat: {
             yearQuarter: `QQQ 'of' yyyy`,
             month: 'LLLL',
             yearMonth: `LLLL yyyy'(week' w ')'`
        }
      }
    }
  ]
})
export class AppModule {

}

Format rules: https://date-fns.org/v2.28.0/docs/format

walkerkay avatar May 27 '22 02:05 walkerkay

@walkerkay Tank you, last question: How changing locale globally?

Evercosta avatar May 27 '22 05:05 Evercosta

@walkerkay Tank you, last question: How changing locale globally?

Time zone ? ngx-gantt data uses timestamp. If you need to show the time, you need to use some pipes to achieve it after obtaining the time in the data.

walkerkay avatar Jun 12 '22 13:06 walkerkay

Hello @walkerkay.

Congrats for this project, I liked so much. Could you tell me, how can I set the locale to ptBR in date-fns, to project-wide.

I'm already used GanttViewOptions, dateFormat, but I need put my project as portuguese.

Is this possible?

image

romildojpaiter avatar Jul 09 '22 15:07 romildojpaiter

I also can not find anywhere to configure the locale of displayed time and the properties of GanttViewOptions do not have the one named dateformat either.

image

hnguyen48206 avatar Aug 23 '22 07:08 hnguyen48206

How can I translate this: image

DyegoPimentel avatar Sep 29 '22 21:09 DyegoPimentel

I have the same issue. It seems the GanttDate class doesn't provide any entry points to set date-fns locale option (https://date-fns.org/v2.0.0-alpha.26/docs/Locale). So my week numbering is not ISO, some year have not the right number of weeks. It is possible now to set default Locale in date-fns (https://date-fns.org/v2.29.0/docs/setDefaultOptions) but only since the version 2.29:

// Set global locale: import { setDefaultOptions } from 'date-fns'; import { fr } from 'date-fns/locale'; setDefaultOptions({ locale: fr });

Update date-fns to 2.29 is probably the esiest way to solve this issue without touching anything.

Theodode avatar Nov 18 '22 06:11 Theodode

I have the same issue. It seems the GanttDate class doesn't provide any entry points to set date-fns locale option (https://date-fns.org/v2.0.0-alpha.26/docs/Locale). So my week numbering is not ISO, some year have not the right number of weeks. It is possible now to set default Locale in date-fns (https://date-fns.org/v2.29.0/docs/setDefaultOptions) but only since the version 2.29:

// Set global locale: import { setDefaultOptions } from 'date-fns'; import { fr } from 'date-fns/locale'; setDefaultOptions({ locale: fr });

Update date-fns to 2.29 is probably the esiest way to solve this issue without touching anything.

Yes, the date format uses date-fns, so you need to import date-fns to set the time zone.

walkerkay avatar Dec 14 '22 10:12 walkerkay