mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-04 04:22:50 +00:00
refactor: simplify use of translatedPropertyNames
This commit is contained in:
@@ -218,15 +218,15 @@ export class SCThingTranslator {
|
||||
* All the values will be set to the known translations of the property/key name
|
||||
* @example
|
||||
* const translatedMetaDish = translator.translatedPropertyNames<SCCourseOfStudies>(SCThingType.CourseOfStudies);
|
||||
* @param thing The thing whose property names will be translated
|
||||
* @param type The type whose property names will be translated
|
||||
* @param language The language all property names will be translated to
|
||||
* @returns An object with the properties of the SCThingType where the values are the known property tranlations
|
||||
*/
|
||||
public translatedPropertyNames<T extends SCThing>(thing: T,
|
||||
public translatedPropertyNames<T extends SCThing>(type: SCThingType,
|
||||
language?: keyof SCTranslations<T>): T | undefined {
|
||||
const targetLanguage = (typeof language !== 'undefined') ? language : this.language;
|
||||
|
||||
return this.getAllMetaFieldTranslations(thing.type, targetLanguage) as T;
|
||||
return this.getAllMetaFieldTranslations(type, targetLanguage) as T;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user