mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 17:12:43 +00:00
refactor: utilize null coalescing
This commit is contained in:
@@ -224,9 +224,7 @@ export class SCThingTranslator {
|
|||||||
*/
|
*/
|
||||||
public translatedPropertyNames<T extends SCThing>(type: SCThingType,
|
public translatedPropertyNames<T extends SCThing>(type: SCThingType,
|
||||||
language?: keyof SCTranslations<T>): T | undefined {
|
language?: keyof SCTranslations<T>): T | undefined {
|
||||||
const targetLanguage = (typeof language !== 'undefined') ? language : this.language;
|
return this.getAllMetaFieldTranslations(type, language ?? this.language) as T;
|
||||||
|
|
||||||
return this.getAllMetaFieldTranslations(type, targetLanguage) as T;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -246,7 +244,7 @@ export class SCThingTranslator {
|
|||||||
language?: keyof SCTranslations<T>): string | undefined {
|
language?: keyof SCTranslations<T>): string | undefined {
|
||||||
const fieldTranslation = this.getMetaClassInstance(type).fieldValueTranslations[language ?? this.language]?.[field];
|
const fieldTranslation = this.getMetaClassInstance(type).fieldValueTranslations[language ?? this.language]?.[field];
|
||||||
|
|
||||||
return fieldTranslation?.[key ?? ''] ?? fieldTranslation ?? key;
|
return fieldTranslation?.[key ?? ''] ?? key ?? fieldTranslation;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user