i18n - Multiple languages overrides
This commit is contained in:
1 parent
1874f93bcc
commit
236a115112
33 files changed
+1401
-695
No files matched your search
+4
-4
@@ -109,8 +109,8 @@ class App extends Component {
|
||||
|
||||
if (userManager) {
|
||||
return (
|
||||
<I18nextProvider i18n={i18n}>
|
||||
<Provider store={store}>
|
||||
<Provider store={store}>
|
||||
<I18nextProvider i18n={i18n}>
|
||||
<OidcProvider store={store} userManager={userManager}>
|
||||
<Router basename={this.props.routerBasename}>
|
||||
<WhiteLabellingContext.Provider
|
||||
@@ -120,8 +120,8 @@ class App extends Component {
|
||||
</WhiteLabellingContext.Provider>
|
||||
</Router>
|
||||
</OidcProvider>
|
||||
</Provider>
|
||||
</I18nextProvider>
|
||||
</I18nextProvider>
|
||||
</Provider>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
|
||||
import { Link, withRouter } from 'react-router-dom';
|
||||
import { Dropdown } from 'react-viewerbase';
|
||||
import { withTranslation } from 'react-i18next';
|
||||
import i18n, { t } from 'ohif-i18n';
|
||||
import './Header.css';
|
||||
import OHIFLogo from '../OHIFLogo/OHIFLogo.js';
|
||||
import ConnectedUserPreferencesModal from '../../connectedComponents/ConnectedUserPreferencesModal.js';
|
||||
@@ -12,9 +13,7 @@ class Header extends Component {
|
||||
home: PropTypes.bool.isRequired,
|
||||
location: PropTypes.object.isRequired,
|
||||
openUserPreferencesModal: PropTypes.func,
|
||||
children: PropTypes.node,
|
||||
t: PropTypes.func,
|
||||
i18n: PropTypes.object,
|
||||
children: PropTypes.node
|
||||
};
|
||||
|
||||
static defaultProps = {
|
||||
@@ -33,7 +32,6 @@ class Header extends Component {
|
||||
}
|
||||
|
||||
loadOptions() {
|
||||
const { t } = this.props;
|
||||
this.options = [
|
||||
{
|
||||
title: t('preferences'),
|
||||
@@ -49,15 +47,14 @@ class Header extends Component {
|
||||
}
|
||||
|
||||
changeLanguage(language) {
|
||||
const { i18n } = this.props;
|
||||
i18n.init({
|
||||
fallbackLng: language.substring(0, 2),
|
||||
lng: language
|
||||
});
|
||||
this.loadOptions();
|
||||
}
|
||||
|
||||
render() {
|
||||
const { t } = this.props;
|
||||
return (
|
||||
<div className={`entry-header ${this.props.home ? 'header-big' : ''}`}>
|
||||
<div className="header-left-box">
|
||||
|
||||
+1
-78
@@ -1,80 +1,3 @@
|
||||
import i18n from 'i18next';
|
||||
import { initReactI18next } from 'react-i18next';
|
||||
|
||||
const currentLanguage = process.env.APP_LANG || 'es-MX';
|
||||
|
||||
/*function getDefaultLanguage() {
|
||||
const mainLanguage = currentLanguage.match(/(.*.)(-)/);
|
||||
return mainLanguage !== null ? mainLanguage[1] : null;
|
||||
}*/
|
||||
|
||||
function getNameSpaceString(key) {
|
||||
const nameSpaceMatcher = key.match(/[^/]+$/g);
|
||||
let finalNameSpace;
|
||||
|
||||
if (nameSpaceMatcher !== null) {
|
||||
finalNameSpace = nameSpaceMatcher[0].replace('.json', '');
|
||||
}
|
||||
|
||||
return finalNameSpace;
|
||||
}
|
||||
|
||||
function getCleanKeyForNameSpaces(key) {
|
||||
const cleanedKey = key.match(/[/\\].+(?=[/\\])/);
|
||||
let finalKey;
|
||||
|
||||
if (cleanedKey !== null) {
|
||||
finalKey = cleanedKey[0].replace(/[/\\]/, '');
|
||||
finalKey = finalKey.replace(/[/\\]/, '-');
|
||||
}
|
||||
|
||||
return finalKey;
|
||||
}
|
||||
|
||||
function getLocales() {
|
||||
const context = require.context(`./locales`, true, /\.json$/);
|
||||
const locales = {};
|
||||
|
||||
context.keys().forEach(key => {
|
||||
locales[getCleanKeyForNameSpaces(key)] = {
|
||||
...locales[getCleanKeyForNameSpaces(key)],
|
||||
[getNameSpaceString(key)]: context(key),
|
||||
};
|
||||
});
|
||||
|
||||
return locales;
|
||||
}
|
||||
|
||||
i18n.use(initReactI18next).init({
|
||||
resources: getLocales(),
|
||||
// fallbackLng: getDefaultLanguage(),
|
||||
fallbackLng:{
|
||||
'es-MX': ['es'],
|
||||
'default': ['en']
|
||||
},
|
||||
|
||||
/*fallbackLng: {
|
||||
'de-CH': ['fr', 'it'],
|
||||
'zh-Hant': ['zh-Hans', 'en'],
|
||||
'es': ['fr'],
|
||||
'default': ['en']
|
||||
},*/
|
||||
|
||||
lng: currentLanguage,
|
||||
debug: true,
|
||||
|
||||
// have a common namespace used around the full app
|
||||
keySeparator: false, // uses content as keys
|
||||
interpolation: {
|
||||
escapeValue: false,
|
||||
},
|
||||
|
||||
fallbackNS: ['Header'],
|
||||
defaultNS: 'common',
|
||||
|
||||
react: {
|
||||
wait: true,
|
||||
},
|
||||
});
|
||||
import i18n from 'ohif-i18n';
|
||||
|
||||
export default i18n;
|
||||
@@ -1,39 +0,0 @@
|
||||
{
|
||||
"Themes": "Themes",
|
||||
"Previous": "Previous",
|
||||
"Next": "Next",
|
||||
"Play": "Play",
|
||||
"Stop": "Stop",
|
||||
"Layout": "Layout",
|
||||
"More": "More",
|
||||
"Crosshairs": "Crosshairs",
|
||||
"Magnify": "Magnify",
|
||||
"ROI Window": "ROI Window",
|
||||
"Probe": "Probe",
|
||||
"Ellipse": "Ellipse",
|
||||
"Rectangle": "Rectangle",
|
||||
"Invert": "Invert",
|
||||
"Rotate Right": "Rotate Right",
|
||||
"Flip H": "Flip H",
|
||||
"Flip V": "Flip V",
|
||||
"Clear": "Clear",
|
||||
"Brush": "Brush",
|
||||
"Coronal": "Coronal",
|
||||
"Stack Scroll": "Stack Scroll",
|
||||
"Measurements": "Measurements",
|
||||
"Zoom": "Zoom",
|
||||
"Levels": "Levels",
|
||||
"Pan": "Pan",
|
||||
"Length": "Length",
|
||||
"Angle": "Angle",
|
||||
"Bidirectional": "Bidirectional",
|
||||
"Freehand": "Freehand",
|
||||
"EllipticalRoi": "EllipticalRoi",
|
||||
"CircleRoi": "CircleRoi",
|
||||
"RectangleRoi": "RectangleRoi",
|
||||
"Reset": "Reset",
|
||||
"CINE": "CINE",
|
||||
"Acquired": "Acquired",
|
||||
"Sagittal": "Sagittal",
|
||||
"Axial": "Axial"
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"fps": "ingles fps",
|
||||
"Skip to first image": "Skip to first image",
|
||||
"Previous image": "Previous, image",
|
||||
"Play / Stop": "Play, / Stop",
|
||||
"Next image": "Next, image",
|
||||
"Skip to last image": "Skip, to last image",
|
||||
"Skip to first image": "Skip, to first image",
|
||||
"Previous image": "Previous, image",
|
||||
"Play / Stop": "Play, / Stop",
|
||||
"Next image": "Next, image",
|
||||
"Skip to last image": "Skip, to last image",
|
||||
"Skip to first image": "Skip, to first image",
|
||||
"Previous image": "Previous, image",
|
||||
"Play / Stop": "Play, / Stop",
|
||||
"Next image": "Next, image",
|
||||
"Skip to last image": "Skip, to last image"
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"preferences": "Preferences",
|
||||
"options": "Options",
|
||||
"about": "About",
|
||||
"back_to_viewer": "Back to Viewer",
|
||||
"study_list": "Study list",
|
||||
"research_use": "INVESTIGATIONAL USE ONLY"
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"header_research_use": "INVESTIGATIONAL PURPOSES ONLY"
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"options": "Options",
|
||||
"about": "About"
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
{
|
||||
"Welcome to React": "Welcome to React and react-i18next",
|
||||
"welcomeMsg": "welcome",
|
||||
"test": "Lunch time"
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"research_use": "SOLO USO DE DESAROLLO"
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
{
|
||||
"Themes": "Temas",
|
||||
"Previous": "Anterior",
|
||||
"Next": "Próximo",
|
||||
"Play": "Play",
|
||||
"Stop": "Stop",
|
||||
"Layout": "Esquema",
|
||||
"More": "Más",
|
||||
"Crosshairs": "Cruces",
|
||||
"Magnify": "Lupa",
|
||||
"ROI Window": "Ventana ROI",
|
||||
"Probe": "Probar",
|
||||
"Ellipse": "Elipse",
|
||||
"Rectangle": "Rectángulo",
|
||||
"Invert": "Invertido",
|
||||
"Rotate Right": "Rotar ->",
|
||||
"Flip H": "Espejo Hor.",
|
||||
"Flip V": "Espejo Ver.",
|
||||
"Clear": "Limpiar",
|
||||
"Brush": "Escoba",
|
||||
"Coronal": "Coronal",
|
||||
"Stack Scroll": "Avance X slice",
|
||||
"Measurements": "Medidas",
|
||||
"Zoom": "Zoom",
|
||||
"Levels": "Niveles",
|
||||
"Pan": "Mover",
|
||||
"Length": "Medición",
|
||||
"Angle": "Ángulo",
|
||||
"Bidirectional": "Bidirectional",
|
||||
"Freehand": "Freehand",
|
||||
"EllipticalRoi": "EllipticalRoi",
|
||||
"CircleRoi": "CircleRoi",
|
||||
"RectangleRoi": "RectangleRoi",
|
||||
"Reset": "Reiniciar",
|
||||
"CINE": "CINE",
|
||||
"Acquired": "Acquired",
|
||||
"Sagittal": "Sagittal",
|
||||
"Axial": "Axial"
|
||||
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"fps": "fps",
|
||||
"Skip to first image": "Avanza para la primera imagen",
|
||||
"Previous image": "Imagen anterior",
|
||||
"Play / Stop": "Play / Stop",
|
||||
"Next image": "Próximo image",
|
||||
"Skip to last image": "Pular para la ultima imagen"
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
{
|
||||
"research_use": "SOLO USO DE INVESTIGACIÓN",
|
||||
"options": "Opciones",
|
||||
"about": "Sobre",
|
||||
"preferences": "Preferencias",
|
||||
"study_list": "Lista de estudio"
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"Opciones": "Elecciones"
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"Themes": "Temas",
|
||||
"Previous": "Anterior",
|
||||
"Next": "Próximo",
|
||||
"Play": "Play",
|
||||
"Stop": "Stop",
|
||||
"Layout": "Esquema",
|
||||
"More": "Más",
|
||||
"Crosshairs": "Cruces",
|
||||
"Magnify": "Lupa",
|
||||
"ROI Window": "Ventana ROI",
|
||||
"Probe": "Probar",
|
||||
"Ellipse": "Elipse",
|
||||
"Rectangle": "Rectángulo",
|
||||
"Invert": "Invertido",
|
||||
"Rotate Right": "Rotar ->",
|
||||
"Flip H": "Espejo Hor.",
|
||||
"Flip V": "Espejo Ver.",
|
||||
"Clear": "Limpiar",
|
||||
"Brush": "Escoba"
|
||||
}
|
||||
Reference in new issue
Block a user