feat(i18n): integrate i18next for internationalization support and add initial translation setup

This commit is contained in:
kever
2026-02-17 00:11:42 +08:00
parent dc73f6f6af
commit 9395f9d3af
8 changed files with 1081 additions and 445 deletions

View File

@@ -1,5 +1,43 @@
export namespace model {
export class BonusStats {
atk: number;
def: number;
hp: number;
atkPct: number;
defPct: number;
hpPct: number;
spd: number;
cr: number;
cd: number;
eff: number;
res: number;
finalAtkMultiplier: number;
finalDefMultiplier: number;
finalHpMultiplier: number;
static createFrom(source: any = {}) {
return new BonusStats(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.atk = source["atk"];
this.def = source["def"];
this.hp = source["hp"];
this.atkPct = source["atkPct"];
this.defPct = source["defPct"];
this.hpPct = source["hpPct"];
this.spd = source["spd"];
this.cr = source["cr"];
this.cd = source["cd"];
this.eff = source["eff"];
this.res = source["res"];
this.finalAtkMultiplier = source["finalAtkMultiplier"];
this.finalDefMultiplier = source["finalDefMultiplier"];
this.finalHpMultiplier = source["finalHpMultiplier"];
}
}
export class CaptureStatus {
is_capturing: boolean;
status: string;
@@ -16,6 +54,36 @@ export namespace model {
this.error = source["error"];
}
}
export class HeroTemplate {
code: string;
name: string;
baseAtk: number;
baseDef: number;
baseHp: number;
baseSpd: number;
baseCr: number;
baseCd: number;
baseEff: number;
baseRes: number;
static createFrom(source: any = {}) {
return new HeroTemplate(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.code = source["code"];
this.name = source["name"];
this.baseAtk = source["baseAtk"];
this.baseDef = source["baseDef"];
this.baseHp = source["baseHp"];
this.baseSpd = source["baseSpd"];
this.baseCr = source["baseCr"];
this.baseCd = source["baseCd"];
this.baseEff = source["baseEff"];
this.baseRes = source["baseRes"];
}
}
export class NetworkInterface {
name: string;
description: string;
@@ -34,6 +102,222 @@ export namespace model {
this.is_loopback = source["is_loopback"];
}
}
export class OptimizeStat {
type: string;
value: number;
static createFrom(source: any = {}) {
return new OptimizeStat(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.type = source["type"];
this.value = source["value"];
}
}
export class OptimizeItem {
id: any;
gear: string;
set: string;
f: string;
main?: OptimizeStat;
substats?: OptimizeStat[];
static createFrom(source: any = {}) {
return new OptimizeItem(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.id = source["id"];
this.gear = source["gear"];
this.set = source["set"];
this.f = source["f"];
this.main = this.convertValues(source["main"], OptimizeStat);
this.substats = this.convertValues(source["substats"], OptimizeStat);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class StatRange {
min?: number;
max?: number;
static createFrom(source: any = {}) {
return new StatRange(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.min = source["min"];
this.max = source["max"];
}
}
export class SetFilters {
set1: string[];
set2: string[];
set3: string[];
static createFrom(source: any = {}) {
return new SetFilters(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.set1 = source["set1"];
this.set2 = source["set2"];
this.set3 = source["set3"];
}
}
export class OptimizeRequest {
heroId: string;
setFilters: SetFilters;
statFilters: Record<string, StatRange>;
mainStatFilters: Record<string, string>;
weightValues: Record<string, number>;
bonusStats: BonusStats;
maxItemsPerSlot: number;
maxCombos: number;
maxResults: number;
static createFrom(source: any = {}) {
return new OptimizeRequest(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.heroId = source["heroId"];
this.setFilters = this.convertValues(source["setFilters"], SetFilters);
this.statFilters = this.convertValues(source["statFilters"], StatRange, true);
this.mainStatFilters = source["mainStatFilters"];
this.weightValues = source["weightValues"];
this.bonusStats = this.convertValues(source["bonusStats"], BonusStats);
this.maxItemsPerSlot = source["maxItemsPerSlot"];
this.maxCombos = source["maxCombos"];
this.maxResults = source["maxResults"];
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class OptimizeResult {
key: string;
sets: string;
atk: number;
def: number;
hp: number;
spd: number;
cr: number;
cd: number;
acc: number;
res: number;
score: number;
items: OptimizeItem[];
static createFrom(source: any = {}) {
return new OptimizeResult(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.key = source["key"];
this.sets = source["sets"];
this.atk = source["atk"];
this.def = source["def"];
this.hp = source["hp"];
this.spd = source["spd"];
this.cr = source["cr"];
this.cd = source["cd"];
this.acc = source["acc"];
this.res = source["res"];
this.score = source["score"];
this.items = this.convertValues(source["items"], OptimizeItem);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class OptimizeResponse {
totalCombos: number;
results: OptimizeResult[];
static createFrom(source: any = {}) {
return new OptimizeResponse(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.totalCombos = source["totalCombos"];
this.results = this.convertValues(source["results"], OptimizeResult);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class ParsedResult {
items: any[];
heroes: any[];
@@ -64,6 +348,7 @@ export namespace model {
this.created_at = source["created_at"];
}
}
}