Skip to content

Commit

Permalink
Marked files for translation (actualbudget#3430)
Browse files Browse the repository at this point in the history
  • Loading branch information
a-gradina authored Sep 14, 2024
1 parent 183c4b2 commit c5193b6
Show file tree
Hide file tree
Showing 6 changed files with 185 additions and 116 deletions.
121 changes: 74 additions & 47 deletions packages/desktop-client/src/components/FatalError.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useState, type ReactNode } from 'react';
import { useTranslation, Trans } from 'react-i18next';

import { LazyLoadFailedError } from 'loot-core/src/shared/errors';

Expand Down Expand Up @@ -32,10 +33,12 @@ function RenderSimple({ error }: RenderSimpleProps) {
// IndexedDB wasn't able to open the database
msg = (
<Text>
Your browser doesn’t support IndexedDB in this environment, a feature
that Actual requires to run. This might happen if you are in private
browsing mode. Please try a different browser or turn off private
browsing.
<Trans>
Your browser doesn’t support IndexedDB in this environment, a feature
that Actual requires to run. This might happen if you are in private
browsing mode. Please try a different browser or turn off private
browsing.
</Trans>
</Text>
);
} else if (
Expand All @@ -45,26 +48,32 @@ function RenderSimple({ error }: RenderSimpleProps) {
// SharedArrayBuffer isn't available
msg = (
<Text>
Actual requires access to <code>SharedArrayBuffer</code> in order to
function properly. If you’re seeing this error, either your browser does
not support <code>SharedArrayBuffer</code>, or your server is not
sending the appropriate headers, or you are not using HTTPS. See{' '}
<Link
variant="external"
linkColor="muted"
to="https://actualbudget.org/docs/troubleshooting/shared-array-buffer"
>
our troubleshooting documentation
</Link>{' '}
to learn more. <SharedArrayBufferOverride />
<Trans>
Actual requires access to <code>SharedArrayBuffer</code> in order to
function properly. If you’re seeing this error, either your browser
does not support <code>SharedArrayBuffer</code>, or your server is not
sending the appropriate headers, or you are not using HTTPS. See{' '}
<Link
variant="external"
linkColor="muted"
to="https://actualbudget.org/docs/troubleshooting/shared-array-buffer"
>
our troubleshooting documentation
</Link>{' '}
to learn more. <SharedArrayBufferOverride />
</Trans>
</Text>
);
} else {
// This indicates the backend failed to initialize. Show the
// user something at least so they aren't looking at a blank
// screen
msg = (
<Text>There was a problem loading the app in this browser version.</Text>
<Text>
<Trans>
There was a problem loading the app in this browser version.
</Trans>
</Text>
);
}

Expand All @@ -78,15 +87,17 @@ function RenderSimple({ error }: RenderSimpleProps) {
>
<Text>{msg}</Text>
<Text>
Please get{' '}
<Link
variant="external"
linkColor="muted"
to="https://actualbudget.org/contact"
>
in touch
</Link>{' '}
for support
<Trans>
Please get{' '}
<Link
variant="external"
linkColor="muted"
to="https://actualbudget.org/contact"
>
in touch
</Link>{' '}
for support
</Trans>
</Text>
</Stack>
);
Expand All @@ -102,10 +113,12 @@ function RenderLazyLoadError() {
}}
>
<Text>
There was a problem loading one of the chunks of the application. Please
reload the page and try again. If the issue persists - there might be an
issue with either your internet connection and/or the server where the
app is hosted.
<Trans>
There was a problem loading one of the chunks of the application.
Please reload the page and try again. If the issue persists - there
might be an issue with either your internet connection and/or the
server where the app is hosted.
</Trans>
</Text>
</Stack>
);
Expand All @@ -114,13 +127,17 @@ function RenderLazyLoadError() {
function RenderUIError() {
return (
<>
<Paragraph>There was an unrecoverable error in the UI. Sorry!</Paragraph>
<Paragraph>
If this error persists, please get{' '}
<Link variant="external" to="https://actualbudget.org/contact">
in touch
</Link>{' '}
so it can be investigated.
<Trans>There was an unrecoverable error in the UI. Sorry!</Trans>
</Paragraph>
<Paragraph>
<Trans>
If this error persists, please get{' '}
<Link variant="external" to="https://actualbudget.org/contact">
in touch
</Link>{' '}
so it can be investigated.
</Trans>
</Paragraph>
</>
);
Expand All @@ -133,11 +150,13 @@ function SharedArrayBufferOverride() {
return expanded ? (
<>
<Paragraph style={{ marginTop: 10 }}>
Actual uses <code>SharedArrayBuffer</code> to allow usage from multiple
tabs at once and to ensure correct behavior when switching files. While
it can run without access to <code>SharedArrayBuffer</code>, you may
encounter data loss or notice multiple budget files being merged with
each other.
<Trans>
Actual uses <code>SharedArrayBuffer</code> to allow usage from
multiple tabs at once and to ensure correct behavior when switching
files. While it can run without access to
<code>SharedArrayBuffer</code>, you may encounter data loss or notice
multiple budget files being merged with each other.
</Trans>
</Paragraph>
<label
style={{ display: 'flex', alignItems: 'center', marginBottom: 10 }}
Expand All @@ -146,7 +165,9 @@ function SharedArrayBufferOverride() {
checked={understand}
onChange={() => setUnderstand(!understand)}
/>{' '}
I understand the risks, run Actual in the unsupported fallback mode
<Trans>
I understand the risks, run Actual in the unsupported fallback mode
</Trans>
</label>
<Button
isDisabled={!understand}
Expand All @@ -155,7 +176,7 @@ function SharedArrayBufferOverride() {
window.location.reload();
}}
>
Open Actual
<Trans>Open Actual</Trans>
</Button>
</>
) : (
Expand All @@ -164,20 +185,24 @@ function SharedArrayBufferOverride() {
onClick={() => setExpanded(true)}
style={{ marginLeft: 5 }}
>
Advanced options
<Trans>Advanced options</Trans>
</Link>
);
}

export function FatalError({ error }: FatalErrorProps) {
const { t } = useTranslation();

const [showError, setShowError] = useState(false);

const showSimpleRender = 'type' in error && error.type === 'app-init-failure';
const isLazyLoadError = error instanceof LazyLoadFailedError;

return (
<Modal name="fatal-error" isDismissable={false}>
<ModalHeader title={isLazyLoadError ? 'Loading Error' : 'Fatal Error'} />
<ModalHeader
title={isLazyLoadError ? t('Loading Error') : t('Fatal Error')}
/>
<View
style={{
maxWidth: 500,
Expand All @@ -192,11 +217,13 @@ export function FatalError({ error }: FatalErrorProps) {
)}

<Paragraph>
<Button onPress={() => window.Actual?.relaunch()}>Restart app</Button>
<Button onPress={() => window.Actual?.relaunch()}>
<Trans>Restart app</Trans>
</Button>
</Paragraph>
<Paragraph isLast={true} style={{ fontSize: 11 }}>
<Link variant="text" onClick={() => setShowError(state => !state)}>
Show Error
<Trans>Show Error</Trans>
</Link>
{showError && (
<Block
Expand Down
19 changes: 12 additions & 7 deletions packages/desktop-client/src/components/LoggedInUser.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @ts-strict-ignore
import React, { useState, useEffect, useRef } from 'react';
import { Trans, useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';

import { type State } from 'loot-core/src/client/state-types';
Expand All @@ -24,6 +25,8 @@ export function LoggedInUser({
style,
color,
}: LoggedInUserProps) {
const { t } = useTranslation();

const userData = useSelector((state: State) => state.user.data);
const { getUserData, signOut, closeBudget } = useActions();
const [loading, setLoading] = useState(true);
Expand Down Expand Up @@ -64,14 +67,14 @@ export function LoggedInUser({

function serverMessage() {
if (!serverUrl) {
return 'No server';
return t('No server');
}

if (userData?.offline) {
return 'Server offline';
return t('Server offline');
}

return 'Server online';
return t('Server online');
}

if (hideIfNoServer && !serverUrl) {
Expand All @@ -88,7 +91,7 @@ export function LoggedInUser({
...style,
}}
>
Connecting...
<Trans>Connecting...</Trans>
</Text>
);
}
Expand All @@ -115,12 +118,14 @@ export function LoggedInUser({
serverUrl &&
!userData?.offline && {
name: 'change-password',
text: 'Change password',
text: t('Change password'),
},
serverUrl && { name: 'sign-out', text: 'Sign out' },
serverUrl && { name: 'sign-out', text: t('Sign out') },
{
name: 'config-server',
text: serverUrl ? 'Change server URL' : 'Start using a server',
text: serverUrl
? t('Change server URL')
: t('Start using a server'),
},
]}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react';
import { Trans } from 'react-i18next';

import { Modal, ModalHeader } from '../common/Modal';
import { Paragraph } from '../common/Paragraph';
Expand All @@ -10,10 +11,14 @@ export function GoCardlessLink() {
<Modal name="gocardless-link" isDismissable={false}>
<ModalHeader title="Account sync" />
<View style={{ maxWidth: 500 }}>
<Paragraph>Please wait...</Paragraph>
<Paragraph>
The window should close automatically. If nothing happened you can
close this window or tab.
<Trans>Please wait...</Trans>
</Paragraph>
<Paragraph>
<Trans>
The window should close automatically. If nothing happened you can
close this window or tab.
</Trans>
</Paragraph>
</View>
</Modal>
Expand Down
Loading

0 comments on commit c5193b6

Please sign in to comment.