mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-06-27 17:41:20 +00:00
Translate app
This commit is contained in:
parent
daa8a9145b
commit
7df70b2165
@ -1,4 +1,4 @@
|
|||||||
import React, { useEffect, useMemo, useState } from 'react';
|
import { forwardRef, useEffect, useMemo, useState } from 'react';
|
||||||
import { Box } from '@mui/material';
|
import { Box } from '@mui/material';
|
||||||
import { getBaseApiReact } from '../../App';
|
import { getBaseApiReact } from '../../App';
|
||||||
import { subscribeToEvent, unsubscribeFromEvent } from '../../utils/events';
|
import { subscribeToEvent, unsubscribeFromEvent } from '../../utils/events';
|
||||||
@ -7,7 +7,7 @@ import { useQortalMessageListener } from './useQortalMessageListener';
|
|||||||
import { useThemeContext } from '../Theme/ThemeContext';
|
import { useThemeContext } from '../Theme/ThemeContext';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
export const AppViewer = React.forwardRef(
|
export const AppViewer = forwardRef(
|
||||||
({ app, hide, isDevMode, skipAuth }, iframeRef) => {
|
({ app, hide, isDevMode, skipAuth }, iframeRef) => {
|
||||||
// const iframeRef = useRef(null);
|
// const iframeRef = useRef(null);
|
||||||
const { window: frameWindow } = useFrame();
|
const { window: frameWindow } = useFrame();
|
||||||
@ -23,7 +23,7 @@ export const AppViewer = React.forwardRef(
|
|||||||
);
|
);
|
||||||
const [url, setUrl] = useState('');
|
const [url, setUrl] = useState('');
|
||||||
const { themeMode } = useThemeContext();
|
const { themeMode } = useThemeContext();
|
||||||
const { i18n } = useTranslation(['core']);
|
const { i18n, t } = useTranslation(['core']);
|
||||||
const currentLang = i18n.language;
|
const currentLang = i18n.language;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@ -184,7 +184,13 @@ export const AppViewer = React.forwardRef(
|
|||||||
// Timeout after 200ms if no response
|
// Timeout after 200ms if no response
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
window.removeEventListener('message', handleNavigationSuccess);
|
window.removeEventListener('message', handleNavigationSuccess);
|
||||||
reject(new Error('Navigation timeout'));
|
reject(
|
||||||
|
new Error(
|
||||||
|
t('core:message.error.navigation_timeout', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
)
|
||||||
|
);
|
||||||
}, 200);
|
}, 200);
|
||||||
const targetOrigin = iframeRef.current
|
const targetOrigin = iframeRef.current
|
||||||
? new URL(iframeRef.current.src).origin
|
? new URL(iframeRef.current.src).origin
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
import React, { useContext } from 'react';
|
import { forwardRef } from 'react';
|
||||||
import { AppViewer } from './AppViewer';
|
import { AppViewer } from './AppViewer';
|
||||||
import Frame from 'react-frame-component';
|
import Frame from 'react-frame-component';
|
||||||
import { MyContext } from '../../App';
|
|
||||||
|
|
||||||
const AppViewerContainer = React.forwardRef(
|
const AppViewerContainer = forwardRef(
|
||||||
({ app, isSelected, hide, isDevMode, customHeight, skipAuth }, ref) => {
|
({ app, isSelected, hide, isDevMode, customHeight, skipAuth }, ref) => {
|
||||||
return (
|
return (
|
||||||
<Frame
|
<Frame
|
||||||
|
@ -117,6 +117,7 @@
|
|||||||
"minting_account_add": "unable to add minting account",
|
"minting_account_add": "unable to add minting account",
|
||||||
"minting_account_remove": "unable to remove minting account",
|
"minting_account_remove": "unable to remove minting account",
|
||||||
"missing_fields": "missing: {{ fields }}",
|
"missing_fields": "missing: {{ fields }}",
|
||||||
|
"navigation_timeout": "navigation timeout",
|
||||||
"publish_app": "unable to publish app",
|
"publish_app": "unable to publish app",
|
||||||
"rating_option": "cannot find rating option",
|
"rating_option": "cannot find rating option",
|
||||||
"save_qdn": "unable to save to QDN",
|
"save_qdn": "unable to save to QDN",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user