Skip to content

Commit

Permalink
Translate more UI strings
Browse files Browse the repository at this point in the history
  • Loading branch information
squaresmile committed May 3, 2024
1 parent e1508d0 commit f6ed37b
Show file tree
Hide file tree
Showing 15 changed files with 163 additions and 36 deletions.
40 changes: 23 additions & 17 deletions packages/db/src/Component/QuestEnemy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,15 +111,16 @@ function describeMultipleSkills(region: Region, skills: Skill.Skill[]) {
}

const DeckTypeDescriptor = ({ deckType }: { deckType: QuestEnemy.DeckType }) => {
const { t } = useTranslation();
switch (deckType) {
case QuestEnemy.DeckType.ENEMY:
return <FontAwesomeIcon icon={faSkull} title="Enemy Deck" />;
return <FontAwesomeIcon icon={faSkull} title={t("Enemy Deck")} />;
case QuestEnemy.DeckType.SHIFT:
return <FontAwesomeIcon icon={faShieldHeart} title="Shift Deck" />;
return <FontAwesomeIcon icon={faShieldHeart} title={t("Shift Deck")} />;
case QuestEnemy.DeckType.TRANSFORM:
return <FontAwesomeIcon icon={faWandMagicSparkles} title="Transform Deck" />;
return <FontAwesomeIcon icon={faWandMagicSparkles} title={t("Transform Deck")} />;
case QuestEnemy.DeckType.CALL:
return <FontAwesomeIcon icon={faPhone} title="Call Deck" />;
return <FontAwesomeIcon icon={faPhone} title={t("Call Deck")} />;
default:
return <>{toTitleCase(deckType)}</>;
}
Expand All @@ -133,6 +134,7 @@ function EnemyNpcDescription(props: {
hash?: string;
handleNavigateEnemyHash?: (hash: string) => void;
}) {
const { t } = useTranslation();
const hash = props.hash ?? `${props.deck}-${props.npcId}`;
const enemy = props.enemyLookUp.get(hash);
if (enemy !== undefined) {
Expand All @@ -146,11 +148,15 @@ function EnemyNpcDescription(props: {
location={enemy.svt.face}
mightNotExist={true}
/>{" "}
{enemy.name} Lv. {enemy.lv}
{enemy.name} {t("Lv.")} {enemy.lv}
</Button>
);
} else {
return <>Enemy {props.npcId}</>;
return (
<>
{t("Enemy")} {props.npcId}
</>
);
}
}

Expand Down Expand Up @@ -186,8 +192,8 @@ export const QuestEnemyMainData = (props: {
<Table bordered responsive className="quest-svt-data-table">
<tbody>
{renderDoubleRow([
{ title: "ATK", content: enemy.atk.toLocaleString() },
{ title: "HP", content: enemy.hp.toLocaleString() },
{ title: t("ATK"), content: enemy.atk.toLocaleString() },
{ title: t("HP"), content: enemy.hp.toLocaleString() },
])}
{renderDoubleRow([
{
Expand All @@ -203,7 +209,7 @@ export const QuestEnemyMainData = (props: {
renderDoubleRow([
{
title: t("NP bar"),
content: `${enemy.chargeTurn} bar${enemy.chargeTurn > 1 ? "s" : ""}`,
content: `${t("bar", { count: enemy.chargeTurn })}`,
},
{
title: t("NP gain mod"),
Expand Down Expand Up @@ -405,8 +411,8 @@ export const QuestEnemySubData = ({
: null}
{enemy.enemyScript.leader
? renderSpanningRow({
title: "Leader",
content: "Battle ends if servant is defeated",
title: t("Leader"),
content: t("Battle ends if servant is defeated"),
})
: null}
</tbody>
Expand Down Expand Up @@ -465,13 +471,13 @@ export const QuestDropDescriptor = ({
ciText = (
<>
<br />
95% CI: {numToPct(lower)}{numToPct(upper)}
95% {t("CI")}: {numToPct(lower)}{numToPct(upper)}
</>
);
}
const tooltip = (
<Tooltip id={`drop-detail-tooltip`} style={{ fontSize: "1em" }}>
{drop.dropCount.toLocaleString()} drops / {drop.runs.toLocaleString()} runs
{drop.dropCount.toLocaleString()} {t("drops")} / {drop.runs.toLocaleString()} {t("runs")}
{ciText}
</Tooltip>
);
Expand Down Expand Up @@ -515,7 +521,7 @@ const QuestEnemyTable = (props: {
.filter((call) => call.callee === enemy.npcId)
.map((call) => (
<li key={`${call.caller}-${call.callee}`}>
Can be summoned by{" "}
{t("Can be summoned by")}{" "}
<EnemyNpcDescription
region={region}
hash={call.caller}
Expand All @@ -532,7 +538,7 @@ const QuestEnemyTable = (props: {
.filter((shift) => shift.shiftTo === enemy.npcId)
.map((shift) => (
<li key={`${shift.shiftFrom}-${shift.shiftTo}-${shift.index}`}>
<OrdinalNumeral index={shift.index + 2} /> break bar of{" "}
<OrdinalNumeral index={shift.index + 2} /> {t("break bar of")}{" "}
<EnemyNpcDescription
region={region}
hash={shift.shiftFrom}
Expand All @@ -549,7 +555,7 @@ const QuestEnemyTable = (props: {
.filter((change) => change.shiftTo === enemy.npcId)
.map((change) => (
<li key={`${change.shiftFrom}-${change.shiftTo}-${change.index}`}>
<OrdinalNumeral index={change.index + 1} /> transformation of{" "}
<OrdinalNumeral index={change.index + 1} /> {t("transformation of")}{" "}
<EnemyNpcDescription
region={region}
hash={change.shiftFrom}
Expand All @@ -566,7 +572,7 @@ const QuestEnemyTable = (props: {
<DeckTypeDescriptor deckType={enemy.deck} /> {enemy.deckId}.{" "}
<EntityDescriptor region={region} entity={enemy.svt} overwriteName={enemy.name} iconHeight={40} />{" "}
<span className="quest-svt-lv">
Lv. {enemy.lv}
{t("Lv.")} {enemy.lv}
{enemy.infoScript.isAddition ? (
<>
{" "}
Expand Down
8 changes: 4 additions & 4 deletions packages/db/src/Component/QuestStage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ const QuestStage = (props: { region: Region; stage: Quest.Stage }) => {
return (
<div>
<div className="my-3 mx-0 lh-3">
<b>BGM:</b> <BgmDescriptor region={props.region} bgm={stage.bgm} showLink={true} />
<b>{t("BGM")}:</b> <BgmDescriptor region={props.region} bgm={stage.bgm} showLink={true} />
{stage.fieldAis.length >= 1 ? (
<>
<br />
<b>Field AI:</b> {mergeElements(fieldAiDescriptions, " ")}
<b>{t("Field AI")}:</b> {mergeElements(fieldAiDescriptions, " ")}
</>
) : null}
{findOwnAiAllocation(stage.aiAllocations ?? []).length > 0 && (
Expand All @@ -109,7 +109,7 @@ const QuestStage = (props: { region: Region; stage: Quest.Stage }) => {
{stage.waveStartMovies.length > 0 ? (
<>
<br />
<b>Movie:</b>
<b>{t("Movie")}:</b>
<br />
<Row>
{stage.waveStartMovies.map((movie, index) => (
Expand All @@ -124,7 +124,7 @@ const QuestStage = (props: { region: Region; stage: Quest.Stage }) => {
) : null}
{stage.enemyFieldPosCount && (
<div>
<b>Number of enemies appearing at the same time:</b> {stage.enemyFieldPosCount}
<b>{t("Number of enemies appearing at the same time")}:</b> {stage.enemyFieldPosCount}
</div>
)}
{Manager.calcStringEnabled() && (
Expand Down
4 changes: 2 additions & 2 deletions packages/db/src/Page/Quest/QuestMainData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ const QuestMainData = (props: {
value:
quest.afterClear === Quest.QuestAfterClearType.REPEAT_LAST &&
props.phase === Math.max(...quest.phases)
? "True"
: "False",
? t("True")
: t("False"),
},
{
label: t("War"),
Expand Down
6 changes: 3 additions & 3 deletions packages/db/src/Page/Quest/QuestSubData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,19 +126,19 @@ const QuestSubData = ({ region, quest }: { region: Region; quest: Quest.QuestPha
hidden: quest.stages.every((stage) => stage.enemies.length === 0),
},
{
label: "Raw",
label: t("Raw"),
value: (
<Row>
<Col>
<RawDataViewer
text="Nice"
text={t("Nice")}
data={quest}
url={Api.getUrl("nice", "quest", `${quest.id}/${quest.phase}`)}
/>
</Col>
<Col>
<RawDataViewer
text="Raw"
text={t("Raw")}
data={Api.getUrl("raw", "quest", `${quest.id}/${quest.phase}`)}
/>
</Col>
Expand Down
2 changes: 1 addition & 1 deletion packages/db/src/Page/QuestPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ class QuestPage extends React.Component<IProps, IState> {
}}
>
{quest.stages.map((stage) => (
<Tab key={stage.wave} eventKey={stage.wave} title={`Stage ${stage.wave}`}>
<Tab key={stage.wave} eventKey={stage.wave} title={`${t("Stage")} ${stage.wave}`}>
<QuestStage region={this.props.region} stage={stage} />
</Tab>
))}
Expand Down
2 changes: 1 addition & 1 deletion packages/db/src/Page/Servant/ServantStatGrowth.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class ServantStatGrowth extends React.Component<IProps> {
tooltip: {
shared: true,
useHTML: true,
headerFormat: '<span style="font-size: 12px">Level <b>{point.key}</b></span><br/>',
headerFormat: `<span style="font-size: 12px">${t("Level")} <b>{point.key}</b></span><br/>`,
},
}}
/>
Expand Down
6 changes: 3 additions & 3 deletions packages/db/src/Page/Servant/ServantTraits.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ServantTraits extends React.Component<IProps> {
removedTraits = existingTraits.filter((trait) => ids.indexOf(trait.id) === -1);

if (ids.length > 0) {
diffs.push({ type: "Ascension", id: key, addedTraits, removedTraits });
diffs.push({ type: this.props.t("Ascension"), id: key, addedTraits, removedTraits });
}
}

Expand All @@ -51,15 +51,15 @@ class ServantTraits extends React.Component<IProps> {

if (ids.length === 0) continue;

diffs.push({ type: "Costume", id: key, addedTraits, removedTraits });
diffs.push({ type: this.props.t("Costume"), id: key, addedTraits, removedTraits });
}

return diffs;
}

private describeDiff(diff: TraitDiff): string {
const { t } = this.props;
if (diff.type === "Costume") {
if (diff.type === t("Costume")) {
const costumes = this.props.servant.profile?.costume;
if (costumes !== undefined) {
const costume = costumes[diff.id];
Expand Down
4 changes: 2 additions & 2 deletions packages/db/src/Page/ServantPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -203,14 +203,14 @@ class ServantPage extends React.Component<IProps, IState> {
<Row>
<Col>
<RawDataViewer
text="Nice"
text={t("Nice")}
data={servant}
url={Api.getUrl("nice", "servant", this.props.id, { lore: true, expand: true })}
/>
</Col>
<Col>
<RawDataViewer
text="Raw"
text={t("Raw")}
data={Api.getUrl("raw", "servant", this.props.id, { lore: true, expand: true })}
/>
</Col>
Expand Down
6 changes: 3 additions & 3 deletions packages/db/src/Page/WarPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -622,19 +622,19 @@ class WarPage extends React.Component<IProps, IState> {
{ label: t("Banner"), value: bannerImages },
{ label: t("BGM"), value: <>{bgmPlayers}</> },
{
label: "Raw",
label: t("Raw"),
value: (
<Row>
<Col>
<RawDataViewer
text="Nice"
text={t("Nice")}
data={war}
url={Api.getUrl("nice", "war", this.props.warId)}
/>
</Col>
<Col>
<RawDataViewer
text="Raw"
text={t("Raw")}
data={Api.getUrl("raw", "war", this.props.warId)}
/>
</Col>
Expand Down
Loading

0 comments on commit f6ed37b

Please sign in to comment.