Threatening-Code-Comments / tcc-app

This is the ThreateningCodeComments app. We failed to make it threatening, but if you can read this at least we didn't fail to make it at all.
1 stars 0 forks source link

Translatability #23

Open JereIsThere opened 3 weeks ago

JereIsThere commented 3 weeks ago

https://docs.expo.dev/guides/localization/#getting-the-users-language

npx expo install expo-localization
JereIsThere commented 3 weeks ago
import { getLocales } from 'expo-localization';
import { I18n } from 'i18n-js';

// Set the key-value pairs for the different languages you want to support.
const i18n = new I18n({
  en: { welcome: 'Hello' },
  ja: { welcome: 'こんにちは' },
});

// Set the locale once at the beginning of your app.
i18n.locale = getLocales()[0].languageCode;

console.log(i18n.t('welcome'));