File tree Expand file tree Collapse file tree 8 files changed +23
-32
lines changed Expand file tree Collapse file tree 8 files changed +23
-32
lines changed Original file line number Diff line number Diff line change 1
1
import i18n from 'i18next' ;
2
2
import { initReactI18next } from 'react-i18next' ;
3
3
4
- import jaResources from '../locale/ja/LC_MESSAGES/loris.json' ;
5
- import hiResources from '../locale/hi/LC_MESSAGES/loris.json' ;
6
- import esResources from '../locale/es/LC_MESSAGES/loris.json' ;
7
-
8
4
const resources = {
9
5
ja : {
10
- loris : jaResources ,
6
+ loris : require ( '../locale/ja/LC_MESSAGES/loris.json' ) ,
11
7
} ,
12
8
hi : {
13
- loris : hiResources ,
9
+ loris : require ( '../locale/hi/LC_MESSAGES/loris.json' ) ,
14
10
} ,
15
11
es : {
16
- loris : esResources ,
12
+ loris : require ( '../es/LC_MESSAGES/loris.json' ) ,
17
13
} ,
18
14
} ;
19
15
Original file line number Diff line number Diff line change @@ -12,9 +12,6 @@ import OpenProfileForm from './openProfileForm';
12
12
import i18n from 'I18nSetup' ;
13
13
import { withTranslation } from 'react-i18next' ;
14
14
15
- import jaStrings from '../locale/ja/LC_MESSAGES/candidate_list.json' ;
16
- import hiStrings from '../locale/hi/LC_MESSAGES/candidate_list.json' ;
17
-
18
15
/**
19
16
* Candidate List
20
17
*
@@ -407,8 +404,10 @@ CandidateListIndex.propTypes = {
407
404
408
405
window . addEventListener ( 'load' , ( ) => {
409
406
const args = QueryString . get ( ) ;
410
- i18n . addResourceBundle ( 'ja' , 'candidate_list' , jaStrings ) ;
411
- i18n . addResourceBundle ( 'hi' , 'candidate_list' , hiStrings ) ;
407
+ i18n . addResourceBundle (
408
+ 'ja' , 'candidate_list' , require ( '../locale/ja/LC_MESSAGES/candidate_list.json' ) ) ;
409
+ i18n . addResourceBundle ( 'hi' , 'candidate_list' , require ( '../locale/hi/LC_MESSAGES/candidate_list.json' ) ) ;
410
+
412
411
413
412
414
413
const CLIndex = withTranslation (
Original file line number Diff line number Diff line change @@ -13,9 +13,6 @@ import UploadFileForm from './uploadFileForm';
13
13
import AddPermissionForm from './addPermissionForm' ;
14
14
import ManagePermissionsForm from './managePermissionsForm' ;
15
15
16
- import hiStrings from '../locale/hi/LC_MESSAGES/data_release.json' ;
17
- import jaStrings from '../locale/ja/LC_MESSAGES/data_release.json' ;
18
-
19
16
/**
20
17
* Data Release
21
18
*
@@ -244,8 +241,10 @@ DataReleaseIndex.propTypes = {
244
241
} ;
245
242
246
243
window . addEventListener ( 'load' , ( ) => {
247
- i18n . addResourceBundle ( 'ja' , 'data_release' , jaStrings ) ;
248
- i18n . addResourceBundle ( 'hi' , 'data_release' , hiStrings ) ;
244
+ i18n . addResourceBundle ( 'ja' , 'data_release' , require ( '../locale/ja/LC_MESSAGES/data_release.json' ) ) ;
245
+ i18n . addResourceBundle ( 'hi' , 'data_release' , require ( '../locale/hi/LC_MESSAGES/data_release.json' ) ) ;
246
+
247
+
249
248
const Index = withTranslation (
250
249
[ 'data_release' , 'loris' ]
251
250
) ( DataReleaseIndex ) ;
Original file line number Diff line number Diff line change @@ -10,9 +10,6 @@ import FilterableDataTable from 'FilterableDataTable';
10
10
11
11
import fetchDataStream from 'jslib/fetchDataStream' ;
12
12
13
- import hiStrings from '../locale/hi/LC_MESSAGES/datadict.json' ;
14
- import jaStrings from '../locale/ja/LC_MESSAGES/datadict.json' ;
15
-
16
13
/**
17
14
* Data Dictionary Page.
18
15
*
@@ -239,8 +236,10 @@ DataDictIndex.propTypes = {
239
236
} ;
240
237
241
238
window . addEventListener ( 'load' , ( ) => {
242
- i18n . addResourceBundle ( 'hi' , 'datadict' , hiStrings ) ;
243
- i18n . addResourceBundle ( 'ja' , 'datadict' , jaStrings ) ;
239
+ i18n . addResourceBundle ( 'hi' , 'datadict' , require ( '../locale/hi/LC_MESSAGES/datadict.json' ) ) ;
240
+ i18n . addResourceBundle ( 'ja' , 'datadict' , require ( '../locale/ja/LC_MESSAGES/datadict.json' ) ) ;
241
+
242
+
244
243
const Index = withTranslation (
245
244
[ 'datadict' , 'loris' ]
246
245
) ( DataDictIndex ) ;
Original file line number Diff line number Diff line change @@ -9,9 +9,6 @@ import Loader from 'Loader';
9
9
import FilterableDataTable from 'FilterableDataTable' ;
10
10
import swal from 'sweetalert2' ;
11
11
12
- import hiStrings from '../locale/hi/LC_MESSAGES/dictionary.json' ;
13
- import jaStrings from '../locale/ja/LC_MESSAGES/dictionary.json' ;
14
-
15
12
/**
16
13
* Data Dictionary Page.
17
14
*
@@ -357,8 +354,9 @@ DataDictIndex.propTypes = {
357
354
} ;
358
355
359
356
window . addEventListener ( 'load' , ( ) => {
360
- i18n . addResourceBundle ( 'ja' , 'dictionary' , jaStrings ) ;
361
- i18n . addResourceBundle ( 'hi' , 'dictionary' , hiStrings ) ;
357
+ i18n . addResourceBundle ( 'ja' , 'dictionary' , require ( '../locale/ja/LC_MESSAGES/dictionary.json' ) ) ;
358
+ i18n . addResourceBundle ( 'hi' , 'dictionary' , require ( '../locale/hi/LC_MESSAGES/dictionary.json' ) ) ;
359
+
362
360
const Index = withTranslation (
363
361
[ 'dictionary' , 'loris' ]
364
362
) ( DataDictIndex ) ;
Original file line number Diff line number Diff line change @@ -12,7 +12,6 @@ import {useTranslation} from 'react-i18next';
12
12
import '../css/WidgetIndex.css' ;
13
13
14
14
import { setupCharts } from './widgets/helpers/chartBuilder' ;
15
- import jaStrings from '../locale/ja/LC_MESSAGES/statistics.json' ;
16
15
17
16
/**
18
17
* WidgetIndex - the main window.
@@ -26,7 +25,8 @@ const WidgetIndex = (props) => {
26
25
const [ modalChart , setModalChart ] = useState ( null ) ;
27
26
const { t, i18n} = useTranslation ( ) ;
28
27
useEffect ( ( ) => {
29
- i18n . addResourceBundle ( 'ja' , 'statistics' , jaStrings ) ;
28
+
29
+ i18n . addResourceBundle ( 'ja' , 'statistics' , require ( '../locale/ja/LC_MESSAGES/statistics.json' ) ) ;
30
30
} , [ ] ) ;
31
31
32
32
// used by recruitment.js and studyprogression.js to display each chart.
Original file line number Diff line number Diff line change @@ -6,7 +6,6 @@ import Panel from 'Panel';
6
6
import { QueryChartForm } from './helpers/queryChartForm' ;
7
7
import { setupCharts } from './helpers/chartBuilder' ;
8
8
import { useTranslation } from 'react-i18next' ;
9
- import jaStrings from '../../locale/ja/LC_MESSAGES/statistics.json' ;
10
9
11
10
/**
12
11
* StudyProgression - a widget containing statistics for study data.
@@ -21,7 +20,8 @@ const StudyProgression = (props) => {
21
20
const [ showFiltersRecruitment , setShowFiltersRecruitment ] = useState ( false ) ;
22
21
const [ activeView , setActiveView ] = useState ( 0 ) ;
23
22
useEffect ( ( ) => {
24
- i18n . addResourceBundle ( 'ja' , 'statistics' , jaStrings ) ;
23
+ i18n . addResourceBundle ( 'ja' , 'statistics' , require ( '../../locale/ja/LC_MESSAGES/statistics.json' ) ) ;
24
+
25
25
26
26
// Re-set default state that depended on the translation
27
27
let newdetails = { ...chartDetails } ;
Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ public function process(
78
78
$ loris = $ request ->getAttribute ("loris " );
79
79
$ lang = self ::detectLocale ($ loris , $ request );
80
80
if ($ lang !== null ) {
81
- \setlocale (LC_MESSAGES , $ lang . '.utf8 ' );
81
+ \setlocale (LC_ALL , $ lang . '.utf8 ' );
82
82
return $ this ->next ->process (
83
83
$ request ->withAttribute ("locale " , $ lang ),
84
84
$ handler
You can’t perform that action at this time.
0 commit comments