diff --git a/package-lock.json b/package-lock.json index 65ae11b8..c714692e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,8 @@ "@mcschema/java-1.18.2": "^0.1.17", "@mcschema/java-1.19": "^0.1.41", "@mcschema/java-1.19.3": "^0.0.3", - "@mcschema/locales": "^0.1.73", + "@mcschema/java-1.19.4": "^0.0.2", + "@mcschema/locales": "^0.1.74", "@zip.js/zip.js": "^2.4.5", "brace": "^0.11.1", "buffer": "^6.0.3", @@ -557,9 +558,9 @@ "integrity": "sha512-VMOxsWh/QDwrxPsgkSQnuZ+8mfNy1OTjzzUdLBvvZtpahwPTHTeVZ51RZRqO4xfKVrR+btIPA8D01IL3xeG66w==" }, "node_modules/@mcschema/core": { - "version": "0.12.37", - "resolved": "https://registry.npmjs.org/@mcschema/core/-/core-0.12.37.tgz", - "integrity": "sha512-/UhbUXkc+POKBMv94UNXk2ZQOvDoQ7j/72cNzNhhjr+ZOj+BSYLH3aUVVWDP4kOWqSKVFXCO6MKP9+gAaKjfhg==" + "version": "0.12.38", + "resolved": "https://registry.npmjs.org/@mcschema/core/-/core-0.12.38.tgz", + "integrity": "sha512-B3xgyc5GgVW1RXFNSkb4DMqBT27l8B2U8sXIV3bpEGCW29PkPKmH5HTw9Zo8+Bw0pqrT7cB2mkrXepsTY6B1gQ==" }, "node_modules/@mcschema/java-1.15": { "version": "0.2.6", @@ -617,10 +618,18 @@ "@mcschema/core": "^0.12.37" } }, + "node_modules/@mcschema/java-1.19.4": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@mcschema/java-1.19.4/-/java-1.19.4-0.0.2.tgz", + "integrity": "sha512-8xfxsGNCOjasoI4JnECTjwaDZVfN7FnVYdrAyneF86VAmU9K//p+VGcMpA3Y1HlPfE7jnr0Eec5cxqj4+NRo5g==", + "dependencies": { + "@mcschema/core": "^0.12.38" + } + }, "node_modules/@mcschema/locales": { - "version": "0.1.73", - "resolved": "https://registry.npmjs.org/@mcschema/locales/-/locales-0.1.73.tgz", - "integrity": "sha512-N6vxZtW3ZoWmj7KkwvFSPMaXY6QyCB2qbeZKECXSCr9EFsERr05AI/RAIzD6/LVauIJTT92oYkNQDqAmbn1upA==" + "version": "0.1.74", + "resolved": "https://registry.npmjs.org/@mcschema/locales/-/locales-0.1.74.tgz", + "integrity": "sha512-lTYO8u5HQMSFyP/P6vGqSqSmRtzgkNUVAWZ9aPcqcGer1LcNliofbUVuilKZ9pqGJf6aEqASqUSHss05LfsgKw==" }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", @@ -5694,9 +5703,9 @@ "integrity": "sha512-VMOxsWh/QDwrxPsgkSQnuZ+8mfNy1OTjzzUdLBvvZtpahwPTHTeVZ51RZRqO4xfKVrR+btIPA8D01IL3xeG66w==" }, "@mcschema/core": { - "version": "0.12.37", - "resolved": "https://registry.npmjs.org/@mcschema/core/-/core-0.12.37.tgz", - "integrity": "sha512-/UhbUXkc+POKBMv94UNXk2ZQOvDoQ7j/72cNzNhhjr+ZOj+BSYLH3aUVVWDP4kOWqSKVFXCO6MKP9+gAaKjfhg==" + "version": "0.12.38", + "resolved": "https://registry.npmjs.org/@mcschema/core/-/core-0.12.38.tgz", + "integrity": "sha512-B3xgyc5GgVW1RXFNSkb4DMqBT27l8B2U8sXIV3bpEGCW29PkPKmH5HTw9Zo8+Bw0pqrT7cB2mkrXepsTY6B1gQ==" }, "@mcschema/java-1.15": { "version": "0.2.6", @@ -5754,10 +5763,18 @@ "@mcschema/core": "^0.12.37" } }, + "@mcschema/java-1.19.4": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/@mcschema/java-1.19.4/-/java-1.19.4-0.0.2.tgz", + "integrity": "sha512-8xfxsGNCOjasoI4JnECTjwaDZVfN7FnVYdrAyneF86VAmU9K//p+VGcMpA3Y1HlPfE7jnr0Eec5cxqj4+NRo5g==", + "requires": { + "@mcschema/core": "^0.12.38" + } + }, "@mcschema/locales": { - "version": "0.1.73", - "resolved": "https://registry.npmjs.org/@mcschema/locales/-/locales-0.1.73.tgz", - "integrity": "sha512-N6vxZtW3ZoWmj7KkwvFSPMaXY6QyCB2qbeZKECXSCr9EFsERr05AI/RAIzD6/LVauIJTT92oYkNQDqAmbn1upA==" + "version": "0.1.74", + "resolved": "https://registry.npmjs.org/@mcschema/locales/-/locales-0.1.74.tgz", + "integrity": "sha512-lTYO8u5HQMSFyP/P6vGqSqSmRtzgkNUVAWZ9aPcqcGer1LcNliofbUVuilKZ9pqGJf6aEqASqUSHss05LfsgKw==" }, "@nodelib/fs.scandir": { "version": "2.1.5", diff --git a/package.json b/package.json index e09d95c4..30cd4582 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,8 @@ "@mcschema/java-1.18.2": "^0.1.17", "@mcschema/java-1.19": "^0.1.41", "@mcschema/java-1.19.3": "^0.0.3", - "@mcschema/locales": "^0.1.73", + "@mcschema/java-1.19.4": "^0.0.2", + "@mcschema/locales": "^0.1.74", "@zip.js/zip.js": "^2.4.5", "brace": "^0.11.1", "buffer": "^6.0.3", diff --git a/src/app/components/TextComponent.tsx b/src/app/components/TextComponent.tsx index fffabbeb..cc082f70 100644 --- a/src/app/components/TextComponent.tsx +++ b/src/app/components/TextComponent.tsx @@ -14,6 +14,7 @@ interface StyleData { interface PartData extends StyleData { text?: string, translate?: string, + fallback?: string, with?: string[], } @@ -110,19 +111,19 @@ const TextColorKeys = Object.keys(TextColors) function TextPart({ part, shadow, lang }: { part: PartData, shadow?: boolean, lang: Record }) { if (part.translate) { - const str = resolveTranslate(part.translate, part.with, lang) + const str = resolveTranslate(part.translate, part.fallback, part.with, lang) return {str} } return {part.text} } -function resolveTranslate(translate: string, with_: any[] | undefined, lang: Record): string { - const str = lang[translate] +function resolveTranslate(translate: string, fallback: string | undefined, with_: any[] | undefined, lang: Record): string { + const str = lang[translate] ?? fallback if (typeof str !== 'string') return translate const params = with_?.map((c): string => { if (typeof c === 'string' || typeof c === 'number') return `${c}` if (c.text) return c.text - if (c.translate) return resolveTranslate(c.translate, c.with, lang) + if (c.translate) return resolveTranslate(c.translate, c.fallback, c.with, lang) return '' }) return replaceTranslation(str, params) diff --git a/src/app/services/Schemas.ts b/src/app/services/Schemas.ts index e9f5c39f..ba16a619 100644 --- a/src/app/services/Schemas.ts +++ b/src/app/services/Schemas.ts @@ -5,7 +5,7 @@ import { initPartners } from '../partners/index.js' import { message } from '../Utils.js' import { fetchData } from './DataFetcher.js' -export const VersionIds = ['1.15', '1.16', '1.17', '1.18', '1.18.2', '1.19', '1.19.3'] as const +export const VersionIds = ['1.15', '1.16', '1.17', '1.18', '1.18.2', '1.19', '1.19.3', '1.19.4'] as const export type VersionId = typeof VersionIds[number] export const DEFAULT_VERSION: VersionId = '1.19.3' @@ -47,6 +47,7 @@ const versionGetter: { '1.18.2': () => import('@mcschema/java-1.18.2'), 1.19: () => import('@mcschema/java-1.19'), '1.19.3': () => import('@mcschema/java-1.19.3'), + '1.19.4': () => import('@mcschema/java-1.19.4'), } export let CachedDecorator: INode diff --git a/src/config.json b/src/config.json index ae36542f..053ff225 100644 --- a/src/config.json +++ b/src/config.json @@ -88,8 +88,13 @@ }, { "id": "1.19.3", - "dynamic": true, + "ref": "1.19.3", "pack_format": 10 + }, + { + "id": "1.19.4", + "dynamic": true, + "pack_format": 11 } ], "generators": [