Skip to content

Commit

Permalink
Add i18next.t calls to the source-related views (#451 #37)
Browse files Browse the repository at this point in the history
Adding these changes here as part of #517 instead of in #513 because
the latter is outdated compared to the former with regard to these
views. This is a follow-up on the previous commit, which regarded the
templates.

@JeltevanBoheemen FYI
  • Loading branch information
jgonggrijp committed Mar 16, 2022
1 parent 731c44f commit d7d0d31
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions frontend/src/source-metadata/source-metadata-view.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { extend } from 'lodash';
import { ViewOptions as BaseOpt } from 'backbone';
import * as i18next from 'i18next';

import { rdfs, sourceOntology as sourceNS, sourceOntologyPrefix } from '../common-rdf/ns';
import ldChannel from '../common-rdf/radio';
Expand Down Expand Up @@ -83,23 +84,23 @@ export default class SourceMetadataView extends CompositeView {
model: this.getNode('datePublished'),
name: 'datePublished',
required: true,
label: 'Publication date',
additionalHelpText: `<a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO formatted
date with optional time and timezone</a>, or free-form text`,
label: i18next.t('publication_date', 'Publication date'),
additionalHelpText: i18next.t('publication_date_help', `<a href="https://en.wikipedia.org/wiki/ISO_8601" target="_blank">ISO formatted
date with optional time and timezone</a>, or free-form text`),
readonly: this.readonly
});
this.creationDateField = new DateField({
model: this.getNode('dateCreated'),
name: 'dateCreated',
label: 'Creation date (optional)',
additionalHelpText: 'If known and different from publishing date, specify creation date.',
readonly: this.readonly
label: i18next.t('creation_date_opt', 'Creation date (optional)'),
additionalHelpText: i18next.t('creation_date_help', 'If known and different from publishing date, specify creation date.'),
readonly: this.readonly
});
this.retrievalDateField = new DateField({
model: this.getNode('dateRetrieved'),
name: 'dateRetrieved',
label: 'Retrieval date (optional)',
additionalHelpText: 'Date (and optional time) at which the source was accessed or retrieved.',
label: i18next.t('retrieval_date_opt', 'Retrieval date (optional)'),
additionalHelpText: i18next.t('retrieval_date_help', 'Date (and optional time) at which the source was accessed or retrieved.'),
readonly: this.readonly
});
this.render();
Expand Down Expand Up @@ -142,7 +143,7 @@ export default class SourceMetadataView extends CompositeView {
const value = this.$(`[name='` + `${changedField}` + `']`).val();
const existingValue = this.model.get(sourceNS(changedField));
if (existingValue !== [value]) {
this.trigger('valueChanged', changedField, value);
this.trigger('valueChanged', changedField, value);
}
}
}
Expand All @@ -157,4 +158,4 @@ extend(SourceMetadataView.prototype, {
events: {
'change .input': 'updateModel'
}
})
})

0 comments on commit d7d0d31

Please sign in to comment.