refactor: align SCCreativeWork to schema.org spec

This commit is contained in:
Rainer Killinger
2021-02-01 13:58:09 +01:00
parent d5f3d71a41
commit 8b1b3444fd
3 changed files with 18 additions and 13 deletions

View File

@@ -12,7 +12,7 @@
* 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 {SCLanguage, SCMetaTranslations, SCTranslations} from '../../general/i18n';
import {SCLanguageCode, SCMetaTranslations, SCTranslations} from '../../general/i18n';
import {SCISO8601Date} from '../../general/time';
import {SCOrganizationWithoutReferences} from '../organization';
import {SCPersonWithoutReferences} from '../person';
@@ -30,6 +30,12 @@ import {
*/
export interface SCCreativeWorkWithoutReferences
extends SCThingWithoutReferences, SCThingThatCanBeOfferedWithoutReferences {
/**
* Languages this creative work is available in
*/
availableLanguages?: SCLanguageCode[];
/**
* Date the creative work was published
*
@@ -38,9 +44,11 @@ export interface SCCreativeWorkWithoutReferences
datePublished?: SCISO8601Date;
/**
* List of languages this creative work is written/recorded/... in
* Languages this creative work is written/recorded/... in
*
* @filterable
*/
inLanguages?: SCLanguage[];
inLanguage?: SCLanguageCode;
/**
* Keywords of the creative work
@@ -103,9 +111,10 @@ export class SCCreativeWorkMeta
de: {
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.de,
...SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.de,
authors: 'Authoren',
authors: 'Autoren',
availableLanguages: 'verfügbare Übersetzungen',
datePublished: 'Veröffentlichungsdatum',
inLanguages: 'verfügbare Übersetzungen',
inLanguage: 'Inhaltssprache',
keywords: 'Schlagwörter',
publishers: 'Verleger',
},
@@ -113,8 +122,9 @@ export class SCCreativeWorkMeta
...SCThingMeta.getInstance<SCThingMeta>().fieldTranslations.en,
...SCThingThatCanBeOfferedMeta.getInstance().fieldTranslations.en,
authors: 'authors',
availableLanguages: 'available languages',
datePublished: 'release date',
inLanguages: 'available Languages',
inLanguage: 'content language',
keywords: 'keywords',
publishers: 'publishers',
},

View File

@@ -267,7 +267,7 @@ export class SCThingTranslator {
return this.deeptranslate((objTranslatedFromCache as any)[key]);
}
}
const objTranslated = this.translateWholeThingDestructively(clone(obj));
const objTranslated = this.translateThingInPlaceDestructively(clone(obj));
this.cache.putObject(objTranslated);
this.sourceCache.putObject(thing);

View File

@@ -21,12 +21,7 @@
"name": "Symposion Publishing"
}
],
"inLanguages": [
{
"name": "german",
"code": "de"
}
],
"inLanguage": "de",
"bookEdition": "2., überarb. u. erw. Aufl.",
"isbn": "3936608776",
"numberOfPages": 537,