Fixed: Translating static strings

This commit is contained in:
Mark McDowall 2023-07-15 09:24:24 -07:00
parent c1f8c7b17b
commit ef6ff370ba
2 changed files with 12 additions and 11 deletions

View File

@ -11,8 +11,15 @@ function getTranslations() {
let translations = {}; let translations = {};
export function fetchTranslations() { export function fetchTranslations() {
return getTranslations().then((data) => { return new Promise(async(resolve) => {
try {
const data = await getTranslations();
translations = data.strings; translations = data.strings;
resolve(true);
} catch (error) {
resolve(false);
}
}); });
} }

View File

@ -3,8 +3,8 @@ import React from 'react';
import { render } from 'react-dom'; import { render } from 'react-dom';
import createAppStore from 'Store/createAppStore'; import createAppStore from 'Store/createAppStore';
import { fetchTranslations } from 'Utilities/String/translate'; import { fetchTranslations } from 'Utilities/String/translate';
import App from './App/App';
// import App from './App/App';
import './preload'; import './preload';
import './polyfills'; import './polyfills';
import 'Diag/ConsoleApi'; import 'Diag/ConsoleApi';
@ -13,14 +13,8 @@ import './index.css';
const history = createBrowserHistory(); const history = createBrowserHistory();
const store = createAppStore(history); const store = createAppStore(history);
let hasTranslationsError = false; const hasTranslationsError = !await fetchTranslations();
const { default: App } = await import('./App/App');
try {
await fetchTranslations();
} catch (error) {
hasTranslationsError = true;
}
render( render(
<App <App