@@ -15,6 +15,7 @@ import {
1515 StyledText ,
1616} from '@opentrons/components'
1717
18+ import { LANGUAGES } from '/app/i18n'
1819import {
1920 getAppLanguage ,
2021 getStoredSystemLanguage ,
@@ -26,18 +27,12 @@ import { getSystemLanguage } from '/app/redux/shell'
2627import type { DropdownOption } from '@opentrons/components'
2728import type { Dispatch } from '/app/redux/types'
2829
29- // these strings will not be translated so should not be localized
30- const languageOptions : DropdownOption [ ] = [
31- { name : 'English (US)' , value : 'en-US' } ,
32- { name : '中文' , value : 'zh-CN' } ,
33- ]
34-
3530export function SystemLanguagePreferenceModal ( ) : JSX . Element | null {
3631 const { i18n, t } = useTranslation ( [ 'app_settings' , 'shared' , 'branded' ] )
3732 const enableLocalization = useFeatureFlag ( 'enableLocalization' )
3833
3934 const [ currentOption , setCurrentOption ] = useState < DropdownOption > (
40- languageOptions [ 0 ]
35+ LANGUAGES [ 0 ]
4136 )
4237
4338 const dispatch = useDispatch < Dispatch > ( )
@@ -76,7 +71,7 @@ export function SystemLanguagePreferenceModal(): JSX.Element | null {
7671 }
7772
7873 const handleDropdownClick = ( value : string ) : void => {
79- const selectedOption = languageOptions . find ( lng => lng . value === value )
74+ const selectedOption = LANGUAGES . find ( lng => lng . value === value )
8075
8176 if ( selectedOption != null ) {
8277 setCurrentOption ( selectedOption )
@@ -89,8 +84,8 @@ export function SystemLanguagePreferenceModal(): JSX.Element | null {
8984 if ( systemLanguage != null ) {
9085 // prefer match entire locale, then match just language e.g. zh-Hant and zh-CN
9186 const matchedSystemLanguageOption =
92- languageOptions . find ( lng => lng . value === systemLanguage ) ??
93- languageOptions . find (
87+ LANGUAGES . find ( lng => lng . value === systemLanguage ) ??
88+ LANGUAGES . find (
9489 lng =>
9590 new Intl . Locale ( lng . value ) . language ===
9691 new Intl . Locale ( systemLanguage ) . language
@@ -115,7 +110,7 @@ export function SystemLanguagePreferenceModal(): JSX.Element | null {
115110 </ StyledText >
116111 { showBootModal ? (
117112 < DropdownMenu
118- filterOptions = { languageOptions }
113+ filterOptions = { LANGUAGES }
119114 currentOption = { currentOption }
120115 onClick = { handleDropdownClick }
121116 title = { t ( 'select_language' ) }
0 commit comments