-
Notifications
You must be signed in to change notification settings - Fork 22
feat(localization): Move old samples for localization and add separate sample for the new localization. #3752
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
af97ca2
feat(localization): Move old samples for localization and add separat…
skrustev c7f79fb
fix(localization): Apply configs and intl implementation.
skrustev 627a734
Merge branch 'vnext' into skrastev/new-localization
skrustev 1daabb3
fix(localization): Fix i18n sample and bump version.
skrustev db32fb3
Merge master into skrastev/new-localization
skrustev ee6595a
Apply suggestion from @Copilot
dkamburov ef0d444
Apply suggestion from @Copilot
dkamburov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,11 @@ | ||
| export const BaseAppAngularLocaleConfig = { | ||
| modules: [ | ||
| { 'module': 'BrowserModule', 'import': '@angular/platform-browser' }, | ||
| { 'module': 'FormsModule', 'import': '@angular/forms' }, | ||
| { 'module': 'HammerModule', 'import': '@angular/platform-browser' }, | ||
| ], | ||
| providers: [ | ||
| { 'provider': 'provideAnimations()', 'import': '@angular/platform-browser/animations' } | ||
| ], | ||
| router: false | ||
| } | ||
This file contains hidden or 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 hidden or 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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
26 changes: 26 additions & 0 deletions
26
...lization-samples-old/localization-all-resources/localization-all-resources.component.html
This file contains hidden or 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,26 @@ | ||
| <div class="grid__wrapper"> | ||
| <igx-grid #grid [data]="data" [autoGenerate]="false" height="520px" width="100%" | ||
| [allowFiltering]="true" [locale]="locale" [rowEditable]="true" [primaryKey]="'ProductID'"> | ||
| <igx-grid-toolbar> | ||
| <igx-grid-toolbar-title>Grid with Localization</igx-grid-toolbar-title> | ||
| <igx-select [(ngModel)]="locale" (ngModelChange)="updateLocale()"> | ||
| @for (locale of selectLocales; track locale) { | ||
| <igx-select-item [value]="locale"> | ||
| {{ locale }} | ||
| </igx-select-item> | ||
| } | ||
| </igx-select> | ||
| </igx-grid-toolbar> | ||
| <igx-column field="ProductName" header="Product Name" [groupable]="true"> | ||
| </igx-column> | ||
| <igx-column field="QuantityPerUnit" header="Quantity Per Unit" [groupable]="true"> | ||
| </igx-column> | ||
| <igx-column field="UnitPrice" header="Unit Price" [sortable]="true" [hasSummary]="true" | ||
| [dataType]="'currency'" [groupable]="true"> | ||
| </igx-column> | ||
| <igx-column field="OrderDate" header="Order Date" [dataType]="'date'" [groupable]="true"> | ||
| </igx-column> | ||
| <igx-column field="Discontinued" header="Discontinued" [dataType]="'boolean'" [groupable]="true"> | ||
| </igx-column> | ||
| </igx-grid> | ||
| </div> |
7 changes: 7 additions & 0 deletions
7
...lization-samples-old/localization-all-resources/localization-all-resources.component.scss
This file contains hidden or 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,7 @@ | ||
| :host { | ||
| .grid__wrapper { | ||
| margin: 16px 32px; | ||
| } | ||
|
|
||
| --ig-size: var(--ig-size-small); | ||
| } |
122 changes: 122 additions & 0 deletions
122
...calization-samples-old/localization-all-resources/localization-all-resources.component.ts
This file contains hidden or 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,122 @@ | ||
| /* eslint-disable @typescript-eslint/ban-types */ | ||
| /* eslint-disable @typescript-eslint/member-delimiter-style */ | ||
| /* eslint-disable @typescript-eslint/naming-convention */ | ||
| import { Component, OnInit, ViewChild } from '@angular/core'; | ||
| import { registerLocaleData } from '@angular/common'; | ||
| import localeBG from '@angular/common/locales/bg'; | ||
| import localeCS from '@angular/common/locales/cs'; | ||
| import localeDA from '@angular/common/locales/da'; | ||
| import localeDE from '@angular/common/locales/de'; | ||
| import localeEN from '@angular/common/locales/en'; | ||
| import localeES from '@angular/common/locales/es'; | ||
| import localeFR from '@angular/common/locales/fr'; | ||
| import localeHU from '@angular/common/locales/hu'; | ||
| import localeIT from '@angular/common/locales/it'; | ||
| import localeJA from '@angular/common/locales/ja'; | ||
| import localeKO from '@angular/common/locales/ko'; | ||
| import localeNB from '@angular/common/locales/nb'; | ||
| import localeNL from '@angular/common/locales/nl'; | ||
| import localePL from '@angular/common/locales/pl'; | ||
| import localePT from '@angular/common/locales/pt'; | ||
| import localeRO from '@angular/common/locales/ro'; | ||
| import localeSV from '@angular/common/locales/sv'; | ||
| import localeTR from '@angular/common/locales/tr'; | ||
| import localeHI from '@angular/common/locales/hi'; | ||
| import localeHans from '@angular/common/locales/zh-Hans'; | ||
| import localeHant from '@angular/common/locales/zh-Hant'; | ||
| import { DATA } from '../../../data/nwindData'; | ||
| import { IgxGridComponent, GridResourceStringsEN, IGridResourceStrings, IgxGridToolbarComponent, IgxGridToolbarTitleComponent, IgxSelectComponent, IgxSelectItemComponent, IgxColumnComponent } from 'igniteui-angular'; | ||
| import { | ||
| IgxResourceStringsBG, IgxResourceStringsCS, IgxResourceStringsDA, IgxResourceStringsDE, | ||
| IgxResourceStringsES, IgxResourceStringsFR, IgxResourceStringsHU, IgxResourceStringsIT, | ||
| IgxResourceStringsJA, IgxResourceStringsKO, IgxResourceStringsNB, IgxResourceStringsNL, IgxResourceStringsPL, | ||
| IgxResourceStringsPT, IgxResourceStringsRO, IgxResourceStringsSV, IgxResourceStringsTR, | ||
| IgxResourceStringsZHHANS, IgxResourceStringsZHHANT | ||
| } from 'igniteui-angular-i18n'; | ||
| import { FormsModule } from '@angular/forms'; | ||
|
|
||
| @Component({ | ||
| selector: 'app-localization-all-resources-old', | ||
| styleUrls: ['./localization-all-resources.component.scss'], | ||
| templateUrl: 'localization-all-resources.component.html', | ||
| imports: [IgxGridComponent, IgxGridToolbarComponent, IgxGridToolbarTitleComponent, IgxSelectComponent, FormsModule, IgxSelectItemComponent, IgxColumnComponent] | ||
| }) | ||
| export class LocalizationAllResourcesOldComponent implements OnInit { | ||
| @ViewChild('grid', { read: IgxGridComponent, static: true }) | ||
| public grid: IgxGridComponent; | ||
| public data: any[]; | ||
| public locale: string; | ||
| public locales: { type: string, resource: object }[]; | ||
| public selectLocales = [ | ||
| 'HI', 'BG', 'CS', 'DA', 'DE', 'EN', 'ES', 'FR', 'HU', 'IT', 'JA', 'KO', 'NB', 'NL', | ||
| 'PL', 'PT', 'RO', 'SV', 'TR', 'zh-Hans', 'zh-Hant' | ||
| ]; | ||
| public partialCustomHindi: IGridResourceStrings; | ||
|
|
||
| constructor() { } | ||
| public ngOnInit(): void { | ||
| registerLocaleData(localeBG); | ||
| registerLocaleData(localeCS); | ||
| registerLocaleData(localeDA); | ||
| registerLocaleData(localeDE); | ||
| registerLocaleData(localeEN); | ||
| registerLocaleData(localeES); | ||
| registerLocaleData(localeFR); | ||
| registerLocaleData(localeHU); | ||
| registerLocaleData(localeIT); | ||
| registerLocaleData(localeJA); | ||
| registerLocaleData(localeKO); | ||
| registerLocaleData(localeNB); | ||
| registerLocaleData(localeNL); | ||
| registerLocaleData(localePL); | ||
| registerLocaleData(localePT); | ||
| registerLocaleData(localeRO); | ||
| registerLocaleData(localeSV); | ||
| registerLocaleData(localeTR); | ||
| registerLocaleData(localeHI); | ||
| registerLocaleData(localeHans); | ||
| registerLocaleData(localeHant); | ||
|
|
||
| this.data = DATA; | ||
|
|
||
| // Creating a custom locale (HI) for specific grid strings. | ||
| // Similarly can localize all needed strings in a separate IgxResourceStringsHI file (feel free to contribute) | ||
| this.partialCustomHindi = { | ||
| igx_grid_summary_count: 'गणना', | ||
| igx_grid_summary_min: 'न्यून', | ||
| igx_grid_summary_max: 'अधिक', | ||
| igx_grid_summary_sum: 'योग', | ||
| igx_grid_summary_average: 'औसत' | ||
| }; | ||
|
|
||
| this.locales = [ | ||
| { type: 'BG', resource: IgxResourceStringsBG }, | ||
| { type: 'CS', resource: IgxResourceStringsCS }, | ||
| { type: 'DA', resource: IgxResourceStringsDA }, | ||
| { type: 'DE', resource: IgxResourceStringsDE }, | ||
| { type: 'ES', resource: IgxResourceStringsES }, | ||
| { type: 'FR', resource: IgxResourceStringsFR }, | ||
| { type: 'HU', resource: IgxResourceStringsHU }, | ||
| { type: 'IT', resource: IgxResourceStringsIT }, | ||
| { type: 'JA', resource: IgxResourceStringsJA }, | ||
| { type: 'KO', resource: IgxResourceStringsKO }, | ||
| { type: 'EN', resource: GridResourceStringsEN }, | ||
| { type: 'HI', resource: this.partialCustomHindi }, | ||
| { type: 'NB', resource: IgxResourceStringsNB }, | ||
| { type: 'NL', resource: IgxResourceStringsNL }, | ||
| { type: 'PL', resource: IgxResourceStringsPL }, | ||
| { type: 'PT', resource: IgxResourceStringsPT }, | ||
| { type: 'RO', resource: IgxResourceStringsRO }, | ||
| { type: 'SV', resource: IgxResourceStringsSV }, | ||
| { type: 'TR', resource: IgxResourceStringsTR }, | ||
| { type: 'zh-Hans', resource: IgxResourceStringsZHHANS }, | ||
| { type: 'zh-Hant', resource: IgxResourceStringsZHHANT } | ||
| ]; | ||
| this.locale = 'EN'; | ||
| } | ||
|
|
||
| public updateLocale() { | ||
| const newLocale = this.locales.find(x => x.type === this.locale).resource; | ||
| this.grid.resourceStrings = newLocale; | ||
| } | ||
| } |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.