From d2ec4a833b1f02812e17823aff2f029bf73f8d74 Mon Sep 17 00:00:00 2001 From: Sam Arbid Date: Sat, 19 Oct 2024 18:28:54 +0200 Subject: [PATCH 01/28] i18n: add missing translation --- .../semantic-ui/invenio_app_rdm/macros/records_list.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/macros/records_list.html b/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/macros/records_list.html index 63d40cb6f..0265b3965 100644 --- a/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/macros/records_list.html +++ b/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/macros/records_list.html @@ -1,12 +1,13 @@ {# Copyright (C) 2019-2022 CERN + Copyright (C) 2024 KTH Royal Institute of Technology. Invenio App RDM is free software; you can redistribute it and/or modify it under the terms of the MIT License; see LICENSE file for more details. #} {% macro records_list( - title="Recent uploads", + title=_("Recent uploads"), fetch_url="/api/records?sort=newest&size=10" ) %} From 96e9a8723e77451f7c34bcd66d1a905613a29d93 Mon Sep 17 00:00:00 2001 From: Sam Arbid Date: Sat, 19 Oct 2024 22:24:22 +0200 Subject: [PATCH 02/28] i18n: update admin dropdown menu --- .../administration/users/search/SearchResultItemLayout.js | 1 + 1 file changed, 1 insertion(+) diff --git a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/users/search/SearchResultItemLayout.js b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/users/search/SearchResultItemLayout.js index e4e7e8030..ded85f082 100644 --- a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/users/search/SearchResultItemLayout.js +++ b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/users/search/SearchResultItemLayout.js @@ -1,6 +1,7 @@ /* * This file is part of Invenio. * Copyright (C) 2022-2024 CERN. + * Copyright (C) 2024 KTH Royal Institute of Technology. * * Invenio is free software; you can redistribute it and/or modify it * under the terms of the MIT License; see LICENSE file for more details. From d5b8116c8063ac7bcc477f6366cc96e4211bd36a Mon Sep 17 00:00:00 2001 From: Sam Arbid Date: Mon, 21 Oct 2024 13:03:49 +0200 Subject: [PATCH 03/28] i18n: mark str for administration views * fix typo in RecordAdminListView name records should be lower case --- .../administration/records/records.py | 8 +++--- .../user_moderation/user_moderation.py | 28 ++++++++++--------- invenio_app_rdm/administration/users/users.py | 15 +++++----- 3 files changed, 27 insertions(+), 24 deletions(-) diff --git a/invenio_app_rdm/administration/records/records.py b/invenio_app_rdm/administration/records/records.py index 0552d7f47..a0e0b3f0c 100644 --- a/invenio_app_rdm/administration/records/records.py +++ b/invenio_app_rdm/administration/records/records.py @@ -25,9 +25,9 @@ class RecordAdminListView(AdminResourceListView): name = "records" resource_config = "records_resource" search_request_headers = {"Accept": "application/vnd.inveniordm.v1+json"} - title = "Records" + title = _("Records") menu_label = _("Records") - category = "Records & files" + category = _("Records & files") icon = "file" template = "invenio_app_rdm/administration/records/records.html" extension_name = "invenio-rdm-records" @@ -104,9 +104,9 @@ class DraftAdminListView(AdminResourceListView): name = "drafts" resource_config = "records_resource" search_request_headers = {"Accept": "application/vnd.inveniordm.v1+json"} - title = "Drafts" + title = _("Drafts") menu_label = _("Drafts") - category = "Records & files" + category = _("Records & files") icon = "upload" template = "invenio_app_rdm/administration/records/drafts.html" extension_name = "invenio-rdm-records" diff --git a/invenio_app_rdm/administration/user_moderation/user_moderation.py b/invenio_app_rdm/administration/user_moderation/user_moderation.py index 3c141a733..87fdb5e96 100644 --- a/invenio_app_rdm/administration/user_moderation/user_moderation.py +++ b/invenio_app_rdm/administration/user_moderation/user_moderation.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # # Copyright (C) 2023-2024 CERN. +# Copyright (C) 2024 KTH Royal Institute of Technology. # # Invenio App RDM is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. @@ -13,6 +14,7 @@ AdminResourceDetailView, AdminResourceListView, ) +from invenio_i18n import lazy_gettext as _ from invenio_requests.customizations.user_moderation import UserModerationRequest from invenio_search_ui.searchconfig import search_app_config @@ -25,9 +27,9 @@ class UserModerationListView(AdminResourceListView): name = "moderation" resource_config = "requests_resource" request_headers = {"Accept": "application/vnd.inveniordm.v1+json"} - title = "Moderation" - menu_label = "Moderation" - category = "Moderation" + title = _("Moderation") + menu_label = _("Moderation") + category = _("Moderation") pid_path = "id" icon = "users" template = "invenio_app_rdm/administration/user_moderation.html" @@ -41,30 +43,30 @@ class UserModerationListView(AdminResourceListView): item_field_list = { # custom display of the values - only declared to create columns "expanded.topic.user": { - "text": "User", + "text": _("User"), "order": 2, "width": 4, }, # custom display of the values - only declared to create columns "expanded.topic.user.profile.email": { - "text": "Email", + "text": _("Email"), "order": 3, "width": 2, }, # custom display of the values - only declared to create columns "domain": { - "text": "Email domain", + "text": _("Email domain"), "order": 4, "width": 2, }, # custom display of the values - only declared to create columns "activity": { - "text": "Activity", + "text": _("Activity"), "order": 5, "width": 4, }, "status": { - "text": "Status", + "text": _("Status"), "order": 6, "width": 2, }, @@ -72,12 +74,12 @@ class UserModerationListView(AdminResourceListView): actions = { "accept": { - "text": "Approve", + "text": _("Approve"), "payload_schema": None, "order": 1, }, "decline": { - "text": "Block", + "text": _("Block"), "payload_schema": None, "order": 2, }, @@ -137,7 +139,7 @@ class UserModerationRequestDetailView(AdminResourceDetailView): api_endpoint = "/requests" name = "user-moderation-details" resource_config = "requests_resource" - title = "User moderation" + title = _("User moderation") display_delete = False display_edit = False @@ -160,11 +162,11 @@ def get_service_schema(cls): item_field_list = { "id": { - "text": "ID", + "text": _("ID"), "order": 1, }, "topic.user": { - "text": "User", + "text": _("User"), "order": 3, }, # TODO we should resolve the user. But this is fetched from the API. # TODO can we dereference somehow? diff --git a/invenio_app_rdm/administration/users/users.py b/invenio_app_rdm/administration/users/users.py index 994f3ba7b..a721503d9 100644 --- a/invenio_app_rdm/administration/users/users.py +++ b/invenio_app_rdm/administration/users/users.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # # Copyright (C) 2023-2024 CERN. +# Copyright (C) 2024 KTH Royal Institute of Technology. # # Invenio App RDM is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. @@ -53,9 +54,9 @@ class UsersListView(AdminResourceListView): extension_name = "invenio-users-resources" name = "users" resource_config = "users_resource" - title = "User management" - menu_label = "Users" - category = "User management" + title = _("User management") + menu_label = _("Users") + category = _("User management") pid_path = "id" icon = "users" @@ -75,22 +76,22 @@ class UsersListView(AdminResourceListView): # TODO: missing permission based links in resource actions = { "approve": { - "text": "Approve", + "text": _("Approve"), "payload_schema": None, "order": 1, }, "restore": { - "text": "Restore", + "text": _("Restore"), "payload_schema": None, "order": 2, }, "block": { - "text": "Block", + "text": _("Block"), "payload_schema": None, "order": 2, }, "Deactivate": { - "text": "Suspend", + "text": _("Suspend"), "payload_schema": None, "order": 2, }, From 168da9733e210fbfcc7721aae65c41753e86a5b4 Mon Sep 17 00:00:00 2001 From: Sam Arbid Date: Mon, 21 Oct 2024 13:28:02 +0200 Subject: [PATCH 04/28] i18n: mark templates strings for translations --- .../user_moderation/user_moderation.py | 4 ++-- .../records/details/access-form.html | 17 ++++++++++------- .../records/details/contact.html | 3 ++- .../records/details/side_bar/licenses.html | 10 +++++----- 4 files changed, 19 insertions(+), 15 deletions(-) diff --git a/invenio_app_rdm/administration/user_moderation/user_moderation.py b/invenio_app_rdm/administration/user_moderation/user_moderation.py index 87fdb5e96..e297d1d7e 100644 --- a/invenio_app_rdm/administration/user_moderation/user_moderation.py +++ b/invenio_app_rdm/administration/user_moderation/user_moderation.py @@ -170,6 +170,6 @@ def get_service_schema(cls): "order": 3, }, # TODO we should resolve the user. But this is fetched from the API. # TODO can we dereference somehow? - "created": {"text": "Created", "order": 2}, - "is_open": {"text": "Open", "order": 4}, + "created": {"text": _("Created"), "order": 2}, + "is_open": {"text": _("Open"), "order": 4}, } diff --git a/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/details/access-form.html b/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/details/access-form.html index 3945ea0d5..930161032 100644 --- a/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/details/access-form.html +++ b/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/details/access-form.html @@ -1,6 +1,9 @@ -{# Copyright (C) 2023 CERN. Invenio RDM Records is free software; you can redistribute -it and/or modify it under the terms of the MIT License; see LICENSE file for more -details. #} +{# + Copyright (C) 2023 CERN. + Copyright (C) 2024 KTH Royal Institute of Technology. + Invenio RDM Records is free software; you can redistribute it and/or modify + it under the terms of the MIT License; see LICENSE file for more details. +-#} {% from "invenio_accounts/_macros.html" import render_field, form_errors %} @@ -10,8 +13,8 @@ {% set full_name = None %}

- You are currently not logged in. Do you have an account? - Log in here + {{ _("You are currently not logged in") }}. {{ _("Do you have an account?") }} + {{ _("Log in here") }}

{% else %} {% set email = current_user.email %} @@ -24,8 +27,8 @@

{{ _("You are logged in as") }}

- Not you? - Log out to switch account. + {{ _("Not you?") }} + {{ _("Log out") }} {{ _("to switch account.") }}

{% endif %} diff --git a/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/details/contact.html b/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/details/contact.html index a20e87acc..cb33e0496 100644 --- a/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/details/contact.html +++ b/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/details/contact.html @@ -1,11 +1,12 @@ {# Copyright (C) 2020 CERN. Copyright (C) 2020 Northwestern University. + Copyright (C) 2024 KTH Royal Institute of Technology. Invenio RDM Records is free software; you can redistribute it and/or modify it under the terms of the MIT License; see LICENSE file for more details. #}
- Send message + {{ _("Send message") }}
diff --git a/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/details/side_bar/licenses.html b/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/details/side_bar/licenses.html index eb51d2770..11c85da23 100644 --- a/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/details/side_bar/licenses.html +++ b/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/details/side_bar/licenses.html @@ -3,6 +3,7 @@ Copyright (C) 2020 Northwestern University. Copyright (C) 2021 Graz University of Technology. Copyright (C) 2021 New York University. + Copyright (C) 2024 KTH Royal Institute of Technology. Invenio RDM Records is free software; you can redistribute it and/or modify it under the terms of the MIT License; see LICENSE file for more details. @@ -10,13 +11,12 @@ {% macro license_link(license) %} {% if license.link %} - Read more + {{ _('Read more') }} {% elif license.props and license.props.url %} - Read more + {{ _('Read more') }} {% endif %} {% endmacro %} - {% set rights = record.ui.get('rights') %} {% if rights %} From 2f10c2e0c57d87f8ed9f56cacc16c7401a87fc13 Mon Sep 17 00:00:00 2001 From: Sam Arbid Date: Mon, 21 Oct 2024 13:52:04 +0200 Subject: [PATCH 05/28] i18n: mark strings for translation and fix typos --- .../semantic-ui/invenio_app_rdm/records/detail.html | 5 +++-- .../invenio_app_rdm/records/macros/version.html | 7 ++++--- invenio_app_rdm/records_ui/views/deposits.py | 4 ++-- invenio_app_rdm/records_ui/views/filters.py | 4 +++- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/detail.html b/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/detail.html index 3c7695aca..3963b6e21 100644 --- a/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/detail.html +++ b/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/detail.html @@ -4,6 +4,7 @@ Copyright (C) 2021-2023 TU Wien. Copyright (C) 2021 Graz University of Technology. Copyright (C) 2021 New York University. + Copyright (C) 2024 KTH Royal Institute of Technology. Invenio RDM Records is free software; you can redistribute it and/or modify it under the terms of the MIT License; see LICENSE file for more details. @@ -77,7 +78,7 @@

{% endif %} {% if community.parent %} -
Part of +
{{ _('Part of') }} {{community.parent.metadata.title}} @@ -108,7 +109,7 @@
- {{ _ ("Preview") }} + {{ _("Preview") }}

{% if not is_draft %} diff --git a/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/version.html b/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/version.html index c272562f8..c9d94189e 100644 --- a/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/version.html +++ b/invenio_app_rdm/records_ui/templates/semantic-ui/invenio_app_rdm/records/macros/version.html @@ -1,5 +1,6 @@ {# Copyright (C) 2020 CERN. + Copyright (C) 2024 KTH Royal Institute of Technology. Invenio RDM Records is free software; you can redistribute it and/or modify it under the terms of the MIT License; see LICENSE file for more details. @@ -9,8 +10,8 @@

- Version {{ version }} - {% set doi = doi if doi else "No DOI available" %} + {{ _("Version") }} {{ version }} + {% set doi = doi if doi else _("No DOI available") %}

{{ doi }}

@@ -18,4 +19,4 @@
-{%- endmacro %} +{%- endmacro %} \ No newline at end of file diff --git a/invenio_app_rdm/records_ui/views/deposits.py b/invenio_app_rdm/records_ui/views/deposits.py index d9afc7487..30494f64e 100644 --- a/invenio_app_rdm/records_ui/views/deposits.py +++ b/invenio_app_rdm/records_ui/views/deposits.py @@ -3,7 +3,7 @@ # Copyright (C) 2019-2024 CERN. # Copyright (C) 2019-2021 Northwestern University. # Copyright (C) 2021 TU Wien. -# Copyright (C) 2022 KTH Royal Institute of Technology +# Copyright (C) 2022-2024 KTH Royal Institute of Technology # Copyright (C) 2023-2024 Graz University of Technology. # # Invenio App RDM is free software; you can redistribute it and/or modify it @@ -188,7 +188,7 @@ def subjects(self): .options(load_only(VocabularyScheme.id)) .all() ) - limit_to = [{"text": "All", "value": "all"}] + limit_to = [{"text": _("All"), "value": "all"}] # id is human readable and shorter, so we use it limit_to += [{"text": s.id, "value": s.id} for s in subjects] diff --git a/invenio_app_rdm/records_ui/views/filters.py b/invenio_app_rdm/records_ui/views/filters.py index ad366cd0e..0b37fe468 100644 --- a/invenio_app_rdm/records_ui/views/filters.py +++ b/invenio_app_rdm/records_ui/views/filters.py @@ -3,6 +3,7 @@ # Copyright (C) 2019-2024 CERN. # Copyright (C) 2019-2020 Northwestern University. # Copyright (C) 2021 TU Wien. +# Copyright (C) 2024 KTH Royal Institute of Technology # Copyright (C) 2024 Graz University of Technology. # # Invenio App RDM is free software; you can redistribute it and/or modify it @@ -17,6 +18,7 @@ from flask import current_app, url_for from invenio_base.utils import obj_or_import_string from invenio_i18n import get_locale +from invenio_i18n import lazy_gettext as _ from invenio_previewer.views import is_previewable from invenio_records_files.api import FileObject from invenio_records_permissions.policies import get_record_permission_policy @@ -207,6 +209,6 @@ def transform_record(record, serializer, module=None, throws=True, **kwargs): if throws: raise Exception("No serializer found.") except Exception: - current_app.logger.error("Record transformation failed.") + current_app.logger.error(_("Record transformation failed.")) if throws: raise From 803c0e5e2a58f827bcbf1908795fa8a6bc37c6c2 Mon Sep 17 00:00:00 2001 From: Sam Arbid Date: Mon, 21 Oct 2024 15:29:55 +0200 Subject: [PATCH 06/28] i18n: mark js strings for translations --- .../administration/components/ImpersonateUser.js | 3 ++- .../components/RecordsResultsListItem.js | 11 ++++++----- .../js/invenio_app_rdm/deposit/RDMDepositForm.js | 16 ++++++++-------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/components/ImpersonateUser.js b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/components/ImpersonateUser.js index 3b9405994..204382148 100644 --- a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/components/ImpersonateUser.js +++ b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/administration/components/ImpersonateUser.js @@ -1,6 +1,7 @@ /* * // This file is part of Invenio-App-Rdm * // Copyright (C) 2023 CERN. + * // Copyright (C) 2024 KTH Royal Institute of Technology. * // * // Invenio-App-Rdm is free software; you can redistribute it and/or modify it * // under the terms of the MIT License; see LICENSE file for more details. @@ -72,7 +73,7 @@ export class ImpersonateUser extends Component { labelPosition="left" > - Impersonate + {i18next.t("Impersonate")} {modalHeader && {modalHeader}} diff --git a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/components/RecordsResultsListItem.js b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/components/RecordsResultsListItem.js index d3710d396..0af146b54 100644 --- a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/components/RecordsResultsListItem.js +++ b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/components/RecordsResultsListItem.js @@ -1,5 +1,6 @@ // This file is part of InvenioRDM // Copyright (C) 2022-2024 CERN. +// Copyright (C) 2024 KTH Royal Institute of Technology. // // Invenio RDM is free software; you can redistribute it and/or modify it // under the terms of the MIT License; see LICENSE file for more details. @@ -25,7 +26,7 @@ class RecordsResultsListItem extends Component { const createdDate = _get( result, "ui.created_date_l10n_long", - "No creation date found." + i18next.t("No creation date found.") ); const creators = result.ui.creators.creators; @@ -33,21 +34,21 @@ class RecordsResultsListItem extends Component { const descriptionStripped = _get( result, "ui.description_stripped", - "No description" + i18next.t("No description") ); const publicationDate = _get( result, "ui.publication_date_l10n_long", - "No publication date found." + i18next.t("No publication date found.") ); const resourceType = _get( result, "ui.resource_type.title_l10n", - "No resource type" + i18next.t("No resource type") ); const subjects = _get(result, "ui.subjects", []); - const title = _get(result, "metadata.title", "No title"); + const title = _get(result, "metadata.title", i18next.t("No title")); const version = _get(result, "ui.version", null); const versions = _get(result, "versions"); const uniqueViews = _get(result, "stats.all_versions.unique_views", 0); diff --git a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/deposit/RDMDepositForm.js b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/deposit/RDMDepositForm.js index aa0eab5cd..cb77f8e61 100644 --- a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/deposit/RDMDepositForm.js +++ b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/deposit/RDMDepositForm.js @@ -63,16 +63,16 @@ export class RDMDepositForm extends Component { creators: { ...this.config.vocabularies.creators, type: [ - { text: "Person", value: "personal" }, - { text: "Organization", value: "organizational" }, + { text: i18next.t("Person"), value: "personal" }, + { text: i18next.t("Organization"), value: "organizational" }, ], }, contributors: { ...this.config.vocabularies.contributors, type: [ - { text: "Person", value: "personal" }, - { text: "Organization", value: "organizational" }, + { text: i18next.t("Person"), value: "personal" }, + { text: i18next.t("Organization"), value: "organizational" }, ], }, identifiers: { @@ -375,8 +375,8 @@ export class RDMDepositForm extends Component { schema="contributors" autocompleteNames={this.config.autocomplete_names} modal={{ - addLabel: "Add contributor", - editLabel: "Edit contributor", + addLabel: i18next.t("Add contributor"), + editLabel: i18next.t("Edit contributor"), }} /> @@ -449,7 +449,7 @@ export class RDMDepositForm extends Component { { return { From 675e0d2a18066456e202cf92fc21e4a83cfc95dc Mon Sep 17 00:00:00 2001 From: Sam Arbid Date: Mon, 21 Oct 2024 16:50:14 +0200 Subject: [PATCH 07/28] i18n: mark linksSearchItem missing strings --- .../ShareOptions/AccessLinks/LinksSearchItem.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/landing_page/ShareOptions/AccessLinks/LinksSearchItem.js b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/landing_page/ShareOptions/AccessLinks/LinksSearchItem.js index cbc1a6bad..394fa2eff 100644 --- a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/landing_page/ShareOptions/AccessLinks/LinksSearchItem.js +++ b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/landing_page/ShareOptions/AccessLinks/LinksSearchItem.js @@ -1,6 +1,7 @@ /* * This file is part of Invenio. * Copyright (C) 2023-2024 CERN. + * Copyright (C) 2024 KTH Royal Institute of Technology. * * Invenio is free software; you can redistribute it and/or modify it * under the terms of the MIT License; see LICENSE file for more details. @@ -97,20 +98,20 @@ export const LinksSearchItem = ({ {!error && ( <> - + {isEmpty(result.description) ? "-" : _truncate(result.description, { length: 60 })} - + {timestampToRelativeTime(result.created_at)} - + {isEmpty(result.expires_at) ? i18next.t("Never") : `${timestampToRelativeTime(result.expires_at)} (${result.expires_at})`} - + Date: Mon, 21 Oct 2024 17:01:46 +0200 Subject: [PATCH 08/28] i18n: fix uploads descriptionStripped --- .../semantic-ui/js/invenio_app_rdm/user_dashboard/uploads.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/user_dashboard/uploads.js b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/user_dashboard/uploads.js index c8c368c35..d76074668 100644 --- a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/user_dashboard/uploads.js +++ b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/user_dashboard/uploads.js @@ -3,6 +3,7 @@ // Copyright (C) 2020-2021 Northwestern University. // Copyright (C) 2021 Graz University of Technology. // Copyright (C) 2021 New York University. +// Copyright (C) 2024 KTH Royal Institute of Technology. // // Invenio App RDM is free software; you can redistribute it and/or modify it // under the terms of the MIT License; see LICENSE file for more details. @@ -121,7 +122,7 @@ RDMRecordResultsListItem.propTypes = { // these components in RDM result broken. export const RDMRecordResultsGridItem = ({ result, index }) => { - const descriptionStripped = _get(result, "ui.description_stripped", "No description"); + const descriptionStripped = _get(result, "ui.description_stripped", i18next.t("No description")); return ( From 3225b7a3f085b84c66ed0d7921ce61d3ffc12e74 Mon Sep 17 00:00:00 2001 From: Sam Arbid Date: Mon, 21 Oct 2024 17:06:47 +0200 Subject: [PATCH 09/28] i18n: fix theme and uploads --- .../theme/assets/semantic-ui/js/invenio_app_rdm/theme.js | 7 +++++++ .../js/invenio_app_rdm/user_dashboard/uploads.js | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/theme.js b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/theme.js index 2041e57f3..8da2025f9 100644 --- a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/theme.js +++ b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/theme.js @@ -1,3 +1,10 @@ +// This file is part of InvenioRDM +// Copyright (C) 2024 CERN. +// Copyright (C) 2024 KTH Royal Institute of Technology. +// +// Invenio RDM Records is free software; you can redistribute it and/or modify it +// under the terms of the MIT License; see LICENSE file for more details. + import $ from "jquery"; import { MultipleOptionsSearchBar } from "@js/invenio_search_ui/components"; import { i18next } from "@translations/invenio_app_rdm/i18next"; diff --git a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/user_dashboard/uploads.js b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/user_dashboard/uploads.js index d76074668..7a1da93bb 100644 --- a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/user_dashboard/uploads.js +++ b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/user_dashboard/uploads.js @@ -122,7 +122,11 @@ RDMRecordResultsListItem.propTypes = { // these components in RDM result broken. export const RDMRecordResultsGridItem = ({ result, index }) => { - const descriptionStripped = _get(result, "ui.description_stripped", i18next.t("No description")); + const descriptionStripped = _get( + result, + "ui.description_stripped", + i18next.t("No description") + ); return ( From 2d813dbc7ca15c33a3007372660069e18394dbc8 Mon Sep 17 00:00:00 2001 From: Sam Arbid Date: Mon, 21 Oct 2024 17:13:15 +0200 Subject: [PATCH 10/28] i18n: add utils missing strings localization --- .../semantic-ui/js/invenio_app_rdm/utils.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/utils.js b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/utils.js index 6996fbe45..8a282b27f 100644 --- a/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/utils.js +++ b/invenio_app_rdm/theme/assets/semantic-ui/js/invenio_app_rdm/utils.js @@ -3,6 +3,7 @@ // Copyright (C) 2021 New York University. // Copyright (C) 2022 data-futures. // Copyright (C) 2023 Northwestern University. +// Copyright (C) 2024 KTH Royal Institute of Technology. // // Invenio RDM Records is free software; you can redistribute it and/or modify it // under the terms of the MIT License; see LICENSE file for more details. @@ -27,19 +28,19 @@ export function SearchItemCreators({ creators, className, othersLink }) { link = `https://orcid.org/${identifier}`; linkTitle = i18next.t("ORCID profile"); icon = "/static/images/orcid.svg"; - alt = "ORCID logo"; + alt = i18next.t("ORCID logo"); break; case "ror": link = `https://ror.org/${identifier}`; linkTitle = i18next.t("ROR profile"); icon = "/static/images/ror-icon.svg"; - alt = "ROR logo"; + alt = i18next.t("ROR logo"); break; case "gnd": link = `https://d-nb.info/gnd/${identifier}`; linkTitle = i18next.t("GND profile"); icon = "/static/images/gnd-icon.svg"; - alt = "GND logo"; + alt = i18next.t("GND logo"); break; default: return null; @@ -61,13 +62,13 @@ export function SearchItemCreators({ creators, className, othersLink }) { function getIcons(creator) { let ids = _get(creator, "person_or_org.identifiers", []); - let creatorName = _get(creator, "person_or_org.name", "No name"); + let creatorName = _get(creator, "person_or_org.name", i18next.t("No name")); let icons = ids.map((c) => makeIcon(c.scheme, c.identifier, creatorName)); return icons; } function getLink(creator) { - let creatorName = _get(creator, "person_or_org.name", "No name"); + let creatorName = _get(creator, "person_or_org.name", i18next.t("No name")); let link = ( From 95efd702858a98a00d833a7e290465e6b663de94 Mon Sep 17 00:00:00 2001 From: Sam Arbid Date: Mon, 21 Oct 2024 17:34:05 +0200 Subject: [PATCH 11/28] i18n: mark files integrity report for translation --- .../email/files_integrity_report.html | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/files_integrity_report/email/files_integrity_report.html b/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/files_integrity_report/email/files_integrity_report.html index cc5f3da9e..ebfb8f425 100644 --- a/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/files_integrity_report/email/files_integrity_report.html +++ b/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/files_integrity_report/email/files_integrity_report.html @@ -2,6 +2,7 @@ # -*- coding: utf-8 -*- # # Copyright (C) 2022 CERN. +# Copyright (C) 2024 KTH Royal Institute of Technology. # # Invenio App RDM is free software; you can redistribute it and/or modify it # under the terms of the MIT License; see LICENSE file for more details. @@ -9,23 +10,23 @@ {% set BASE_URL = config.SITE_UI_URL %} -The following files were flagged as 'unhealthy'. This means that the checksum check failed or timed out. Please take any action if needed. +{{ _("The following files were flagged as 'unhealthy'. This means that the checksum check failed or timed out. Please take any action if needed.") }} {% for entry in entries -%} -{{ "ID: %s" | format(entry.file.id) }} -{{ "URI: %s" | format(entry.file.uri) }} +{{ _("ID: %s") | format(entry.file.id) }} +{{ _("URI: %s") | format(entry.file.uri) }} {%- if 'filename' in entry %} -{{ "Name: %s" | format(entry.filename) }} +{{ _("Name: %s") | format(entry.filename) }} {%- endif %} -{{ "Created: %s" | format(entry.file.created) }} -{{ "Checksum: %s" | format(entry.file.checksum) }} -{{ "Last check date: %s" | format(entry.file.last_check_at) }} -{{ "Last check FAILED with result: %s" | format(entry.file.last_check) }} +{{ _("Created: %s") | format(entry.file.created) }} +{{ _("Checksum: %s") | format(entry.file.checksum) }} +{{ _("Last check date: %s") | format(entry.file.last_check_at) }} +{{ _("Last check FAILED with result: %s") | format(entry.file.last_check) }} {%- if 'record' in entry %} -{{ "Record: %s/records/%s" | format(BASE_URL, entry.record.id) }} +{{ _("Record: %s/records/%s") | format(BASE_URL, entry.record.id) }} {%- endif %} {%- if 'draft' in entry %} -{{ "Draft: %s/uploads/%s" | format(BASE_URL, entry.draft.id) }} +{{ _("Draft: %s/uploads/%s") | format(BASE_URL, entry.draft.id) }} {%- endif %} {{ "-" * 80 }} {% endfor %} From d3d0a2a9e56fc9faa19c057b32582348f2f9b805 Mon Sep 17 00:00:00 2001 From: Sam Arbid Date: Mon, 21 Oct 2024 18:05:00 +0200 Subject: [PATCH 12/28] i18n: fix footer --- .../semantic-ui/invenio_app_rdm/footer.html | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/footer.html b/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/footer.html index f09ab5678..f00ac7144 100644 --- a/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/footer.html +++ b/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/footer.html @@ -3,6 +3,7 @@ Copyright (C) 2019-2020 CERN. Copyright (C) 2019-2020 Northwestern University. Copyright (C) 2021 Graz University of Technology. + Copyright (C) 2024 KTH Royal Institute of Technology. Invenio App RDM is free software; you can redistribute it and/or modify it under the terms of the MIT License; see LICENSE file for more details. @@ -16,40 +17,40 @@ From b8665ec4343da725e48bce114206501fbc3a0b94 Mon Sep 17 00:00:00 2001 From: Sam Arbid Date: Mon, 21 Oct 2024 18:09:57 +0200 Subject: [PATCH 13/28] i18n: fix header template --- .../theme/templates/semantic-ui/invenio_app_rdm/header.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/header.html b/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/header.html index 1b3acc3a3..894a40079 100644 --- a/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/header.html +++ b/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/header.html @@ -3,6 +3,7 @@ Copyright (C) 2019-2020 CERN. Copyright (C) 2019-2020 Northwestern University. Copyright (C) 2021 New York University. + Copyright (C) 2024 KTH Royal Institute of Technology. Invenio App RDM is free software; you can redistribute it and/or modify it under the terms of the MIT License; see LICENSE file for more details. @@ -15,9 +16,9 @@
- Impersonated session + {{ _('Impersonated session') }}
- You must logout after you finish with you inquiry! + {{ _('You must logout after you finish with you inquiry!') }}
{%- endif %} From 61e9fdccced854bf1f4395d229da551bee4fb55c Mon Sep 17 00:00:00 2001 From: Sam Arbid Date: Mon, 21 Oct 2024 19:20:32 +0200 Subject: [PATCH 14/28] fix: fix nested translations --- .../semantic-ui/invenio_app_rdm/footer.html | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/footer.html b/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/footer.html index f00ac7144..40e818d70 100644 --- a/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/footer.html +++ b/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/footer.html @@ -17,40 +17,40 @@ From 47c8a4bea23d563c1c295a65077bfb70dd35090c Mon Sep 17 00:00:00 2001 From: Sam Arbid Date: Wed, 23 Oct 2024 11:50:53 +0200 Subject: [PATCH 15/28] i18n: strip out unnecessary trans tags --- .../semantic-ui/invenio_app_rdm/footer.html | 40 +++++-------------- 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/footer.html b/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/footer.html index 40e818d70..6f60e1c1e 100644 --- a/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/footer.html +++ b/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/footer.html @@ -16,42 +16,22 @@
- {% trans configuration_link="https://inveniordm.docs.cern.ch/install/configuration/" %} - Configure the datamodel, resource types, permissions and much more to make it suit your needs! For more - information on how to do it visit the configuration - section in the docs. - {% endtrans %} + {{ _("Configure the datamodel, resource types, permissions and much more to make it suit your needs! For more information on how to do it visit the") }} + + {{ _("configuration section in the docs") }} + .
@@ -41,10 +41,10 @@

{{ _("Customize") }}

- {% trans configuration_link="https://inveniordm.docs.cern.ch/customize/" %} - Customize the layout and adapt the styling to match your institution's. See how to do so here. - {% endtrans %} + {{ _("Customize the layout and adapt the styling to match your institution's. See how to do so") }} + + {{ _("here") }} + .
@@ -56,12 +56,10 @@

{{ _("Run it!") }}
- {% trans - deployment_link="https://inveniordm.docs.cern.ch/install/build-setup-run/#run_1" - %} - Run your - InvenioRDM instance locally or in containers. - {% endtrans %} + {{ _("Run your InvenioRDM instance locally or in containers.") }} + + {{ _("Run") }} + .
From 84f2fb24b3d31ec6d0e9e29c0da4eef111f5ff79 Mon Sep 17 00:00:00 2001 From: Sam Arbid Date: Wed, 23 Oct 2024 12:25:35 +0200 Subject: [PATCH 18/28] i18n: remove trans tags from site_footer --- .../semantic-ui/invenio_app_rdm/site_footer.html | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/site_footer.html b/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/site_footer.html index 3d1dd6b9a..0351c828f 100644 --- a/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/site_footer.html +++ b/invenio_app_rdm/theme/templates/semantic-ui/invenio_app_rdm/site_footer.html @@ -1,12 +1,19 @@ +{# + -*- coding: utf-8 -*- + Copyright (C) 2022-2024 CERN. + Copyright (C) 2024 KTH Royal Institute of Technology. + + Invenio App RDM is free software; you can redistribute it and/or modify it + under the terms of the MIT License; see LICENSE file for more details. +#} +