(object: string | Record<string, unknown> | null = null)
| 1305 | } |
| 1306 | |
| 1307 | static script (object: string | Record<string, unknown> | null = null): unknown { |
| 1308 | const language = this.preference ('Language') as string; |
| 1309 | |
| 1310 | if (typeof object === 'object' && object !== null) { |
| 1311 | this._script = Object.assign ({}, this._script, object); |
| 1312 | } else { |
| 1313 | let script: Record<string, unknown> = this._script; |
| 1314 | |
| 1315 | if (this.setting ('MultiLanguage') === true) { |
| 1316 | if (!Object.keys (script).includes (language)) { |
| 1317 | // First check if the label exists in the current script |
| 1318 | FancyError.show ('engine:script:language_not_found', { |
| 1319 | language: language, |
| 1320 | multiLanguageSetting: 'The Multilanguage Setting is set to '+ this.setting ('MultiLanguage'), |
| 1321 | availableLanguages: Object.keys (script) |
| 1322 | }); |
| 1323 | } else { |
| 1324 | script = script[language] as Record<string, unknown>; |
| 1325 | } |
| 1326 | } |
| 1327 | |
| 1328 | if (typeof object === 'string') { |
| 1329 | script = script[object] as Record<string, unknown>; |
| 1330 | } |
| 1331 | |
| 1332 | return script; |
| 1333 | } |
| 1334 | } |
| 1335 | |
| 1336 | static label (): unknown[]; |
| 1337 | static label (key: string): unknown; |
no test coverage detected