-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(i18n): support 简体中文, 繁體中文, English, 日本語, Deutsch, Русский язык #499
- Loading branch information
Showing
35 changed files
with
780 additions
and
329 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
--- | ||
category: config | ||
title: I18n | ||
--- | ||
|
||
`ngx-gantt` has 6 built-in languages, namely Simplified 简体中文(zh-hans),繁體中文(zh-hant),English(en-us),日本語(ja-jp),Deutsch(de-de),Русский язык(ru-ru). It also supports custom languages. | ||
|
||
### Using Built-in Languages | ||
|
||
```javascript | ||
import { GANTT_GLOBAL_CONFIG } from 'ngx-gantt'; | ||
|
||
@NgModule({ | ||
... | ||
providers: [ | ||
{ | ||
provide: GANTT_GLOBAL_CONFIG, | ||
useValue: { | ||
locale: GanttI18nLocale.enUs, | ||
} | ||
}, | ||
... | ||
] | ||
... | ||
}) | ||
export class AppModule { | ||
|
||
} | ||
|
||
|
||
``` | ||
|
||
### Configuring Custom Languages | ||
|
||
The built-in languages support override configuration. Just specify the ID of the language that needs to be overridden for the configuration content. If the specified ID doesn't exist, a new language will be created. | ||
|
||
The dateFormats formats follow the [date-fns](https://date-fns.org) format and support a variety of formats. | ||
|
||
```javascript | ||
import { GANTT_GLOBAL_CONFIG } from 'ngx-gantt'; | ||
|
||
@NgModule({ | ||
... | ||
providers: [ | ||
{ | ||
provide: GANTT_I18N_LOCALE_TOKEN, | ||
useValue: { | ||
id: 'ko-kr', | ||
dateLocale: ko, // Specify the date-fns format locale.If not provided, the default is the en-us locale. | ||
views: { | ||
[GanttViewType.hour]: { | ||
label: '매시간', | ||
dateFormats: { | ||
primary: 'M월 d일', | ||
secondary: 'HH:mm' | ||
} | ||
}, | ||
[GanttViewType.day]: { | ||
label: '매일', | ||
dateFormats: { | ||
primary: 'yyyy년 M월 d일', | ||
secondary: 'd' | ||
} | ||
}, | ||
... | ||
} | ||
}, | ||
multi: true | ||
}, | ||
{ | ||
provide: GANTT_GLOBAL_CONFIG, | ||
useValue: { | ||
locale: 'ko-kr' | ||
} | ||
} | ||
] | ||
... | ||
}) | ||
export class AppModule { | ||
|
||
} | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.