Skip to content

Commit

Permalink
added i18n for the successful saving message
Browse files Browse the repository at this point in the history
  • Loading branch information
KrisCris committed Jan 6, 2025
1 parent a4ed610 commit e43fa87
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 13 deletions.
24 changes: 17 additions & 7 deletions frontend/palworld-pal-editor-webui/src/components/TopBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,22 @@ watch(() => palStore.LOADING_FLAG, (newValue) => {
}
});
const toggleCheat = async () => {
const donate = async () => {
if (await palStore.showDonate()) {
alert(palStore.getTranslatedText("TopBar_Btn_Invalid_Options_ADs"))
alert(palStore.getTranslatedText("TopBar_Btn_Invalid_Options_ADs"));
palStore.SHOW_DONATE_FLAG = true;
}
palStore.HIDE_INVALID_OPTIONS = !palStore.HIDE_INVALID_OPTIONS
}
const show_cheats = async () => {
await donate();
palStore.HIDE_INVALID_OPTIONS = !palStore.HIDE_INVALID_OPTIONS;
}
const save = async () => {
if (await palStore.writeSave()) {
await donate();
}
}
</script>

Expand All @@ -46,7 +56,7 @@ const toggleCheat = async () => {
<p>💾</p>
<input class="savePath" type="text" v-model="palStore.PAL_WRITE_BACK_PATH"
:placeholder="palStore.PAL_GAME_SAVE_PATH" :disabled="palStore.LOADING_FLAG">
<button class="op save" @click="palStore.writeSave" :disabled="palStore.LOADING_FLAG">
<button class="op save" @click="save" :disabled="palStore.LOADING_FLAG">
💾 {{ palStore.getTranslatedText("TopBar_Btn_Save") }}
</button>
<button class="op" @click="palStore.loadSave" :disabled="palStore.LOADING_FLAG">
Expand All @@ -58,8 +68,8 @@ const toggleCheat = async () => {

<div class="tooltip-container">
<button class="op" @click="palStore.updatePal" name="heal_all_pals" :disabled="palStore.LOADING_FLAG">
💉 {{ palStore.getTranslatedText("TopBar_Btn_HealAllPals") }}
</button>
💉 {{ palStore.getTranslatedText("TopBar_Btn_HealAllPals") }}
</button>
<span class="tooltip-text">{{ palStore.getTranslatedText('TopBar_Btn_HealAllPals_Tooltips') }}</span>
</div>

Expand All @@ -82,7 +92,7 @@ const toggleCheat = async () => {
</div>

<div class="tooltip-container">
<button :class="['op', { 'toggled': palStore.HIDE_INVALID_OPTIONS }]" @click="toggleCheat"
<button :class="['op', { 'toggled': palStore.HIDE_INVALID_OPTIONS }]" @click="show_cheats"
:disabled="palStore.LOADING_FLAG" :title="palStore.getTranslatedText('TopBar_Invalid_Options_Tooltips')">
⚠️ {{ palStore.getTranslatedText("TopBar_Btn_Invalid_Options") }}
</button>
Expand Down
2 changes: 2 additions & 0 deletions frontend/palworld-pal-editor-webui/src/i18n/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,6 @@ export default {
TopBar_Pal_OOB_Tooltips: "Display pals that are not in owner player pal containers, i.e. viewing cage, or taken by someone.",
TopBar_Pal_Ghost_Tooltips: "Show ghost pals, those no longer can be found in game, i.e. sold, dropped, butchered.",
TopBar_Invalid_Options_Tooltips: "Hide some options and dropdowns that are not normally available in game, be careful when using it.",

Alert_Successful_Save: "Changes successfully saved to {{path}}.",
};
4 changes: 3 additions & 1 deletion frontend/palworld-pal-editor-webui/src/i18n/fr.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,7 @@ export default {
TopBar_Btn_HealAllPals_Tooltips: "Supprime tous les états négatifs de Pal et rétablit la santé et la satiété.",
TopBar_Pal_OOB_Tooltips: "Afficher les pals qui ne sont pas dans les conteneurs de pals du joueur propriétaire, c'est-à-dire la cage d'observation, ou pris par quelqu'un.",
TopBar_Pal_Ghost_Tooltips: "Afficher les pals fantômes, ceux qui ne peuvent plus être trouvés dans le jeu, c'est-à-dire vendus, lâchés, abattus.",
TopBar_Invalid_Options_Tooltips: "Masquez certaines options et menus déroulants qui ne sont normalement pas disponibles dans le jeu. Faites attention lors de leur utilisation."
TopBar_Invalid_Options_Tooltips: "Masquez certaines options et menus déroulants qui ne sont normalement pas disponibles dans le jeu. Faites attention lors de leur utilisation.",

Alert_Successful_Save: "Modifications enregistrées avec succès dans {{path}}.",
};
4 changes: 3 additions & 1 deletion frontend/palworld-pal-editor-webui/src/i18n/ja.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,7 @@ export default {
TopBar_Btn_HealAllPals_Tooltips: "パルのすべての負の状態を解除し、体力と満腹度を回復します。",
TopBar_Pal_OOB_Tooltips: "所有者のプレイヤーパルコンテナにないパルを表示します。例:観賞用ケージ、他の人に取られたパル。",
TopBar_Pal_Ghost_Tooltips: "ゲーム内で見つからないゴーストパルを表示します。例:売却された、落とされた、解体されたパル。",
TopBar_Invalid_Options_Tooltips: "ゲーム内で通常利用できないいくつかのオプションやドロップダウンを非表示にします。使用する際は注意してください。"
TopBar_Invalid_Options_Tooltips: "ゲーム内で通常利用できないいくつかのオプションやドロップダウンを非表示にします。使用する際は注意してください。",

Alert_Successful_Save: "変更が {{path}} に正常に保存されました。",
};
4 changes: 3 additions & 1 deletion frontend/palworld-pal-editor-webui/src/i18n/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,7 @@ export default {
TopBar_Btn_HealAllPals_Tooltips: "治愈帕鲁的所有负面状态,回复血量,饱食度。",
TopBar_Pal_OOB_Tooltips: "显示不在玩家的帕鲁容器中的帕鲁,即,观赏笼中的帕鲁,或被其他人拿走的帕鲁。",
TopBar_Pal_Ghost_Tooltips: "显示不存在的帕鲁,即游戏中找不到的帕鲁,比如,你已将其出售,丢弃,宰杀。",
TopBar_Invalid_Options_Tooltips: "隐藏游戏中通常不可用的一些选项和下拉菜单,使用时请注意。"
TopBar_Invalid_Options_Tooltips: "隐藏游戏中通常不可用的一些选项和下拉菜单,使用时请注意。",

Alert_Successful_Save: "更改已成功保存到 {{path}}。",
};
8 changes: 5 additions & 3 deletions frontend/palworld-pal-editor-webui/src/stores/paleditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,7 @@ export const usePalEditorStore = defineStore("paleditor", () => {
}

async function writeSave() {
let retval = false;
let no_set_loading_flag = LOADING_FLAG.value;
if (!no_set_loading_flag) LOADING_FLAG.value = true;
const response = await POST("/api/save/save", {
Expand All @@ -896,9 +897,9 @@ export const usePalEditorStore = defineStore("paleditor", () => {
if (response === false) return;

if (response.status == 0) {
alert(`Changes saved to ${PAL_WRITE_BACK_PATH.value}`);
// YOU HAVE TO RELOAD FOR NOW, THIS HOW MY BACKEND WORKS.
// loadSave()
const Alert_Successful_Save = getTranslatedText("Alert_Successful_Save").replace("{{path}}", PAL_WRITE_BACK_PATH.value);
alert(Alert_Successful_Save);
retval = true;
} else if (response.status == 2) {
alert("Unauthorized Access, Please Login. ");
IS_LOCKED.value = true;
Expand All @@ -907,6 +908,7 @@ export const usePalEditorStore = defineStore("paleditor", () => {
alert(`- writeSave - Error occured: ${response.msg}`);
}
if (!no_set_loading_flag) LOADING_FLAG.value = false;
return retval;
}

async function fetchPlayerPal(playerUId) {
Expand Down

0 comments on commit e43fa87

Please sign in to comment.