Multi-language support libraries and usage in React native mobile applications & with TS
- If user has saved language, use it
- If user has not saved language, use device language
- If device language is not supported, use default language
First, make sure you have Expo CLI installed:
npm install -g expo-cli
Clone:
git clone https://github.com/Hknzbyn/RN-Multi-Language.git
Navigate to the project directory:
cd MultiLanguageSample
Install:
npm install || yarn install
Run Project Locally:
expo start || npx expo start || yarn start
- If you do not want to use the saved language 1a. Extract parts containing AsyncStorage from changeLanguage function in app.tsx. 1b. Rearrange the detect partition from useLanguageStorage
- If the registered language and device language are not available, change the DEFAULT_LOCALE value.
- If you don't want to use device language, remove step 2 and edit fallbackLng: DEFAULT_LOCALE.
- If you don't use expo-localization when finding defaultLanguage, use alternative step 2.
Hakan Özbeyen - @Linkedin
Project Link: https://github.com/Hknzbyn/NewsApp