Just wondering if there's any way to change the language of an expo app with typescript based on user selection (so not device language).I read through the docs on expo https://docs.expo.io/versions/latest/sdk/localization/ but there doesn't seem to be anything on it.
Below is what I have currently, and it's only working for device set language.
import * as Localization from 'expo-localization';import I18n from 'i18n-js';// import translationsimport en from './en.json'import zh from './zh.json'// bind translations to i18nI18n.translations = { en, zh}// set phones languageconst getLanguage = async() => { try { const choice = Localization.locale I18n.locale = choice.substr(0, 2) I18n.initAsync() } catch (error) { console.log(error) }}getLanguage()// export functionexport function t(name: string) { return I18n.t(name)}
Only thing now is that I don't know how to pass a language based on user input.