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

@@ -12,8 +12,9 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {SCAcademicTermWithoutReferences} from '../base/AcademicTerm';
import {SCAcademicTermWithoutReferences, SCAcademicTermWithoutReferencesMeta} from '../base/AcademicTerm';
import {SCThingMeta, SCThingType} from '../Thing';
import {SCMetaTranslations} from '../types/i18n';
/**
* A semester without references
@@ -45,17 +46,37 @@ export interface SCSemester extends SCSemesterWithoutReferences {
}
/**
* Semester meta data
* Meta information about a semester
*/
export class SCSemesterMeta extends SCThingMeta {
static fieldTranslations = {
...SCThingMeta.fieldTranslations,
export class SCSemesterMeta extends SCThingMeta implements SCMetaTranslations<SCSemester> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
... SCAcademicTermWithoutReferencesMeta.getInstance().fieldTranslations.de,
acronym: 'Abkürzung',
endDate: 'Ende',
eventsEndDate: 'Vorlesungsschluss',
eventsStartDate: 'Vorlesungsbeginn',
startDate: 'Beginn',
},
en: {
... SCAcademicTermWithoutReferencesMeta.getInstance().fieldTranslations.en,
},
};
/**
* Translations of values of fields
*/
fieldValueTranslations = {
de: {
... SCAcademicTermWithoutReferencesMeta.getInstance().fieldValueTranslations.de,
type: 'Semester',
},
en: {
... SCAcademicTermWithoutReferencesMeta.getInstance().fieldValueTranslations.en,
type: SCThingType.Semester,
},
};
}