From 21b7928dce918d0971c26b374cbb8f9ed10fd1ec Mon Sep 17 00:00:00 2001 From: Made Baruna Date: Fri, 1 Jul 2022 22:45:45 +0700 Subject: [PATCH] Add locale on character and weapon dropdown --- src/components/CharacterSelect.svelte | 120 +++++++++++++------------- src/components/WeaponSelect.svelte | 117 +++++++++++++------------ src/locales/en.json | 5 +- src/routes/wish/[id].svelte | 12 ++- src/routes/wish/_summaryItem.svelte | 12 ++- 5 files changed, 145 insertions(+), 121 deletions(-) diff --git a/src/components/CharacterSelect.svelte b/src/components/CharacterSelect.svelte index c15613a5..b0d4f50a 100644 --- a/src/components/CharacterSelect.svelte +++ b/src/components/CharacterSelect.svelte @@ -1,4 +1,5 @@ + + +
+
+ {#if !nothingSelected} + {selected.name} + {/if} + + {#if selected} +
select(null)}> + +
+ {:else} + + {/if} +
+ {#if focused} +
+ {#if filteredCharacter.length} + + select(character)} + on:mouseenter={() => onHover(index)} + class={`p-3 rounded-xl cursor-pointer flex mr-2 + ${index === 0 ? 'mt-2' : ''} + ${index === characters.length ? 'mb-2' : ''} + ${!nothingSelected && selected.id === id ? 'text-primary font-semibold' : ''} + ${hoveredIndex === index ? 'hovered' : ''}`} + > + {character.name} + {$t(character.name)} + + + {:else} Character not found {/if} +
+ {/if} +
+ - - - -
-
- {#if !nothingSelected} - {selected.name} - {/if} - - {#if selected} -
select(null)}> - -
- {:else} - - {/if} -
- {#if focused} -
- {#if filteredCharacter.length} - - select(character)} - on:mouseenter={() => onHover(index)} - class={`p-3 rounded-xl cursor-pointer flex mr-2 - ${index === 0 ? 'mt-2' : ''} - ${index === characters.length ? 'mb-2' : ''} - ${!nothingSelected && selected.id === id ? 'text-primary font-semibold' : ''} - ${hoveredIndex === index ? 'hovered' : ''}`}> - {character.name} - {character.name} - - - {:else} Character not found {/if} -
- {/if} -
diff --git a/src/components/WeaponSelect.svelte b/src/components/WeaponSelect.svelte index e7161dfe..28fa8367 100644 --- a/src/components/WeaponSelect.svelte +++ b/src/components/WeaponSelect.svelte @@ -1,4 +1,5 @@ + + +
+
+ {#if !nothingSelected} + {selected.name} + {/if} + + {#if selected} +
select(null)}> + +
+ {:else} + + {/if} +
+ {#if focused} +
+ {#if filteredWeapons.length} + + select(weapon)} + on:mouseenter={() => onHover(index)} + class={`p-3 rounded-xl cursor-pointer flex mr-2 + ${index === 0 ? 'mt-2' : ''} + ${index === weapons.length ? 'mb-2' : ''} + ${!nothingSelected && selected.id === id ? 'text-primary font-semibold' : ''} + ${hoveredIndex === index ? 'hovered' : ''}`} + > + {weapon.name} + {$t(weapon.name)} + + + {:else} Weapon not found {/if} +
+ {/if} +
+ - - - -
-
- {#if !nothingSelected} - {selected.name} - {/if} - - {#if selected} -
select(null)}> - -
- {:else} - - {/if} -
- {#if focused} -
- {#if filteredWeapons.length} - - select(weapon)} - on:mouseenter={() => onHover(index)} - class={`p-3 rounded-xl cursor-pointer flex mr-2 - ${index === 0 ? 'mt-2' : ''} - ${index === weapons.length ? 'mb-2' : ''} - ${!nothingSelected && selected.id === id ? 'text-primary font-semibold' : ''} - ${hoveredIndex === index ? 'hovered' : ''}`}> - {weapon.name} - {weapon.name} - - - {:else} Weapon not found {/if} -
- {/if} -
diff --git a/src/locales/en.json b/src/locales/en.json index fe99efce..005cbadc 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -445,7 +445,8 @@ "percent": "Percent", "pityAverage": "Pity AVG", "character": "Character", - "weapon": "Weapon" + "weapon": "Weapon", + "winRateOff": "Win 50:50" }, "note": [ "Wish history is not updated automatically, please import again to update your history!", @@ -939,4 +940,4 @@ "dataSynced": "Data has been synced!", "driveError": "Drive sync not available right now 😔" } -} +} \ No newline at end of file diff --git a/src/routes/wish/[id].svelte b/src/routes/wish/[id].svelte index 035a4d23..124cb428 100644 --- a/src/routes/wish/[id].svelte +++ b/src/routes/wish/[id].svelte @@ -673,9 +673,12 @@ class="bg-background px-4 py-2 rounded-xl flex flex-col items-center justify-center mr-4" style="height: 200px;" > -

Total

+

{$t('wish.summary.total')}

{total}

-

5 Pity

+

+ 5 + {$t('wish.detail.pity')} +

{legendary} {#if nextRateUp} @@ -685,7 +688,10 @@ {/if}

-

4 Pity

+

+ 4 + {$t('wish.detail.pity')} +

{rare}

diff --git a/src/routes/wish/_summaryItem.svelte b/src/routes/wish/_summaryItem.svelte index d9677e85..9defc128 100644 --- a/src/routes/wish/_summaryItem.svelte +++ b/src/routes/wish/_summaryItem.svelte @@ -77,7 +77,9 @@ - â”” {$t('wish.summary.character')} + + â”” {$t('wish.summary.character')} + {numberFormat.format(avg.rare.character.total)} @@ -89,7 +91,9 @@ - â”” {$t('wish.summary.weapon')} + + â”” {$t('wish.summary.weapon')} + {numberFormat.format(avg.rare.weapon.total)} @@ -102,7 +106,9 @@ {#if avg.rare.rateOff !== undefined} - â”” Win 50:50 + + â”” {$t('wish.summary.winRateOff')} + {numberFormat.format(avg.rare.rateOff.total)}