Add translations

This commit is contained in:
Nicola Benaglia
2025-05-20 09:02:15 +02:00
parent 9d25249b6d
commit 33f758bbbc
3 changed files with 57 additions and 26 deletions

View File

@@ -10,6 +10,7 @@ import { saveToLocalStorage } from '../components/Apps/AppsNavBarDesktop';
import { base64ToUint8Array } from '../qdn/encryption/group-encryption';
import { uint8ArrayToObject } from '../backgroundFunctions/encryption';
import { useSetAtom } from 'jotai';
import { useTranslation } from 'react-i18next';
export const useHandlePrivateApps = () => {
const [status, setStatus] = useState('');
@@ -20,8 +21,8 @@ export const useHandlePrivateApps = () => {
setInfoSnackCustom,
} = useContext(MyContext);
const setSortablePinnedApps = useSetAtom(sortablePinnedAppsAtom);
const setSettingsLocalLastUpdated = useSetAtom(settingsLocalLastUpdatedAtom);
const { t } = useTranslation(['auth', 'core', 'group']);
const openApp = async (
privateAppProperties,
@@ -29,7 +30,7 @@ export const useHandlePrivateApps = () => {
setLoadingStatePrivateApp
) => {
try {
if (setLoadingStatePrivateApp) {
if (setLoadingStatePrivateApp) { // TODO translate
setLoadingStatePrivateApp(`Downloading and decrypting private app.`);
}
setOpenSnackGlobal(true);
@@ -173,7 +174,7 @@ export const useHandlePrivateApps = () => {
});
setInfoSnackCustom({
type: 'success',
message: 'Opened',
message: {t('core:message.generic.opened', { postProcess: 'capitalizeFirstChar' })},
});
if (setLoadingStatePrivateApp) {
setLoadingStatePrivateApp(``);
@@ -206,7 +207,12 @@ export const useHandlePrivateApps = () => {
} catch (error) {
if (setLoadingStatePrivateApp) {
setLoadingStatePrivateApp(
`Error! ${error?.message || 'Unable to build private app.'}`
`Error! ${
error?.message ||
t('core:message.error.unable_build_app', {
postProcess: 'capitalizeFirstChar',
})
}`
);
}
throw error;
@@ -214,7 +220,11 @@ export const useHandlePrivateApps = () => {
} catch (error) {
setInfoSnackCustom({
type: 'error',
message: error?.message || 'Unable to fetch app',
message:
error?.message ||
t('core:message.error.unable_fetch_app', {
postProcess: 'capitalizeFirstChar',
}),
});
}
};

View File

@@ -172,8 +172,10 @@
"rating_option": "cannot find rating option",
"save_qdn": "unable to save to QDN",
"send_failed": "failed to send",
"unable_build_app": "unable to build private app",
"unable_download_image": "unable to download IMAGE. Please try again later by clicking the refresh button",
"unable_encrypt_app": "unable to encrypt app. App not published'",
"unable_fetch_app": "unable to build private app",
"unable_publish_app": "unable to publish app",
"unable_publish_image": "unable to publish image",
"unable_rate": "unable to rate",
@@ -215,6 +217,7 @@
"no_pinned_changes": "you currently do not have any changes to your pinned apps",
"no_results": "no results",
"one_app_per_name": "note: Currently, only one App and Website is allowed per Name.",
"opened": "opened",
"overwrite_qdn": "overwrite to QDN",
"password_confirm": "please confirm a password",
"password_enter": "please enter a password",