-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:CyberAula/cyberaula.github.io
- Loading branch information
Showing
9 changed files
with
3,304 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import i18n from 'i18next'; | ||
import { initReactI18next } from 'react-i18next'; | ||
import LanguageDetector from 'i18next-browser-languagedetector'; | ||
import { en } from '../constants/langs/en'; | ||
import { es } from '../constants/langs/es'; | ||
|
||
i18n | ||
// detect user language | ||
// learn more: https://github.com/i18next/i18next-browser-languageDetector | ||
.use(LanguageDetector) | ||
// pass the i18n instance to react-i18next. | ||
.use(initReactI18next) | ||
// init i18next | ||
// for all options read: https://www.i18next.com/overview/configuration-options | ||
.init({ | ||
debug: true, | ||
fallbackLng: 'en', | ||
interpolation: { | ||
escapeValue: false, // not needed for react as it escapes by default | ||
}, | ||
resources: {}}); | ||
|
||
i18n.addResourceBundle('en', 'translation', { | ||
...en | ||
}); | ||
i18n.addResourceBundle('es', 'translation', { | ||
...es | ||
}); | ||
|
||
|
||
|
||
export default i18n; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
|
||
const lngs = { | ||
en: { nativeName: 'English' }, | ||
es: { nativeName: 'Spanish' } | ||
}; | ||
|
||
|
||
export default function LangSwitcher() { | ||
const { i18n } = useTranslation(); | ||
return ( | ||
<div> | ||
{Object.keys(lngs).map((lng) => ( | ||
<button | ||
key={lng} | ||
style={{ | ||
fontWeight: i18n.language === lng ? 'bold' : 'normal', | ||
}} | ||
type="submit" | ||
onClick={() => i18n.changeLanguage(lng)} | ||
> | ||
{lngs[lng].nativeName} | ||
</button> | ||
))} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export const en = { | ||
"header": { | ||
"publicationstab": "Publications" | ||
}, | ||
"front": { | ||
"title": "Welcome to CyberAula", | ||
"title2": "innovation group of the UPM" | ||
}, | ||
"publications": { | ||
"title": "Publications" | ||
}, | ||
"cursos": { | ||
"title": "Courses" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
export const es = { | ||
"header": { | ||
"publicationstab": "Publicaciones" | ||
}, | ||
"front": { | ||
"title": "Bienvenido a CyberAula", | ||
"title2": "grupo de innovación educativa de la UPM" | ||
}, | ||
"publications": { | ||
"title": "Publicaciones" | ||
}, | ||
"cursos": { | ||
"title": "Cursos" | ||
} | ||
} |
Oops, something went wrong.