|
@@ -1,11 +1,11 @@
|
|
|
import React, { useCallback } from 'react';
|
|
import React, { useCallback } from 'react';
|
|
|
|
|
|
|
|
|
|
+import { useTranslation, i18n } from 'next-i18next';
|
|
|
import PropTypes from 'prop-types';
|
|
import PropTypes from 'prop-types';
|
|
|
-import { useTranslation } from 'next-i18next';
|
|
|
|
|
|
|
|
|
|
import AdminAppContainer from '~/client/services/AdminAppContainer';
|
|
import AdminAppContainer from '~/client/services/AdminAppContainer';
|
|
|
import { toastSuccess, toastError } from '~/client/util/apiNotification';
|
|
import { toastSuccess, toastError } from '~/client/util/apiNotification';
|
|
|
-import { localeMetadatas } from '~/client/util/i18n';
|
|
|
|
|
|
|
+import { i18n as i18nConfig } from '~/next-i18next.config';
|
|
|
import loggerFactory from '~/utils/logger';
|
|
import loggerFactory from '~/utils/logger';
|
|
|
|
|
|
|
|
|
|
|
|
@@ -77,22 +77,27 @@ const AppSetting = (props) => {
|
|
|
</label>
|
|
</label>
|
|
|
<div className="col-md-6 py-2">
|
|
<div className="col-md-6 py-2">
|
|
|
{
|
|
{
|
|
|
- localeMetadatas.map(meta => (
|
|
|
|
|
- <div key={meta.id} className="custom-control custom-radio custom-control-inline">
|
|
|
|
|
- <input
|
|
|
|
|
- type="radio"
|
|
|
|
|
- id={`radioLang${meta.id}`}
|
|
|
|
|
- className="custom-control-input"
|
|
|
|
|
- name="globalLang"
|
|
|
|
|
- value={meta.id}
|
|
|
|
|
- checked={adminAppContainer.state.globalLang === meta.id}
|
|
|
|
|
- onChange={(e) => {
|
|
|
|
|
- adminAppContainer.changeGlobalLang(e.target.value);
|
|
|
|
|
- }}
|
|
|
|
|
- />
|
|
|
|
|
- <label className="custom-control-label" htmlFor={`radioLang${meta.id}`}>{meta.displayName}</label>
|
|
|
|
|
- </div>
|
|
|
|
|
- ))
|
|
|
|
|
|
|
+ i18nConfig.locales.map((locale) => {
|
|
|
|
|
+ const fixedT = i18n.getFixedT(locale);
|
|
|
|
|
+ i18n.loadLanguages(i18nConfig.locales);
|
|
|
|
|
+
|
|
|
|
|
+ return (
|
|
|
|
|
+ <div key={locale} className="custom-control custom-radio custom-control-inline">
|
|
|
|
|
+ <input
|
|
|
|
|
+ type="radio"
|
|
|
|
|
+ id={`radioLang${locale}`}
|
|
|
|
|
+ className="custom-control-input"
|
|
|
|
|
+ name="globalLang"
|
|
|
|
|
+ value={locale}
|
|
|
|
|
+ checked={adminAppContainer.state.globalLang === locale}
|
|
|
|
|
+ onChange={(e) => {
|
|
|
|
|
+ adminAppContainer.changeGlobalLang(e.target.value);
|
|
|
|
|
+ }}
|
|
|
|
|
+ />
|
|
|
|
|
+ <label className="custom-control-label" htmlFor={`radioLang${locale}`}>{fixedT('meta.display_name')}</label>
|
|
|
|
|
+ </div>
|
|
|
|
|
+ );
|
|
|
|
|
+ })
|
|
|
}
|
|
}
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|