Add localization support (#333)

* Add updated i18n config and en locale
This commit is contained in:
Jeff 2023-10-30 19:22:45 -07:00 committed by GitHub
parent 11863fd4c1
commit 8430b1ec95
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
90 changed files with 2679 additions and 908 deletions

View file

@ -9,6 +9,7 @@ import { authenticationFailure, resultWithHeaders } from '/@/renderer/api/utils'
import { useAuthStore } from '/@/renderer/store';
import { ServerListItem } from '/@/renderer/types';
import { toast } from '/@/renderer/components';
import i18n from '/@/i18n/i18n';
const localSettings = isElectron() ? window.electron.localSettings : null;
@ -276,9 +277,12 @@ axiosClient.interceptors.response.use(
if (res.status === 429) {
toast.error({
message:
'you have exceeded the number of allowed login requests. Please wait before logging, or consider tweaking AuthRequestLimit',
title: 'Your session has expired.',
message: i18n.t('error.loginRateError', {
postProcess: 'sentenceCase',
}) as string,
title: i18n.t('error.sessionExpiredError', {
postProcess: 'sentenceCase',
}) as string,
});
const serverId = currentServer.id;
@ -292,7 +296,11 @@ axiosClient.interceptors.response.use(
throw TIMEOUT_ERROR;
}
if (res.status !== 200) {
throw new Error('Failed to authenticate');
throw new Error(
i18n.t('error.authenticatedFailed', {
postProcess: 'sentenceCase',
}) as string,
);
}
const newCredential = res.data.token;