mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-20 08:33:11 +00:00
refactor: change meta class structure to include types.
Introduce requiredness of translations via implemented interface.
This commit is contained in:
committed by
Karl-Philipp Wulfert
parent
90e3d22399
commit
62975b9ded
@@ -14,12 +14,13 @@
|
||||
*/
|
||||
import {
|
||||
SCCreativeWork,
|
||||
SCCreativeWorkMeta,
|
||||
SCCreativeWorkTranslatableProperties,
|
||||
SCCreativeWorkWithoutReferences,
|
||||
} from '../base/CreativeWork';
|
||||
import {SCThingThatCanBeOfferedTranslatableProperties} from '../base/ThingThatCanBeOffered';
|
||||
import {SCThingMeta, SCThingType} from '../Thing';
|
||||
import {SCTranslations} from '../types/i18n';
|
||||
import {SCMetaTranslations, SCTranslations} from '../types/i18n';
|
||||
import {SCISO8601Date} from '../types/Time';
|
||||
|
||||
/**
|
||||
@@ -69,12 +70,6 @@ export interface SCMessage extends SCCreativeWork, SCMessageWithoutReferences {
|
||||
type: SCThingType.Message;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about a message
|
||||
*/
|
||||
export class SCMessageMeta extends SCThingMeta {
|
||||
}
|
||||
|
||||
/**
|
||||
* Audiences for messages
|
||||
*/
|
||||
@@ -93,3 +88,34 @@ export interface SCMessageTranslatableProperties
|
||||
*/
|
||||
message?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Meta information about messages
|
||||
*/
|
||||
export class SCMessageMeta extends SCThingMeta implements SCMetaTranslations<SCMessage> {
|
||||
/**
|
||||
* Translations of fields
|
||||
*/
|
||||
fieldTranslations = {
|
||||
de: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldTranslations.de,
|
||||
},
|
||||
en: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldTranslations.en,
|
||||
},
|
||||
};
|
||||
|
||||
/**
|
||||
* Translations of values of fields
|
||||
*/
|
||||
fieldValueTranslations = {
|
||||
de: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldValueTranslations.de,
|
||||
type: 'Nachricht',
|
||||
},
|
||||
en: {
|
||||
... SCCreativeWorkMeta.getInstance().fieldValueTranslations.en,
|
||||
type: SCThingType.Message,
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user