Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions jsx/I18nSetup.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import i18n from 'i18next';
import {initReactI18next} from 'react-i18next';

import jaResources from '../locale/ja/LC_MESSAGES/loris.json';
import hiResources from '../locale/hi/LC_MESSAGES/loris.json';
import esResources from '../locale/es/LC_MESSAGES/loris.json';

const resources = {
ja: {
loris: jaResources,
loris: require('../locale/ja/LC_MESSAGES/loris.json'),
},
hi: {
loris: hiResources,
loris: require('../locale/hi/LC_MESSAGES/loris.json'),
},
es: {
loris: esResources,
loris: require('../es/LC_MESSAGES/loris.json'),
},
};

Expand Down
9 changes: 4 additions & 5 deletions modules/candidate_list/jsx/candidateListIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ import OpenProfileForm from './openProfileForm';
import i18n from 'I18nSetup';
import {withTranslation} from 'react-i18next';

import jaStrings from '../locale/ja/LC_MESSAGES/candidate_list.json';
import hiStrings from '../locale/hi/LC_MESSAGES/candidate_list.json';

/**
* Candidate List
*
Expand Down Expand Up @@ -407,8 +404,10 @@ CandidateListIndex.propTypes = {

window.addEventListener('load', () => {
const args = QueryString.get();
i18n.addResourceBundle('ja', 'candidate_list', jaStrings);
i18n.addResourceBundle('hi', 'candidate_list', hiStrings);
i18n.addResourceBundle(
'ja', 'candidate_list', require('../locale/ja/LC_MESSAGES/candidate_list.json'));
i18n.addResourceBundle('hi', 'candidate_list', require('../locale/hi/LC_MESSAGES/candidate_list.json'));



const CLIndex = withTranslation(
Expand Down
9 changes: 4 additions & 5 deletions modules/data_release/jsx/dataReleaseIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ import UploadFileForm from './uploadFileForm';
import AddPermissionForm from './addPermissionForm';
import ManagePermissionsForm from './managePermissionsForm';

import hiStrings from '../locale/hi/LC_MESSAGES/data_release.json';
import jaStrings from '../locale/ja/LC_MESSAGES/data_release.json';

/**
* Data Release
*
Expand Down Expand Up @@ -244,8 +241,10 @@ DataReleaseIndex.propTypes = {
};

window.addEventListener('load', () => {
i18n.addResourceBundle('ja', 'data_release', jaStrings);
i18n.addResourceBundle('hi', 'data_release', hiStrings);
i18n.addResourceBundle('ja', 'data_release', require('../locale/ja/LC_MESSAGES/data_release.json'));
i18n.addResourceBundle('hi', 'data_release', require('../locale/hi/LC_MESSAGES/data_release.json'));


const Index = withTranslation(
['data_release', 'loris']
)(DataReleaseIndex);
Expand Down
9 changes: 4 additions & 5 deletions modules/datadict/jsx/dataDictIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import FilterableDataTable from 'FilterableDataTable';

import fetchDataStream from 'jslib/fetchDataStream';

import hiStrings from '../locale/hi/LC_MESSAGES/datadict.json';
import jaStrings from '../locale/ja/LC_MESSAGES/datadict.json';

/**
* Data Dictionary Page.
*
Expand Down Expand Up @@ -239,8 +236,10 @@ DataDictIndex.propTypes = {
};

window.addEventListener('load', () => {
i18n.addResourceBundle('hi', 'datadict', hiStrings);
i18n.addResourceBundle('ja', 'datadict', jaStrings);
i18n.addResourceBundle('hi', 'datadict', require('../locale/hi/LC_MESSAGES/datadict.json'));
i18n.addResourceBundle('ja', 'datadict', require('../locale/ja/LC_MESSAGES/datadict.json'));


const Index = withTranslation(
['datadict', 'loris']
)(DataDictIndex);
Expand Down
8 changes: 3 additions & 5 deletions modules/dictionary/jsx/dataDictIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ import Loader from 'Loader';
import FilterableDataTable from 'FilterableDataTable';
import swal from 'sweetalert2';

import hiStrings from '../locale/hi/LC_MESSAGES/dictionary.json';
import jaStrings from '../locale/ja/LC_MESSAGES/dictionary.json';

/**
* Data Dictionary Page.
*
Expand Down Expand Up @@ -357,8 +354,9 @@ DataDictIndex.propTypes = {
};

window.addEventListener('load', () => {
i18n.addResourceBundle('ja', 'dictionary', jaStrings);
i18n.addResourceBundle('hi', 'dictionary', hiStrings);
i18n.addResourceBundle('ja', 'dictionary', require('../locale/ja/LC_MESSAGES/dictionary.json'));
i18n.addResourceBundle('hi', 'dictionary', require('../locale/hi/LC_MESSAGES/dictionary.json'));

const Index = withTranslation(
['dictionary', 'loris']
)(DataDictIndex);
Expand Down
4 changes: 2 additions & 2 deletions modules/statistics/jsx/WidgetIndex.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {useTranslation} from 'react-i18next';
import '../css/WidgetIndex.css';

import {setupCharts} from './widgets/helpers/chartBuilder';
import jaStrings from '../locale/ja/LC_MESSAGES/statistics.json';

/**
* WidgetIndex - the main window.
Expand All @@ -26,7 +25,8 @@ const WidgetIndex = (props) => {
const [modalChart, setModalChart] = useState(null);
const {t, i18n} = useTranslation();
useEffect( () => {
i18n.addResourceBundle('ja', 'statistics', jaStrings);

i18n.addResourceBundle('ja', 'statistics', require('../locale/ja/LC_MESSAGES/statistics.json'));
}, []);

// used by recruitment.js and studyprogression.js to display each chart.
Expand Down
4 changes: 2 additions & 2 deletions modules/statistics/jsx/widgets/studyprogression.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import Panel from 'Panel';
import {QueryChartForm} from './helpers/queryChartForm';
import {setupCharts} from './helpers/chartBuilder';
import {useTranslation} from 'react-i18next';
import jaStrings from '../../locale/ja/LC_MESSAGES/statistics.json';

/**
* StudyProgression - a widget containing statistics for study data.
Expand All @@ -21,7 +20,8 @@ const StudyProgression = (props) => {
const [showFiltersRecruitment, setShowFiltersRecruitment] = useState(false);
const [activeView, setActiveView] = useState(0);
useEffect( () => {
i18n.addResourceBundle('ja', 'statistics', jaStrings);
i18n.addResourceBundle('ja', 'statistics', require('../../locale/ja/LC_MESSAGES/statistics.json'));


// Re-set default state that depended on the translation
let newdetails = {...chartDetails};
Expand Down
2 changes: 1 addition & 1 deletion src/Middleware/Language.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function process(
$loris = $request->getAttribute("loris");
$lang = self::detectLocale($loris, $request);
if ($lang !== null) {
\setlocale(LC_MESSAGES, $lang . '.utf8');
\setlocale(LC_ALL, $lang . '.utf8');
return $this->next->process(
$request->withAttribute("locale", $lang),
$handler
Expand Down
Loading