* Synchronous lookup * @param {string} stringID * @returns {string} Translated text
(stringID)
| 480 | * @returns {string} Translated text |
| 481 | */ |
| 482 | syncStringLookup(stringID) { |
| 483 | // Note: this could fail depending on when it's used. |
| 484 | if ( stringID === null ) { return null } |
| 485 | |
| 486 | let possibleValue = null |
| 487 | const lcStringID = stringID.toLowerCase() |
| 488 | |
| 489 | possibleValue ??= this.#iconOverride(lcStringID) |
| 490 | possibleValue ??= this.#translatorStrings.get(this.#currentLocale)?.get(lcStringID) |
| 491 | possibleValue ??= this.#translatorStrings.get('en')?.get(lcStringID) |
| 492 | possibleValue ??= `__${lcStringID}__` |
| 493 | |
| 494 | if ( this.#debug ) { |
| 495 | if ( possibleValue === '' ) { this.#log.info(`Empty translation string : ${this.#currentLocale} :: ${lcStringID}`) } |
| 496 | if ( possibleValue === `__${lcStringID}__` ) { this.#log.info(`Unknown translation string : ${this.#currentLocale} :: ${lcStringID}`) } |
| 497 | } |
| 498 | return possibleValue |
| 499 | } |
| 500 | |
| 501 | /** |
| 502 | * Retrieve MA string |
no test coverage detected