docs: add Mapping of Culture Name to Angular Locale File Name topic to Localization.md

#4867
pull/4868/head
mehmet-erim 5 years ago
parent c0230b7ccc
commit 6b2cb684ce

@ -193,6 +193,35 @@ import { Component } from '@angular/core';
export class AppComponent {}
```
## Mapping of Culture Name to Angular Locale File Name
Some of the culture names defined in .NET do not match Angular locales. In such cases, the Angular app throws an error like below at runtime:
![locale-error](./images/locale-error.png)
If you see the error like above, you should pass the `cultureNameToLocaleFileNameMapping` property like below to CoreModule's forRoot static method.
```js
// app.module.ts
@NgModule({
imports: [
// other imports
CoreModule.forRoot({
// other options
cultureNameToLocaleFileNameMapping: {
"X": "Y",
"AnotherLocaleNameDefinedInDotnet": "AnotherLocaleNameDefinedInAngular"
}
})
//...
```
- The key indicated by "X" above represents the culture name defined in .NET (e.g. "en-US").
- The value indicated by "Y" above represents the locale file name defined in Angular (e.g. "en").
See the [all locale files in Angular](https://github.com/angular/angular/tree/master/packages/common/locales)
## See Also

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Loading…
Cancel
Save