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

docs: add override i18n configuration #6195

Merged
merged 1 commit into from
Dec 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions docs/i18n.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,3 +157,28 @@ registerLocaleData(en);

[https://date-fns.org/docs/I18n#supported-languages](https://date-fns.org/docs/I18n#supported-languages)

## How to override internationalization configuration
The text of some components in `ng-zorro` depends on the internationalized text, such as the `size changer` in `nz-pagination`. At this time, you can modify the internationalization configuration to change the text content in the `size changer`:

``` typescript

import { NZ_I18N, en_US } from 'ng-zorro-antd/i18n';

const customLanguagePack = {
en_US,
...{
Pagination: {
items_per_page: "per page"
}
}
}

@NgModule({
...
providers : [
{ provide: NZ_I18N, useValue: customLanguagePack }
]
})
export class AppModule { }

```
26 changes: 26 additions & 0 deletions docs/i18n.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,29 @@ registerLocaleData(en);
## date-fns 支持语言

[https://date-fns.org/docs/I18n#supported-languages](https://date-fns.org/docs/I18n#supported-languages)

## 如何更改默认国际化语言包配置
`ng-zorro` 中有些组件的文本依赖于国际化文本,例如 `nz-pagination` 中的 `size changer`, 这时候你可以修改国际化配置来更改 `size changer` 中的文本内容:

``` typescript

import { NZ_I18N, en_US } from 'ng-zorro-antd/i18n';

const customLanguagePack = {
en_US,
...{
Pagination: {
items_per_page: "per page"
}
}
}

@NgModule({
...
providers : [
{ provide: NZ_I18N, useValue: customLanguagePack }
]
})
export class AppModule { }

```