Skip to content

Commit

Permalink
feat(translation): add translation items
Browse files Browse the repository at this point in the history
  • Loading branch information
SARDONYX-sard committed Jan 15, 2024
1 parent 620ae7d commit 805b3da
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 19 deletions.
14 changes: 9 additions & 5 deletions frontend/src/components/buttons/remove_oar_btn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ type Props = {

export const RemoveOarBtn = ({ darPath, oarPath }: Props) => {
const { t } = useTranslation();
const errMsg = t('remove-oar-failed');

return (
<Tooltip title={<p>{t('remove-oar-tooltip')}</p>}>
Expand All @@ -27,14 +26,19 @@ export const RemoveOarBtn = ({ darPath, oarPath }: Props) => {
variant="outlined"
onClick={async () => {
try {
if (oarPath === '' && darPath === '') {
toast.error(t('remove-oar-specify-error'));
return;
}

if (oarPath === '') {
await removeOarDir(darPath, errMsg);
await removeOarDir(darPath);
} else {
await removeOarDir(oarPath, errMsg);
await removeOarDir(oarPath);
}
toast.success(t('remove-oar-success'));
} catch (e) {
toast.error(`${e}`);
} catch (_e) {
toast.error(t('remove-oar-failed'));
}
}}
startIcon={<DeleteIcon />}
Expand Down
14 changes: 10 additions & 4 deletions frontend/src/components/buttons/unhide_dar_btn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Button from '@mui/material/Button';
import { toast } from 'react-hot-toast';

import { useTranslation } from '@/hooks';
import { restoreDarDir } from '@/tauri_cmd';
import { unhideDarDir } from '@/tauri_cmd';

type Props = {
path: string;
Expand All @@ -25,9 +25,15 @@ export const UnhideDarBtn = ({ path }: Props) => {
variant="outlined"
onClick={async () => {
try {
toast.success(await restoreDarDir(path, t('unhide-dar-failed')));
} catch (err) {
toast.error(`${err}`);
if (path === '') {
toast.error(t('unhide-dar-specify-error'));
return;
}

await unhideDarDir(path);
toast.success(t('unhide-dar-success'));
} catch (_e) {
toast.error(t('unhide-dar-failed'));
}
}}
startIcon={<VisibilityIcon />}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function ConvertForm() {
setValue('progress', (prog * 100) / maxNum);
});

const completeInfo = await convertDar2oar({
await convertDar2oar({
src,
dist,
modName,
Expand All @@ -106,7 +106,7 @@ export function ConvertForm() {
hideDar,
showProgress,
});
toast.success(completeInfo);
toast.success(t('conversion-complete'));
setValue('progress', 100);
} catch (err) {
setValue('progress', 0); // To avoid NaN
Expand Down
12 changes: 8 additions & 4 deletions locales/en-US.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"all-clear-btn": "All Clear",
"conversion-complete": "Conversion Complete.",
"convert-btn": "Convert",
"convert-form-author-name": "Mod Author Name",
"convert-form-author-name-helper": "[Optional]",
Expand Down Expand Up @@ -30,16 +31,17 @@
"custom-js-label": "Custom JavaScript(Please do not execute untrusted scripts)",
"editor-mode-list-label": "Editor Mode",
"hide-dar-btn": "Hide DAR",
"hide-dar-btn-tooltip": "After conversion, append \".mohidden\" to the DAR dirname in \"DAR(src) Directory*\" to make it a hidden directory.",
"hide-dar-btn-tooltip2": "NOTE: It appears to work on the MO2 Tree view, but it is doubtful that it works in the author's actual experience.",
"hide-dar-btn-tooltip": "After conversion, add \".mohidden\" to all DAR files to hide them.",
"hide-dar-btn-tooltip2": "",
"log-level-list-label": "Log Level",
"mapping-wiki-url-leaf": "wiki#what-is-the-mapping-file",
"open-log-btn": "Open log",
"progress-btn": "ProgressBar",
"progress-btn-tooltip": "Display detail progress",
"progress-btn-tooltip2": "However, conversion may be delayed by 5~10 seconds or more.",
"remove-oar-btn": "Remove OAR",
"remove-oar-failed": "DAR or OAR dir must be specified.",
"remove-oar-failed": "Not found \"OpenAnimationReplacer\" directory",
"remove-oar-specify-error": "DAR or OAR dir must be specified.",
"remove-oar-success": "Removed OAR directory.",
"remove-oar-tooltip": "Find and delete OAR dir from \"DAR(src) Directory*\" or \"OAR(dist) Directory\".",
"run-parallel-btn-tooltip": "Use multi-threading.",
Expand All @@ -48,5 +50,7 @@
"select-btn": "Select",
"unhide-dar-btn": "Unhide DAR",
"unhide-dar-btn-tooltip": "Unhide the directory hidden by \"Hide DAR\".(For MO2 user)",
"unhide-dar-failed": "DAR dir must be specified."
"unhide-dar-failed": "Could not find files with \".mohidden\" extension",
"unhide-dar-specify-error": "DAR dir must be specified.",
"unhide-dar-success": "Redisplay of DAR directory."
}
12 changes: 8 additions & 4 deletions locales/ja-JP.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"all-clear-btn": "全入力をクリア",
"conversion-complete": "変換が完了しました",
"convert-btn": "変換",
"convert-form-author-name": "Mod作者名",
"convert-form-author-name-helper": "[任意]",
Expand Down Expand Up @@ -30,16 +31,17 @@
"custom-js-label": "カスタムJavaScript(信用できないスクリプトは実行しないでください)",
"editor-mode-list-label": "編集モード",
"hide-dar-btn": "DARを非表示",
"hide-dar-btn-tooltip": "変換後に\"DAR(src) Directory*\"\".mohidden\"を追加して隠しディレクトリ化します",
"hide-dar-btn-tooltip2": "注意: MO2のTree view上では機能しているように見えますが作者の実体験では機能しているか怪しいです。",
"hide-dar-btn-tooltip": "変換後、DARの全ファイルに\".mohidden\"を追加して非表示化します",
"hide-dar-btn-tooltip2": "",
"log-level-list-label": "ログレベル",
"mapping-wiki-url-leaf": "wiki#what-is-the-mapping-file",
"open-log-btn": "ログを開く",
"progress-btn": "進捗バー",
"progress-btn-tooltip": "詳細な進捗状況を表示します",
"progress-btn-tooltip2": "注意: 変換時間が5~10秒以上増加する可能性があります",
"remove-oar-btn": "OARを削除",
"remove-oar-failed": "DARまたはOARが入力されていません",
"remove-oar-failed": "\"OpenAnimationReplacer\" ディレクトリが見つかりません",
"remove-oar-specify-error": "DARまたはOARが入力されていません",
"remove-oar-success": "OARディレクトリを削除しました",
"remove-oar-tooltip": "OAR(dist)(なければDAR(src))からOARディレクトリを捜索して削除します",
"run-parallel-btn-tooltip": "マルチスレッドを使用します",
Expand All @@ -48,5 +50,7 @@
"select-btn": "選択",
"unhide-dar-btn": "DAR再表示",
"unhide-dar-btn-tooltip": "\"DARを非表示\"による非表示化の解除(MO2ユーザ向け)",
"unhide-dar-failed": "DAR(src)を指定してください"
"unhide-dar-failed": "拡張子「.mohidden」のついたファイルが見つかりません",
"unhide-dar-specify-error": "DAR(src)を指定してください",
"unhide-dar-success": "DARの非表示化が解除されました"
}

0 comments on commit 805b3da

Please sign in to comment.