refactor: change meta class structure to include types.

Introduce requiredness of translations via implemented interface.
This commit is contained in:
Rainer Killinger
2019-02-06 14:21:46 +01:00
committed by Karl-Philipp Wulfert
parent 90e3d22399
commit 62975b9ded
32 changed files with 1060 additions and 246 deletions

View File

@@ -13,8 +13,13 @@
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCAcademicTermWithoutReferences} from '../base/AcademicTerm';
import {SCThingWithCategoriesSpecificValues, SCThingWithCategoriesWithoutReferences} from '../base/ThingWithCategories';
import {
SCThingWithCategoriesSpecificValues,
SCThingWithCategoriesWithoutReferences,
SCThingWithCategoriesWithoutReferencesMeta,
} from '../base/ThingWithCategories';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations} from '../types/i18n';
/**
* A catalog without references
@@ -62,10 +67,39 @@ export interface SCCatalog extends SCCatalogWithoutReferences {
type: SCThingType.Catalog;
}
/**
* Catalog meta data
*/
export class SCCatalogMeta extends SCThingMeta {
/**
* Catalog meta data
*/
export class SCCatalogMeta extends SCThingMeta implements SCMetaTranslations<SCCatalog> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.de,
},
en: {
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
SCThingWithCategoriesSpecificValues>().fieldTranslations.en,
},
};
/**
* Translations of values of fields
*/
fieldValueTranslations = {
de: {
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.de,
type: 'Verzeichnis',
},
en: {
... SCThingWithCategoriesWithoutReferencesMeta.getInstance<SCCatalogCategories,
SCThingWithCategoriesSpecificValues>().fieldValueTranslations.en,
type: SCThingType.Catalog,
},
};
}
/**