Skip to content

Commit

Permalink
Added localizations to voice cond descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
squaresmile committed Nov 9, 2023
1 parent de1c28b commit 8e42a33
Show file tree
Hide file tree
Showing 11 changed files with 224 additions and 77 deletions.
1 change: 0 additions & 1 deletion packages/db/src/Descriptor/SvttAttrDestriptor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ import { Attribute } from "@atlasacademy/api-connector";

export const SvtAttrDescriptor = ({ attribute }: { attribute: Attribute.Attribute }) => {
const { t } = useTranslation();
// t('SvtAttribute.*')
return <>{t("SvtAttribute." + attribute)}</>;
};
94 changes: 31 additions & 63 deletions packages/db/src/Descriptor/VoiceCondTypeDescriptor.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from "react";
import { useTranslation } from "react-i18next";
import { Trans } from "react-i18next";

import { Profile, Region, Servant } from "@atlasacademy/api-connector";

Expand All @@ -16,105 +17,72 @@ interface IProps {
servants: Map<number, Servant.ServantBasic>;
}

let VoiceCondTypeDescriptor = (props: IProps) => {
let {
const VoiceCondTypeDescriptor = (props: IProps) => {
const { t } = useTranslation();
const {
cond: { condType, value, valueList },
costumes = {},
region,
} = props;
const translationKey = `VoiceCondType.${condType}`;
switch (condType) {
case VoiceCondType.BIRTH_DAY:
return <>Player birthday</>;
case VoiceCondType.COUNT_STOP:
return <>Final ascension</>;
case VoiceCondType.EVENT:
return <>An event is available</>;
case VoiceCondType.LEVEL_UP:
case VoiceCondType.LIMIT_COUNT_COMMON:
case VoiceCondType.FRIENDSHIP:
case VoiceCondType.FRIENDSHIP_ABOVE:
case VoiceCondType.FRIENDSHIP_BELOW:
case VoiceCondType.MASTER_MISSION:
case VoiceCondType.LIMIT_COUNT:
case VoiceCondType.LIMIT_COUNT_ABOVE:
case VoiceCondType.LEVEL_UP_LIMIT_COUNT:
case VoiceCondType.LEVEL_UP_LIMIT_COUNT_ABOVE:
case VoiceCondType.LEVEL_UP_LIMIT_COUNT_BELOW:
return <>{t(translationKey, { value })}</>;
case VoiceCondType.EVENT_PERIOD:
return (
<>
During event <EventDescriptor region={region} eventId={value} />
</>
);
case VoiceCondType.EVENT_END:
return (
<>
Event <EventDescriptor region={region} eventId={value} /> ended
</>
);
case VoiceCondType.EVENT_NOEND:
return (
<>
Event <EventDescriptor region={region} eventId={value} /> hasn't ended
</>
);
case VoiceCondType.EVENT_SHOP_PURCHASE:
return (
<>
Event <EventDescriptor region={region} eventId={value} /> shop purchase line
</>
);
case VoiceCondType.SPACIFIC_SHOP_PURCHASE:
return (
<>
Event <EventDescriptor region={region} eventId={value} /> specific shop purchase line
</>
);
case VoiceCondType.EVENT_MISSION_ACTION:
return (
<>
Event <EventDescriptor region={region} eventId={value} /> mission line
</>
<Trans
i18nKey={translationKey}
components={{ event: <EventDescriptor region={region} eventId={value} /> }}
/>
);
case VoiceCondType.FRIENDSHIP:
return <>Bond level {value}</>;
case VoiceCondType.FRIENDSHIP_ABOVE:
return <>Bond level {value}</>;
case VoiceCondType.FRIENDSHIP_BELOW:
return <>Bond level {value} or less</>;
case VoiceCondType.MASTER_MISSION:
return <>Master mission {value}</>;
case VoiceCondType.LEVEL_UP:
return <>Level up</>;
case VoiceCondType.LIMIT_COUNT:
return <>Ascension {value}</>;
case VoiceCondType.LIMIT_COUNT_COMMON:
return <>Ascension 2</>;
case VoiceCondType.LIMIT_COUNT_ABOVE:
return <>Ascension {value}</>;
case VoiceCondType.COSTUME:
return (
<>
Unlock costume <b>{costumes[value].name}</b>
{t(translationKey)} <b>{costumes[value].name}</b>
</>
);
case VoiceCondType.IS_NEW_WAR:
return (
<>
War <WarDescriptorId region={region} warId={value} /> Opened
</>
);
case VoiceCondType.QUEST_CLEAR:
return (
<>
Cleared <QuestDescriptor region={region} questId={value} />
</>
<Trans
i18nKey={translationKey}
components={{ war: <WarDescriptorId region={region} warId={value} /> }}
/>
);
case VoiceCondType.NOT_QUEST_CLEAR:
case VoiceCondType.QUEST_CLEAR:
return (
<>
Hasn't cleared <QuestDescriptor region={region} questId={value} />
{t(translationKey)} <QuestDescriptor region={region} questId={value} />
</>
);
case VoiceCondType.SVT_GET:
return (
<>
Presence of <ServantDescriptorMap region={region} id={value} servants={props.servants} />
{t(translationKey)} <ServantDescriptorMap region={region} id={value} servants={props.servants} />
</>
);
case VoiceCondType.SVT_GROUP:
return (
<>
{"Presence of any of the following: "}
{t(translationKey)}:{" "}
{valueList.map((value, i) => (
<span key={value}>
<ServantDescriptorMap region={region} id={value} servants={props.servants} />
Expand Down
8 changes: 4 additions & 4 deletions packages/db/src/Descriptor/VoicePlayCondDescriptor.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { useTranslation } from "react-i18next";

import { Profile, Region, Servant } from "@atlasacademy/api-connector";

import { mergeElements } from "../Helper/OutputHelper";
Expand Down Expand Up @@ -68,14 +70,12 @@ export default function VoicePlayCondDescriptor(props: {
playConds: Profile.VoicePlayCond[];
servants: Map<number, Servant.ServantBasic>;
}) {
const { t } = useTranslation();
const groups = Array.from(new Set(props.playConds.map((playCond) => playCond.condGroup)));
if (props.playConds.length > 0) {
return (
<>
<b>
Play Requirement
{groups.length > 1 ? "s (any of the following):" : ":"}
</b>
<b>{t(groups.length === 1 ? "Voice Play Requirement_one" : "Voice Play Requirement_other")}:</b>
<br />
<AllVoicePlayGroups
region={props.region}
Expand Down
1 change: 0 additions & 1 deletion packages/db/src/Page/Servant/ServantMainData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { Table } from "react-bootstrap";
import { WithTranslation, withTranslation } from "react-i18next";

import { Region, Servant } from "@atlasacademy/api-connector";
import { toTitleCase } from "@atlasacademy/api-descriptor";

import CommandCard from "../../Component/CommandCard";
import CraftEssenceReferenceDescriptor from "../../Descriptor/CraftEssenceReferenceDescriptor";
Expand Down
1 change: 0 additions & 1 deletion packages/db/src/Page/Servant/ServantVoiceLines.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Alert, ButtonGroup, Dropdown, Table } from "react-bootstrap";
import { useTranslation } from "react-i18next";

import { CraftEssence, Entity, Profile, ProfileVoiceType, Region, Servant } from "@atlasacademy/api-connector";
import { toTitleCase } from "@atlasacademy/api-descriptor";

import renderCollapsibleContent from "../../Component/CollapsibleContent";
import EntityDescriptor from "../../Descriptor/EntityDescriptor";
Expand Down
32 changes: 31 additions & 1 deletion packages/db/src/Translations/en-US/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,36 @@
"View data from the TW version": "View data from the TW version",
"Voice Actor": "Voice Actor",
"voice lines": "voice lines",
"Voice Play Requirement_one": "Play Requirement",
"Voice Play Requirement_other": "Play Requirements (any of the following)",
"VoiceCondType": {
"birthDay": "Player birthday",
"costume": "Unlock costume",
"countStop": "Final ascension",
"event": "An event is available",
"eventEnd": "Event <event></event> ended",
"eventMissionAction": "Event <event></event> mission line",
"eventNoend": "Event <event></event> hasn't ended",
"eventPeriod": "During event <event></event>",
"eventShopPurchase": "Event <event></event> shop purchase line",
"friendship": "Bond Lv. {{value}}",
"friendshipAbove": "Bond Lv. {{value}}",
"friendshipBelow": "Bond level {{value}} or less",
"isnewWar": "War <war></war> Opened",
"levelUp": "Level up",
"levelUpLimitCount": "Level up Ascension {{value}}",
"levelUpLimitCountAbove": "Level up Ascension {{value}}",
"levelUpLimitCountBelow": "Level up Ascension {{value}} or less",
"limitCount": "Ascension {{value}}",
"limitCountAbove": "Ascension {{value}}",
"limitCountCommon": "Ascension 2",
"masterMission": "Master mission {{value}}",
"notQuestClear": "Hasn't cleared",
"questClear": "Cleared",
"spacificShopPurchase": "Event <event></event> specific shop purchase line",
"svtGet": "Presence of",
"svtGroup": "Presence of any of the following"
},
"Voices": "Voices",
"War": "War",
"War Board": "War Board",
Expand All @@ -556,4 +586,4 @@
"with local timestamps": "with local timestamps",
"with UTC timestamps": "with UTC timestamps",
"Yes": "Yes"
}
}
32 changes: 31 additions & 1 deletion packages/db/src/Translations/id-ID/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,36 @@
"View data from the TW version": "Lihat data dari versi Taiwan",
"Voice Actor": "Pengisi Suara",
"voice lines": "Suara dialog",
"Voice Play Requirement_one": "Play Requirement",
"Voice Play Requirement_other": "Play Requirements (any of the following)",
"VoiceCondType": {
"birthDay": "Player birthday",
"costume": "Unlock costume",
"countStop": "Final ascension",
"event": "An event is available",
"eventEnd": "Event <event></event> ended",
"eventMissionAction": "Event <event></event> mission line",
"eventNoend": "Event <event></event> hasn't ended",
"eventPeriod": "During event <event></event>",
"eventShopPurchase": "Event <event></event> shop purchase line",
"friendship": "Bond Lv. {{value}}",
"friendshipAbove": "Bond Lv. {{value}}",
"friendshipBelow": "Bond level {{value}} or less",
"isnewWar": "War <war></war> Opened",
"levelUp": "Level up",
"levelUpLimitCount": "Level up Ascension {{value}}",
"levelUpLimitCountAbove": "Level up Ascension {{value}}",
"levelUpLimitCountBelow": "Level up Ascension {{value}} or less",
"limitCount": "Ascension {{value}}",
"limitCountAbove": "Ascension {{value}}",
"limitCountCommon": "Ascension 2",
"masterMission": "Master mission {{value}}",
"notQuestClear": "Hasn't cleared",
"questClear": "Cleared",
"spacificShopPurchase": "Event <event></event> specific shop purchase line",
"svtGet": "Presence of",
"svtGroup": "Presence of any of the following"
},
"Voices": "Dialog",
"War": "War",
"War Board": "Papan War",
Expand All @@ -556,4 +586,4 @@
"with local timestamps": "dengan zona waktu lokal",
"with UTC timestamps": "degan zona waktu zulu",
"Yes": "Ya"
}
}
30 changes: 30 additions & 0 deletions packages/db/src/Translations/ja-JP/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,36 @@
"View data from the TW version": "繁中版でデータを見る",
"Voice Actor": "CV",
"voice lines": "ボイスリスト",
"Voice Play Requirement_one": "Play Requirement",
"Voice Play Requirement_other": "Play Requirements (any of the following)",
"VoiceCondType": {
"birthDay": "誕生日",
"costume": "Unlock costume",
"countStop": "霊基再臨 4",
"event": "イベント開催中",
"eventEnd": "Event <event></event> ended",
"eventMissionAction": "Event <event></event> mission line",
"eventNoend": "Event <event></event> hasn't ended",
"eventPeriod": "During event <event></event>",
"eventShopPurchase": "Event <event></event> shop purchase line",
"friendship": "絆Lv.{{value}}",
"friendshipAbove": "絆Lv.{{value}}",
"friendshipBelow": "Bond level {{value}} or less",
"isnewWar": "War <war></war> Opened",
"levelUp": "レベルアップ",
"levelUpLimitCount": "Level up Ascension {{value}}",
"levelUpLimitCountAbove": "Level up Ascension {{value}}",
"levelUpLimitCountBelow": "Level up Ascension {{value}} or less",
"limitCount": "霊基再臨 {{value}}",
"limitCountAbove": "霊基再臨 {{value}}",
"limitCountCommon": "霊基再臨 2",
"masterMission": "Master mission {{value}}",
"notQuestClear": "Hasn't cleared",
"questClear": "Cleared",
"spacificShopPurchase": "Event <event></event> specific shop purchase line",
"svtGet": "Presence of",
"svtGroup": "Presence of any of the following"
},
"Voices": "ボイス",
"War": "イベント",
"War Board": "聖杯戦線",
Expand Down
32 changes: 31 additions & 1 deletion packages/db/src/Translations/ko-KR/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,36 @@
"View data from the TW version": "TW 버전 데이터 표기",
"Voice Actor": "성우",
"voice lines": "음성",
"Voice Play Requirement_one": "Play Requirement",
"Voice Play Requirement_other": "Play Requirements (any of the following)",
"VoiceCondType": {
"birthDay": "생일",
"costume": "Unlock costume",
"countStop": "영기재림 4",
"event": "이벤트 개최중",
"eventEnd": "Event <event></event> ended",
"eventMissionAction": "Event <event></event> mission line",
"eventNoend": "Event <event></event> hasn't ended",
"eventPeriod": "During event <event></event>",
"eventShopPurchase": "Event <event></event> shop purchase line",
"friendship": "인연 Lv.{{value}}",
"friendshipAbove": "인연 Lv.{{value}}",
"friendshipBelow": "Bond level {{value}} or less",
"isnewWar": "War <war></war> Opened",
"levelUp": "레벨 업",
"levelUpLimitCount": "Level up Ascension {{value}}",
"levelUpLimitCountAbove": "Level up Ascension {{value}}",
"levelUpLimitCountBelow": "Level up Ascension {{value}} or less",
"limitCount": "영기재림 {{value}}",
"limitCountAbove": "영기재림 {{value}}",
"limitCountCommon": "영기재림 2",
"masterMission": "Master mission {{value}}",
"notQuestClear": "Hasn't cleared",
"questClear": "Cleared",
"spacificShopPurchase": "Event <event></event> specific shop purchase line",
"svtGet": "Presence of",
"svtGroup": "Presence of any of the following"
},
"Voices": "음성",
"War": "레코드",
"War Board": "전선",
Expand All @@ -554,4 +584,4 @@
"with local timestamps": "지역 시간 기준",
"with UTC timestamps": "UTC 기준",
"Yes": "Yes"
}
}
Loading

0 comments on commit 8e42a33

Please sign in to comment.