diff --git a/frontend/src/i18n/en/translation_old.json b/frontend/src/i18n/en/translation_old.json index 0996d473..a8f93b4b 100644 --- a/frontend/src/i18n/en/translation_old.json +++ b/frontend/src/i18n/en/translation_old.json @@ -32,6 +32,9 @@ "between-landing-search": " or " } }, + "source": { + "delete-confirm": "\nAre you sure you want to delete this source?\nIf you delete this source, all its annotation will be deleted as well, including any annotations that other users may have made.\nThis cannot be undone.\n" + }, "register": { "thanks": { "begin": "Thank you for signing up. You can now " diff --git a/frontend/src/panel-external-resources/external-resources-edit-view.ts b/frontend/src/panel-external-resources/external-resources-edit-view.ts index 4134b34b..90680bf1 100644 --- a/frontend/src/panel-external-resources/external-resources-edit-view.ts +++ b/frontend/src/panel-external-resources/external-resources-edit-view.ts @@ -1,9 +1,9 @@ import { extend } from 'lodash'; -import * as i18next from 'i18next'; import explorerChannel from '../explorer/explorer-radio'; import { announceRoute } from '../explorer/utilities'; import FieldEditingPanel from '../panel-common/field-editing-panel'; +import i18nChannel from '../i18n/radio'; import ExternalResourceMultifield from './external-resources-multifield'; @@ -25,6 +25,9 @@ export default class ExternalResourcesEditView extends FieldEditingPanel { } } -extend(ExternalResourcesEditView.prototype, { - title: i18next.t('item.edit-external-title', 'Edit external resources'), -}); +(async function() { + const i18next = await i18nChannel.request('i18next'); + extend(ExternalResourcesEditView.prototype, { + title: i18next.t('item.edit-external-title', 'Edit external resources'), + }); +}()); diff --git a/frontend/src/panel-related-items/related-items-edit-view.ts b/frontend/src/panel-related-items/related-items-edit-view.ts index 4991957d..55caf453 100644 --- a/frontend/src/panel-related-items/related-items-edit-view.ts +++ b/frontend/src/panel-related-items/related-items-edit-view.ts @@ -1,9 +1,9 @@ import { extend } from 'lodash'; -import * as i18next from 'i18next'; import explorerChannel from '../explorer/explorer-radio'; import { announceRoute } from '../explorer/utilities'; import FieldEditingPanel from '../panel-common/field-editing-panel'; +import i18nChannel from '../i18n/radio'; import RelatedItemsMultifield from './related-items-edit-multifield'; @@ -25,6 +25,9 @@ export default class RelatedItemsEditor extends FieldEditingPanel { } } -extend(RelatedItemsEditor.prototype, { - title: i18next.t('item.edit-related-title', 'Edit related items'), -}); +(async function() { + const i18next = await i18nChannel.request('i18next'); + extend(RelatedItemsEditor.prototype, { + title: i18next.t('item.edit-related-title', 'Edit related items'), + }); +}()); diff --git a/frontend/src/panel-source/source-metadata-view.ts b/frontend/src/panel-source/source-metadata-view.ts index 3fddac81..2faf5363 100644 --- a/frontend/src/panel-source/source-metadata-view.ts +++ b/frontend/src/panel-source/source-metadata-view.ts @@ -1,5 +1,4 @@ import { extend } from 'lodash'; -import * as i18next from 'i18next'; import View from '../core/view'; import userChannel from '../common-user/user-radio'; @@ -7,6 +6,7 @@ import { dcterms } from '../common-rdf/ns'; import Node, { isNode } from '../common-rdf/node'; import { getLabel, getTurtleTerm } from '../utilities/linked-data-utilities'; import explorerChannel from '../explorer/explorer-radio'; +import i18nChannel from '../i18n/radio'; import metadataTemplate from './source-metadata-template'; @@ -18,11 +18,16 @@ const excludedProperties = [ 'owl:sameAs' ]; -const sourceDeletionDialog = i18next.t('source.delete-confirm', ` +let sourceDeletionDialog: string; +const dialogDefault = ` Are you sure you want to delete this source? If you delete this source, all its annotation will be deleted as well, including any annotations that other users may have made. This cannot be undone. -`); +`; +(async function() { + const i18next = await i18nChannel.request('i18next'); + sourceDeletionDialog = i18next.t('source.delete-confirm', dialogDefault); +}()); export default class MetadataView extends View { /** diff --git a/frontend/src/semantic-search/dropdown-constants.ts b/frontend/src/semantic-search/dropdown-constants.ts index 82316d4f..a24bbaf3 100644 --- a/frontend/src/semantic-search/dropdown-constants.ts +++ b/frontend/src/semantic-search/dropdown-constants.ts @@ -4,6 +4,7 @@ import * as i18next from 'i18next'; import Collection from '../core/collection'; import { xsd } from '../common-rdf/ns'; +import i18nChannel from '../i18n/radio'; /** * In this module, we define the logic operators, filters and option groups @@ -141,8 +142,7 @@ function translateCollection(collection) { collection.each(translateLabel); } -function translateAll() { +(async function() { + await i18nChannel.request('i18next'); each([logic, filters, groupLabels], translateCollection); -} - -history.once('route notfound', translateAll); +}()); diff --git a/frontend/src/snippet/snippet-view.ts b/frontend/src/snippet/snippet-view.ts index d95cfb7a..4b4dec50 100644 --- a/frontend/src/snippet/snippet-view.ts +++ b/frontend/src/snippet/snippet-view.ts @@ -1,13 +1,13 @@ import { extend } from 'lodash'; -import * as i18next from 'i18next'; import View from '../core/view'; import FlatItem from '../common-adapters/flat-item-model'; +import i18nChannel from '../i18n/radio'; import snippetTemplate from './snippet-template'; export default class SnippetView extends View { - ellipsis = i18next.t('interpunction.paragraph-ellipsis', '(...)'); + ellipsis: string; trimmedTitle: boolean; trimmedStart: boolean; trimmedEnd: boolean; @@ -138,3 +138,8 @@ extend(SnippetView.prototype, { className: 'snippet', template: snippetTemplate, }); + +(async function() { + const i18next = await i18nChannel.request('i18next'); + SnippetView.prototype.ellipsis = i18next.t('interpunction.paragraph-ellipsis', '(...)'); +}());