You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
81 lines
2.9 KiB
81 lines
2.9 KiB
import i18n from 'i18next'; |
|
import { initReactI18next } from 'react-i18next'; |
|
import * as Localization from 'expo-localization'; |
|
|
|
const resources = { |
|
en: { |
|
translation: { |
|
selectCountry: 'Select your country', |
|
subtitle: 'You can change the country & language in your profile settings anytime.', |
|
welcomeTitle: 'Welcome!', |
|
welcomeMessage: 'Thank you for choosing your country. You can now log in and use the app.', |
|
loginNow: 'Log in now', |
|
mainAppTitle: 'Welcome to MainApp', |
|
mainAppText: 'This is the main application screen.', |
|
resetCountry: 'Reset Country Selection', |
|
loginTitle: 'Login For brainnel', |
|
loginSubtitle: 'Login to start your business', |
|
continueWithGoogle: 'Continue with Google', |
|
continueWithFacebook: 'Continue with Facebook', |
|
continueWithApple: 'Continue with Apple', |
|
orContinueWith: 'Or continue with', |
|
instagram: 'Instagram', |
|
email: 'Email', |
|
phone: 'Phone', |
|
forgotPassword: 'Forget your password?', |
|
termsText: 'By continuing, you agree to our', |
|
termsOfUse: 'Terms of Use', |
|
and: 'and', |
|
privacyPolicy: 'Privacy Policy', |
|
wholesalePrice: 'Wholesale price', |
|
fastShipping: 'Fast shipping', |
|
}, |
|
}, |
|
fr: { |
|
translation: { |
|
selectCountry: 'Sélectionnez votre pays', |
|
subtitle: 'Vous pouvez modifier le pays et la langue dans les paramètres de votre profil à tout moment.', |
|
welcomeTitle: 'Bienvenue!', |
|
welcomeMessage: 'Merci d\'avoir choisi votre pays. Vous pouvez maintenant vous connecter et utiliser l\'application.', |
|
loginNow: 'Se connecter maintenant', |
|
mainAppTitle: 'Bienvenue sur MainApp', |
|
mainAppText: 'Ceci est l\'écran principal de l\'application.', |
|
resetCountry: 'Réinitialiser la sélection du pays', |
|
loginTitle: 'Connexion à brainnel', |
|
loginSubtitle: 'Connectez-vous pour démarrer votre entreprise', |
|
continueWithGoogle: 'Continuer avec Google', |
|
continueWithFacebook: 'Continuer avec Facebook', |
|
continueWithApple: 'Continuer avec Apple', |
|
orContinueWith: 'Ou continuer avec', |
|
instagram: 'Instagram', |
|
email: 'Email', |
|
phone: 'Téléphone', |
|
forgotPassword: 'Mot de passe oublié?', |
|
termsText: 'En continuant, vous acceptez nos', |
|
termsOfUse: 'Conditions d\'utilisation', |
|
and: 'et', |
|
privacyPolicy: 'Politique de confidentialité', |
|
wholesalePrice: 'Prix de gros', |
|
fastShipping: 'Livraison rapide', |
|
}, |
|
}, |
|
}; |
|
|
|
const getDefaultLanguage = () => { |
|
const locale = Localization.locale; |
|
const languageCode = locale.split('-')[0]; // 获取语言代码部分 |
|
return languageCode === 'fr' ? 'fr' : 'en'; |
|
}; |
|
|
|
i18n |
|
.use(initReactI18next) |
|
.init({ |
|
resources, |
|
lng: getDefaultLanguage(), |
|
fallbackLng: 'en', |
|
interpolation: { |
|
escapeValue: false, |
|
}, |
|
}); |
|
|
|
export default i18n;
|