- added i18n internationalization;
This commit is contained in:
15
src/App.js
15
src/App.js
@@ -1,21 +1,20 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import { useEffect } from 'react';
|
||||
import { BrowserRouter } from 'react-router-dom';
|
||||
import Routes from './routes';
|
||||
import { createI18n, setLocaleData } from '@wordpress/i18n';
|
||||
import { I18nProvider } from '@wordpress/react-i18n';
|
||||
|
||||
const i18n = createI18n();
|
||||
const i18n = createI18n({}, 'gepafin');
|
||||
|
||||
function App() {
|
||||
const [messages, setMessages] = useState({});
|
||||
|
||||
console.log('mount')
|
||||
useEffect(() => {
|
||||
/*import('../languages/en_US.json').then((translations) => {
|
||||
setLocaleData(translations, 'gepafin');
|
||||
});*/
|
||||
fetch('/languages/en_US.json')
|
||||
.then((res) => res.json())
|
||||
.then(res => console.log(res))
|
||||
.then(res => {
|
||||
console.log('loaded')
|
||||
setLocaleData(res.locale_data['gepafin'], 'gepafin')
|
||||
})
|
||||
}, []);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user