This repository was archived by the owner on May 13, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +37
-9
lines changed
src/theme/NavbarItem/LocaleDropdownNavbarItem Expand file tree Collapse file tree 2 files changed +37
-9
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,18 @@ const config = {
3232 es : {
3333 label : 'Español' ,
3434 } ,
35+ fr : {
36+ label : 'Français' ,
37+ } ,
38+ de : {
39+ label : 'Deutsch' ,
40+ } ,
41+ vi : {
42+ label : 'Tiếng Việt' ,
43+ } ,
44+ th : {
45+ label : 'Thai' ,
46+ } ,
3547 } ,
3648 } ,
3749
Original file line number Diff line number Diff line change @@ -35,15 +35,31 @@ export default function LocaleDropdownNavbarItem({
3535 } ;
3636 } ) ;
3737
38- const items = [ ...dropdownItemsBefore , ...localeItems , ...dropdownItemsAfter ] ;
38+ const getShortNames = ( locale ) => {
39+ switch ( locale ) {
40+ case 'en' :
41+ return 'EN' ;
42+ case 'es' :
43+ return 'ES' ;
44+ case 'zh-Hans' :
45+ return '简体' ;
46+ case 'zh-Hant' :
47+ return '繁體' ;
48+ case 'fr' :
49+ return 'FR' ;
50+ case 'de' :
51+ return 'DE' ;
52+ case 'vi' :
53+ return 'VI' ;
54+ case 'th' :
55+ return 'TH' ;
56+ default :
57+ return '' ;
58+ }
59+ } ;
3960
40- const dropdownLabel = localeConfigs [ currentLocale ] . label ;
61+ const items = [ ...dropdownItemsBefore , ...localeItems , ...dropdownItemsAfter ] ;
62+ const dropdownLabel = getShortNames ( currentLocale ) ;
4163
42- return (
43- < DropdownNavbarItem
44- { ...props }
45- label = { < > { dropdownLabel === 'English' ? 'EN' : 'ES' } </ > }
46- items = { items }
47- />
48- ) ;
64+ return < DropdownNavbarItem { ...props } label = { < > { dropdownLabel } </ > } items = { items } /> ;
4965}
You can’t perform that action at this time.
0 commit comments