-
Notifications
You must be signed in to change notification settings - Fork 46
i18n added and used in drawer component #11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,8 @@ import { useCallback, useEffect } from 'react'; | |
|
|
||
| import { MenuProvider } from '../components/MenuContext'; | ||
| import { GoBackConfiguration } from './remote-control/GoBackConfiguration'; | ||
| import { I18nextProvider } from 'react-i18next'; | ||
| import i18n from '@/components/i18n'; // Initialize i18n | ||
|
||
|
|
||
| import "./configureRemoteControl" | ||
|
|
||
|
|
@@ -33,6 +35,7 @@ export default function RootLayout() { | |
|
|
||
| return ( | ||
| <MenuProvider> | ||
| <I18nextProvider i18n={i18n}> | ||
| <ThemeProvider value={DarkTheme}> | ||
| <GoBackConfiguration /> | ||
| <Stack> | ||
|
|
@@ -42,6 +45,7 @@ export default function RootLayout() { | |
| <Stack.Screen name="player" /> | ||
| </Stack> | ||
| </ThemeProvider> | ||
| </I18nextProvider> | ||
| </MenuProvider> | ||
| ); | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
|
|
||
| { | ||
| "drawer": { | ||
| "index": "Home", | ||
| "explore": "Explore", | ||
| "tv": "TV" | ||
| }, | ||
| "categories": { | ||
| "trending_movies": "Trending Movies", | ||
| "classics": "Classics", | ||
| "hip_and_modern": "Hip and Modern" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "drawer": { | ||
| "index": "Inicio", | ||
| "explore": "Explorar", | ||
| "tv": "Televisión" | ||
| }, | ||
| "categories": { | ||
| "trending_movies": "Películas de Tendencia", | ||
| "classics": "Clásicos", | ||
| "hip_and_modern": "Moderno y de moda" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| { | ||
| "drawer": { | ||
| "index": "Accueil", | ||
| "explore": "Explorer", | ||
| "tv": "Télévision" | ||
| }, | ||
| "categories": { | ||
| "trending_movies": "Films Tendance", | ||
| "classics": "Classiques", | ||
| "hip_and_modern": "À la mode et moderne" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,34 @@ | ||
| import i18next from 'i18next'; | ||
| import i18n from 'i18next'; | ||
| import { initReactI18next } from 'react-i18next'; | ||
| import LanguageDetector from 'i18next-browser-languagedetector'; | ||
|
|
||
| // Import translation files | ||
|
||
| import en from './en.json'; | ||
| import es from './es.json'; | ||
| import fr from './fr.json'; | ||
|
|
||
| i18next | ||
| .use(initReactI18next) | ||
| .use(LanguageDetector) | ||
| .init({ | ||
| compatibilityJSON: 'v3', // If you face any version-related warnings | ||
| resources: { | ||
| en: { | ||
| translation: en, | ||
| }, | ||
| es: { | ||
| translation: es, | ||
| }, | ||
| fr: { | ||
| translation: fr, | ||
| }, | ||
| }, | ||
| lng: 'en', // Default language | ||
|
||
| fallbackLng: 'en', // Fallback language in case of missing translations | ||
| interpolation: { | ||
| escapeValue: false, // React already escapes values, so this is safe | ||
| }, | ||
| }); | ||
|
|
||
| export default i18n; | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please commit the
package.jsonfor the i18 npm package.