Skip to content

Commit

Permalink
Add i18next.t calls in more places (#451)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgonggrijp committed Mar 16, 2022
1 parent e440981 commit 1236e78
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 10 deletions.
3 changes: 2 additions & 1 deletion frontend/src/explorer/explorer-event-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,10 +311,11 @@ class ExplorerEventController {
landing = false;
}
const title = `${landing ? 'My' : 'Sample'} ${queryMode}`;
const i18nKey = title.toLowerCase().replace(' ', '_');
const endpoint = `${queryMode}:${landing ? 'user' : 'sample'}`;
const collection = new FlatItemCollection(ldChannel.request(endpoint));
const browsePanel = new SearchResultListPanel({
title,
title: i18next.t(i18nKey, title),
collection,
selectable: false,
});
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/item-metadata/item-metadata-view.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { ViewOptions as BaseOpt } from 'backbone';
import { extend } from 'lodash';
import View from '../core/view';
import * as i18next from 'i18next';

import View from '../core/view';
import Node from '../common-rdf/node';

import itemMetadataTemplate from './item-metadata-template';
Expand All @@ -28,7 +29,7 @@ export default class ItemMetadataView extends View<Node> {
}

initialize(options: ViewOptions): void {
this.title = options.title || 'Item metadata';
this.title = options.title || i18next.t('item_metadata', 'Item metadata');
this.render().listenTo(this.model, 'change', this.render);
}

Expand Down
3 changes: 2 additions & 1 deletion frontend/src/panel-annotation/annotation-view.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { extend, includes } from 'lodash';
import * as i18next from 'i18next';

import { CompositeView } from '../core/view';
import Node, { isNode } from '../common-rdf/node';
Expand Down Expand Up @@ -49,7 +50,7 @@ export default class AnnotationView extends CompositeView<FlatItem> {
if (annotation) {
this.annotationMetadataView = new ItemMetadataView({
model: annotation,
title: 'Annotation metadata'
title: i18next.t('annotation_metadata', 'Annotation metadata')
});
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { extend } from 'lodash';
import * as i18next from 'i18next';

import explorerChannel from '../explorer/explorer-radio';
import { announceRoute } from '../explorer/utilities';
Expand All @@ -25,5 +26,5 @@ export default class ExternalResourcesEditView extends FieldEditingPanel {
}

extend(ExternalResourcesEditView.prototype, {
title: 'Edit external resources',
title: i18next.t('edit_external_resources', 'Edit external resources'),
});
3 changes: 2 additions & 1 deletion frontend/src/panel-related-items/related-items-edit-view.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { extend } from 'lodash';
import * as i18next from 'i18next';

import explorerChannel from '../explorer/explorer-radio';
import { announceRoute } from '../explorer/utilities';
Expand All @@ -25,5 +26,5 @@ export default class RelatedItemsEditor extends FieldEditingPanel {
}

extend(RelatedItemsEditor.prototype, {
title: 'Edit related items',
title: i18next.t('edit_related_items', 'Edit related items'),
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { extend, get } from 'lodash';
import * as i18next from 'i18next';

import {
CompositeView,
Expand Down Expand Up @@ -47,7 +48,7 @@ export default class SearchResultListPanel extends CompositeView {
}

initialize(options: ViewOptions): this {
this.title = options.title || 'Search Results';
this.title = options.title || i18next.t('search_results', 'Search Results');
this.searchList = new SearchResultListView(options).render();
this.listenTo(this.collection, {
focus: this.onFocus,
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/panel-source/source-metadata-view.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { extend } from 'lodash';
import * as i18next from 'i18next';

import View from '../core/view';
import userChannel from '../common-user/user-radio';
Expand All @@ -17,11 +18,11 @@ const excludedProperties = [
'owl:sameAs'
];

const sourceDeletionDialog = `
const sourceDeletionDialog = i18next.t('source_delete_confirm', `
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.
`;
`);

export default class MetadataView extends View {
/**
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/snippet/snippet-view.ts
Original file line number Diff line number Diff line change
@@ -1,12 +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 snippetTemplate from './snippet-template';

export default class SnippetView extends View<FlatItem> {
ellipsis = "(...)";
ellipsis = i18next.t('interpunction.paragraph_ellipsis', '(...)');
trimmedTitle: boolean;
trimmedStart: boolean;
trimmedEnd: boolean;
Expand Down

0 comments on commit 1236e78

Please sign in to comment.