mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-08-21 14:59:26 +02:00
Rename verifyLang
to hasAllLocalizedSprite
and update tsdoc
This commit is contained in:
parent
d519e61b48
commit
0a01b6f086
@ -230,7 +230,7 @@ export class LoadingScene extends SceneBase {
|
|||||||
// Get current lang and load the types atlas for it. English will only load types while all other languages will load types and types_<lang>
|
// Get current lang and load the types atlas for it. English will only load types while all other languages will load types and types_<lang>
|
||||||
const lang = i18next.resolvedLanguage;
|
const lang = i18next.resolvedLanguage;
|
||||||
if (lang !== "en") {
|
if (lang !== "en") {
|
||||||
if (Utils.verifyLang(lang)) {
|
if (Utils.hasAllLocalizedSprites(lang)) {
|
||||||
this.loadAtlas(`statuses_${lang}`, "");
|
this.loadAtlas(`statuses_${lang}`, "");
|
||||||
this.loadAtlas(`types_${lang}`, "");
|
this.loadAtlas(`types_${lang}`, "");
|
||||||
} else {
|
} else {
|
||||||
|
11
src/utils.ts
11
src/utils.ts
@ -466,14 +466,13 @@ export function hslToHex(h: number, s: number, l: number): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function returns `true` if the current lang is available for some functions.
|
* This function returns `true` if all localized images used by the game have been added for the given language.
|
||||||
|
*
|
||||||
* If the lang is not in the function, it usually means that lang is going to use the default english version
|
* If the lang is not in the function, it usually means that lang is going to use the default english version
|
||||||
*
|
*
|
||||||
* This function is used in:
|
* English itself counts as not available
|
||||||
* - `summary-ui-handler.ts`: If the lang is not available, it'll use `types.json` (english).
|
|
||||||
* English itself counts as not available
|
|
||||||
*/
|
*/
|
||||||
export function verifyLang(lang?: string): boolean {
|
export function hasAllLocalizedSprites(lang?: string): boolean {
|
||||||
// IMPORTANT - ONLY ADD YOUR LANG HERE IF YOU'VE ALREADY ADDED ALL THE NECESSARY IMAGES
|
// IMPORTANT - ONLY ADD YOUR LANG HERE IF YOU'VE ALREADY ADDED ALL THE NECESSARY IMAGES
|
||||||
if (!lang) {
|
if (!lang) {
|
||||||
lang = i18next.resolvedLanguage;
|
lang = i18next.resolvedLanguage;
|
||||||
@ -602,7 +601,7 @@ export function toDmgValue(value: number, minValue: number = 1) {
|
|||||||
* @returns the localized sprite key
|
* @returns the localized sprite key
|
||||||
*/
|
*/
|
||||||
export function getLocalizedSpriteKey(baseKey: string) {
|
export function getLocalizedSpriteKey(baseKey: string) {
|
||||||
return `${baseKey}${verifyLang(i18next.resolvedLanguage) ? `_${i18next.resolvedLanguage}` : ""}`;
|
return `${baseKey}${hasAllLocalizedSprites(i18next.resolvedLanguage) ? `_${i18next.resolvedLanguage}` : ""}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user