-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(admin-ui): Use Intl API for language name translations
Relates to #971. Allows us to get rid of all manual translations of language names!
- Loading branch information
1 parent
bcb57b0
commit 8203ed8
Showing
25 changed files
with
117 additions
and
1,957 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,61 +1,61 @@ | ||
{ | ||
"generatedOn": "2021-07-08T07:55:27.400Z", | ||
"lastCommit": "cb0ce43cd81a9bd0fbb60525131dee73018ac5bc", | ||
"generatedOn": "2021-07-08T12:48:37.370Z", | ||
"lastCommit": "e950588df16d643e323c69f9f1909e74c2aa5c2c", | ||
"translationStatus": { | ||
"cs": { | ||
"tokenCount": 778, | ||
"translatedCount": 748, | ||
"percentage": 96 | ||
"tokenCount": 621, | ||
"translatedCount": 591, | ||
"percentage": 95 | ||
}, | ||
"de": { | ||
"tokenCount": 778, | ||
"translatedCount": 726, | ||
"percentage": 93 | ||
"tokenCount": 621, | ||
"translatedCount": 570, | ||
"percentage": 92 | ||
}, | ||
"en": { | ||
"tokenCount": 778, | ||
"translatedCount": 778, | ||
"tokenCount": 621, | ||
"translatedCount": 621, | ||
"percentage": 100 | ||
}, | ||
"es": { | ||
"tokenCount": 778, | ||
"translatedCount": 451, | ||
"percentage": 58 | ||
"tokenCount": 621, | ||
"translatedCount": 309, | ||
"percentage": 50 | ||
}, | ||
"fr": { | ||
"tokenCount": 778, | ||
"translatedCount": 770, | ||
"tokenCount": 621, | ||
"translatedCount": 613, | ||
"percentage": 99 | ||
}, | ||
"pl": { | ||
"tokenCount": 778, | ||
"translatedCount": 544, | ||
"percentage": 70 | ||
"tokenCount": 621, | ||
"translatedCount": 405, | ||
"percentage": 65 | ||
}, | ||
"pt_BR": { | ||
"tokenCount": 778, | ||
"translatedCount": 744, | ||
"percentage": 96 | ||
"tokenCount": 621, | ||
"translatedCount": 588, | ||
"percentage": 95 | ||
}, | ||
"ru": { | ||
"tokenCount": 778, | ||
"translatedCount": 778, | ||
"tokenCount": 621, | ||
"translatedCount": 621, | ||
"percentage": 100 | ||
}, | ||
"uk": { | ||
"tokenCount": 778, | ||
"translatedCount": 778, | ||
"tokenCount": 621, | ||
"translatedCount": 621, | ||
"percentage": 100 | ||
}, | ||
"zh_Hans": { | ||
"tokenCount": 778, | ||
"translatedCount": 699, | ||
"tokenCount": 621, | ||
"translatedCount": 558, | ||
"percentage": 90 | ||
}, | ||
"zh_Hant": { | ||
"tokenCount": 778, | ||
"translatedCount": 526, | ||
"percentage": 68 | ||
"tokenCount": 621, | ||
"translatedCount": 385, | ||
"percentage": 62 | ||
} | ||
} | ||
} |
165 changes: 0 additions & 165 deletions
165
packages/admin-ui/src/lib/core/src/common/language-translation-strings.ts
This file was deleted.
Oops, something went wrong.
This file contains 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 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 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 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 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 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 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
34 changes: 34 additions & 0 deletions
34
packages/admin-ui/src/lib/core/src/shared/pipes/locale-language-name.pipe.spec.ts
This file contains 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,34 @@ | ||
import { LocaleLanguageNamePipe } from './locale-language-name.pipe'; | ||
|
||
describe('LocaleLanguageNamePipe', () => { | ||
const pipe = new LocaleLanguageNamePipe(); | ||
it('returns correct language names for various locales', () => { | ||
expect(pipe.transform('en', 'en')).toBe('English'); | ||
expect(pipe.transform('de', 'en')).toBe('German'); | ||
expect(pipe.transform('de', 'de')).toBe('Deutsch'); | ||
expect(pipe.transform('is', 'fr')).toBe('islandais'); | ||
expect(pipe.transform('es', 'zh_Hans')).toBe('西班牙语'); | ||
expect(pipe.transform('bs', 'zh_Hant')).toBe('波士尼亞文'); | ||
expect(pipe.transform('da', 'pt_BR')).toBe('dinamarquês'); | ||
expect(pipe.transform('zh_Hant', 'en')).toBe('Traditional Chinese'); | ||
}); | ||
|
||
it('returns code for unknown codes', () => { | ||
expect(pipe.transform('xx')).toBe('xx'); | ||
}); | ||
|
||
it('returns empty string for empty input', () => { | ||
expect(pipe.transform('')).toBe(''); | ||
expect(pipe.transform(null)).toBe(''); | ||
expect(pipe.transform(undefined)).toBe(''); | ||
}); | ||
|
||
it('returns warning for invalid input', () => { | ||
expect(pipe.transform({} as any)).toBe('Invalid language code "[object Object]"'); | ||
expect(pipe.transform(false as any)).toBe('Invalid language code "false"'); | ||
}); | ||
|
||
it('returns input value for invalid string input', () => { | ||
expect(pipe.transform('foo.bar')).toBe('foo.bar'); | ||
}); | ||
}); |
Oops, something went wrong.