Skip to content

Commit

Permalink
docs: add override i18n configuration (#6195)
Browse files Browse the repository at this point in the history
  • Loading branch information
stygian-desolator authored Dec 15, 2020
1 parent 40c644a commit ca06ebf
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
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 { }

```

0 comments on commit ca06ebf

Please sign in to comment.