Skip to content

Commit

Permalink
i18n: add translation strings for texture pack
Browse files Browse the repository at this point in the history
  • Loading branch information
xTVaser committed Jul 22, 2023
1 parent cb81c40 commit c0a66b0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 17 deletions.
13 changes: 12 additions & 1 deletion src/assets/translations/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
"requirements_button_bypass_warning_1": "If you believe the requirement checks are false, you can bypass them.",
"requirements_button_bypass_warning_2": "However, if you are wrong you should expect issues installing or running the game!",
"gameControls_button_play": "Play",
"gameControls_button_features": "Features",
"gameControls_button_features_textures": "Texture Packs",
"gameControls_button_advanced": "Advanced",
"gameControls_button_playInDebug": "Play in Debug Mode",
"gameControls_button_openREPL": "Open REPL",
Expand Down Expand Up @@ -122,5 +124,14 @@
"splash_step_errorOpening": "Problem opening Launcher",
"gameJob_deleteTexturePacks": "Deleting Packs",
"gameJob_enablingTexturePacks": "Enabling Packs",
"gameJob_applyTexturePacks": "Applying Packs"
"gameJob_applyTexturePacks": "Applying Packs",
"features_textures_invalidPack": "Invalid texture pack format, ensure it contains a top-level `texture_replacements` folder.",
"features_textures_addNewPack": "Add New Pack",
"features_textures_applyChanges": "Apply Texture Changes",
"features_textures_listHeading": "Currently Added Packs",
"features_textures_description": "You can enable as many packs as you want, but if multiple packs replace the same file the order matters. For example if two packs replace the grass, the first pack in the list will take precedence.",
"features_textures_replacedCount": "Textures replaced",
"features_textures_enabled": "Enabled",
"features_textures_disabled": "Disabled",
"features_textures_conflictsDetected": "Conflicts Detected!"
}
7 changes: 3 additions & 4 deletions src/components/games/GameControls.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,12 @@
DropdownItem,
DropdownDivider,
Helper,
Chevron,
} from "flowbite-svelte";
import { resetGameSettings, uninstallGame } from "$lib/rpc/game";
import { platform } from "@tauri-apps/api/os";
import { launchGame, openREPL } from "$lib/rpc/binaries";
import { _ } from "svelte-i18n";
import { Link, navigate } from "svelte-navigator";
import { navigate } from "svelte-navigator";
export let activeGame: SupportedGame;
Expand Down Expand Up @@ -59,15 +58,15 @@
>
<Button
class="text-center font-semibold focus:ring-0 focus:outline-none inline-flex items-center justify-center px-2 py-2 text-sm text-white border-solid border-2 border-slate-900 rounded bg-slate-900 hover:bg-slate-800"
>Features</Button
>{$_("gameControls_button_features")}</Button
>
<Dropdown placement="top-end" class="!bg-slate-900">
<DropdownItem
on:click={async () => {
navigate(`/${getInternalName(activeGame)}/features/texture_packs`);
}}
>
Texture Packs
{$_("gameControls_button_features_textures")}
</DropdownItem>
</Dropdown>
<Button
Expand Down
26 changes: 14 additions & 12 deletions src/components/games/features/texture-packs/TexturePacks.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
Button,
Card,
Spinner,
Toggle,
} from "flowbite-svelte";
import { createEventDispatcher, onMount } from "svelte";
import { navigate } from "svelte-navigator";
import { _ } from "svelte-i18n";
const dispatch = createEventDispatcher();
export let activeGame: SupportedGame;
Expand Down Expand Up @@ -167,8 +167,7 @@
if (success) {
await update_pack_list();
} else {
packAddingError =
"Invalid texture pack format, ensure it contains a top-level `texture_replacements` folder.";
packAddingError = $_("features_textures_invalidPack");
}
}
addingPack = false;
Expand Down Expand Up @@ -228,13 +227,14 @@
{#if addingPack}
<Spinner class="mr-3" size="4" color="white" />
{/if}
Add New Pack</Button
{$_("features_textures_addNewPack")}</Button
>
{#if pending_changes(availablePacks, availablePacksOriginal)}
<Button
class="flex-shrink border-solid rounded bg-green-400 hover:bg-green-500 text-sm text-slate-900 font-semibold px-5 py-2"
on:click={applyTexturePacks}
aria-label="apply texture changes">Apply Texture Changes</Button
aria-label="apply texture changes"
>{$_("features_textures_applyChanges")}</Button
>
{/if}
</div>
Expand All @@ -246,13 +246,11 @@
</div>
{/if}
<div class="flex flex-row font-bold mt-3">
<h2>Currently Added Packs</h2>
<h2>{$_("features_textures_listHeading")}</h2>
</div>
<div class="flex flex-row text-sm">
<p>
You can enable as many packs as you want, but if multiple packs
replace the same file the order matters. For example if two packs
replace the grass, the first pack in the list will take precedence.
{$_("features_textures_description")}
</p>
</div>
{#each availablePacks as pack, packIndex}
Expand Down Expand Up @@ -282,7 +280,9 @@
{extractedPackInfo[pack.name]["releaseDate"]}
</p>
<p class="font-bold text-gray-500 text-xs">
Textures replaced - {num_textures_in_pack(pack.name)}
{$_("features_textures_replacedCount")} - {num_textures_in_pack(
pack.name
)}
</p>
<p class="mt-2 mb-4 font-normal text-gray-400 leading-tight">
{extractedPackInfo[pack.name]["description"]}
Expand All @@ -303,7 +303,9 @@
pack.enabled = !pack.enabled;
}}
>
{pack.enabled ? "Enabled" : "Disabled"}
{pack.enabled
? $_("features_textures_enabled")
: $_("features_textures_disabled")}
</Button>
</div>
<div class="mt-2 flex flex-row gap-2">
Expand Down Expand Up @@ -373,7 +375,7 @@
clip-rule="evenodd"
/></svg
>
<span> Conflicts Detected!</span>
<span> {$_("features_textures_conflictsDetected")}</span>
</span>
<div slot="arrowup" />
<div slot="arrowdown" />
Expand Down

0 comments on commit c0a66b0

Please sign in to comment.