Provide a uniform localization support for @delon/*
class library built-in text of components.
Usage
Providers
Provides the token of DELON_LOCALE
for configuring antd locale text globally.
import { DELON_LOCALE, en_US } from '@delon/theme';
@NgModule({
...
providers : [ { provide: DELON_LOCALE, useValue: en_US } ]
})
export class AppModule { }
Service
Provides the service of DelonLocaleService
to dynamic change the locale text.
import { en_US, DelonLocaleService } from '@delon/theme';
...
constructor(private delonLocaleService: DelonLocaleService) {
}
switchLanguage() {
this.delonLocaleService.setLocale(en_US);
}
Note: en_US
is the package name, follow below.
Supported languages
Language | Filename |
---|
English | en_US |
Chinese (Simplified) | zh_CN |
Chinese (Traditional) | zh_TW |
Turkish | tr_TR |
Polish | pl_PL |
Greek | el_GR |
Korean | ko_KR |
Croatian | hr_HR |
Japanese | ja_JP |
Slovenian | sl_SI |
French | fr_FR |
Spanish | es_ES |
Italian | it_IT |
Add a new language
If you can't find your language, you are welcome to create a locale package based on en_US (You can also refer to #308 to contribute language package to us) and send us a pull req