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,10 +12,42 @@
* 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 {SCThing} from '../Thing';
import {SCThing, SCThingMeta} from '../Thing';
import {SCMetaTranslations} from '../types/i18n';
import {SCInPlace} from '../types/Places';
/**
* A thing that is or happens in a place
*/
export interface SCThingInPlace extends SCThing, SCInPlace {}
/**
* Meta information about thing in a place
*/
export class SCThingInPlaceMeta extends SCThingMeta implements SCMetaTranslations<SCThingInPlace> {
/**
* Translations of fields
*/
fieldTranslations = {
de: {
... SCThingMeta.getInstance().fieldTranslations.de,
inPlace: 'Ort',
},
en: {
... SCThingMeta.getInstance().fieldTranslations.en,
inPlace: 'location',
},
};
/**
* Translations of values of fields
*/
fieldValueTranslations = {
de: {
... SCThingMeta.getInstance().fieldValueTranslations.de,
},
en: {
... SCThingMeta.getInstance().fieldValueTranslations.en,
},
};
}