Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n: Mark Strings for Translations #1894

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions invenio_rdm_records/administration/views/oai.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Copyright (C) 2022-2024 CERN.
# Copyright (C) 2023 Graz University of Technology.
# Copyright (C) 2024 KTH Royal Institute of Technology.
#
# invenio-administration is free software; you can redistribute it and/or
# modify it under the terms of the MIT License; see LICENSE file for more
Expand All @@ -25,8 +26,8 @@ class OaiPmhListView(AdminResourceListView):
name = "OAI-PMH"
resource_config = "oaipmh_server_resource"
search_request_headers = {"Accept": "application/json"}
title = "OAI-PMH Sets"
category = "Site management"
title = _("OAI-PMH Sets")
category = _("Site management")
pid_path = "id"
icon = "exchange"
template = "invenio_rdm_records/oai-search.html"
Expand Down Expand Up @@ -59,9 +60,9 @@ class OaiPmhEditView(AdminResourceEditView):
resource_config = "oaipmh_server_resource"
pid_path = "id"
api_endpoint = "/oaipmh/sets"
title = "Edit OAI-PMH set"
title = _("Edit OAI-PMH set")

list_view_name = "OAI-PMH"
list_view_name = _("OAI-PMH")

form_fields = {
"name": {
Expand Down Expand Up @@ -99,9 +100,9 @@ class OaiPmhCreateView(AdminResourceCreateView):
resource_config = "oaipmh_server_resource"
pid_path = "id"
api_endpoint = "/oaipmh/sets"
title = "Create OAI-PMH set"
title = _("Create OAI-PMH set")

list_view_name = "OAI-PMH"
list_view_name = _("OAI-PMH")

form_fields = {
"name": {
Expand Down Expand Up @@ -136,13 +137,13 @@ class OaiPmhDetailView(AdminResourceDetailView):
search_request_headers = {"Accept": "application/json"}
name = "OAI-PMH details"
resource_config = "oaipmh_server_resource"
title = "OAI-PMH Details"
title = _("OAI-PMH Details")

template = "invenio_rdm_records/oai-details.html"
display_delete = True
display_edit = True

list_view_name = "OAI-PMH"
list_view_name = _("OAI-PMH")
pid_path = "id"

item_field_list = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// This file is part of Invenio-RDM-Records
// Copyright (C) 2020-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.
Expand Down Expand Up @@ -75,7 +76,7 @@ export const CommunityListItem = ({ result, record, isInitialSubmission }) => {
)}
/>
<Button size="tiny" as="a" href={`/communities/${result.slug}`}>
Go to the community
{i18next.t("Go to the community")}
</Button>
</>
)}
Expand Down Expand Up @@ -107,7 +108,7 @@ export const CommunityListItem = ({ result, record, isInitialSubmission }) => {
{hasTheme && (
<Label color="green" horizontal size="small">
<Icon name="check circle" />
Verified
{i18next.t("Verified")}
</Label>
)}
</>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// This file is part of Invenio-RDM-Records
// Copyright (C) 2020-2023 CERN.
// Copyright (C) 2020-2022 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.
Expand All @@ -9,6 +10,7 @@ import React, { Component } from "react";
import PropTypes from "prop-types";
import { FieldLabel } from "react-invenio-forms";
import { Form, Segment } from "semantic-ui-react";
import { i18next } from "@translations/invenio_rdm_records/i18next";

export class ComingSoonField extends Component {
render() {
Expand All @@ -17,7 +19,7 @@ export class ComingSoonField extends Component {
<Form.Field id={fieldPath} name={fieldPath}>
<FieldLabel htmlFor={fieldPath} icon={labelIcon} label={label} />
<Segment size="massive" tertiary textAlign="center">
Coming soon
{i18next.t("Coming soon")}
</Segment>
</Form.Field>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Copyright (C) 2020-2024 CERN.
// Copyright (C) 2020-2022 Northwestern University.
// 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.
Expand Down Expand Up @@ -111,7 +112,7 @@ export const CreatibutorsFieldItem = ({
(identifier) => identifier.scheme === "orcid"
) && (
<img
alt="ORCID logo"
alt={i18next.t("ORCID logo")}
className="inline-id-icon mr-5"
src="/static/images/orcid.svg"
width="16"
Expand All @@ -122,7 +123,7 @@ export const CreatibutorsFieldItem = ({
(identifier) => identifier.scheme === "ror"
) && (
<img
alt="ROR logo"
alt={i18next.t("ROR logo")}
className="inline-id-icon mr-5"
src="/static/images/ror-icon.svg"
width="16"
Expand All @@ -133,7 +134,7 @@ export const CreatibutorsFieldItem = ({
(identifier) => identifier.scheme === "gnd"
) && (
<img
alt="GND logo"
alt={i18next.t("GND logo")}
className="inline-id-icon mr-5"
src="/static/images/gnd-icon.svg"
width="16"
Expand All @@ -145,7 +146,9 @@ export const CreatibutorsFieldItem = ({
</List.Description>
{firstError && (
<Label pointing="left" prompt>
{firstError.scheme ? firstError.scheme : "Invalid identifiers"}
{firstError.scheme
? firstError.scheme
: i18next.t("Invalid identifiers")}
</Label>
)}
</List.Content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Copyright (C) 2020-2022 Northwestern University.
// Copyright (C) 2021-2022 Graz University of Technology.
// Copyright (C) 2022 TU Wien.
// 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.
Expand Down Expand Up @@ -32,7 +33,7 @@ const FileTableHeader = ({ filesLocked }) => (
<Table.HeaderCell>
{i18next.t("Preview")}{" "}
<Popup
content="Set the default preview"
content={i18next.t("Set the default preview")}
trigger={<Icon fitted name="help circle" size="small" />}
/>
</Table.HeaderCell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Copyright (C) 2020-2023 CERN.
// Copyright (C) 2020-2022 Northwestern University.
// Copyright (C) 2021 Graz University of Technology.
// 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.
Expand Down Expand Up @@ -146,22 +147,22 @@ export class LicenseModal extends Component {
<Menu compact>
<Toggle
title={i18next.t("Recommended")}
label="recommended"
label={i18next.t("recommended")}
filterValue={["tags", "recommended"]}
/>
<Toggle
title={i18next.t("All")}
label="all"
label={i18next.t("all")}
filterValue={["tags", "all"]}
/>
<Toggle
title={i18next.t("Data")}
label="data"
label={i18next.t("data")}
filterValue={["tags", "data"]}
/>
<Toggle
title={i18next.t("Software")}
label="software"
label={i18next.t("software")}
filterValue={["tags", "software"]}
/>
</Menu>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// Copyright (C) 2020-2023 CERN.
// Copyright (C) 2020-2022 Northwestern University.
// Copyright (C) 2021 Graz University of Technology.
// 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.
Expand Down Expand Up @@ -32,13 +33,13 @@ export class AdditionalTitlesField extends Component {
<GroupField fieldPath={fieldPath} optimized>
<TextField
fieldPath={`${fieldPathPrefix}.title`}
label="Additional title"
label={i18next.t("Additional title")}
required
width={5}
/>
<SelectField
fieldPath={`${fieldPathPrefix}.type`}
label="Type"
label={i18next.t("Type")}
optimized
options={options.type}
required
Expand All @@ -59,9 +60,9 @@ export class AdditionalTitlesField extends Component {
: []
}
fieldPath={`${fieldPathPrefix}.lang`}
label="Language"
label={i18next.t("Language")}
multiple={false}
placeholder="Select language"
placeholder={i18next.t("Select language")}
labelIcon={null}
clearable
selectOnBlur={false}
Expand Down
19 changes: 10 additions & 9 deletions invenio_rdm_records/contrib/codemeta/custom_fields.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
#
# 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.
Expand Down Expand Up @@ -32,7 +33,7 @@
name="code:codeRepository",
field_args={
"validate": validate.URL(),
"error_messages": {"validate": "You must provide a valid URL."},
"error_messages": {"validate": _("You must provide a valid URL.")},
},
),
VocabularyCF(
Expand All @@ -57,19 +58,19 @@
ui_widget="Input",
props=dict(
is_identifier=True,
label="Repository URL",
label=_("Repository URL"),
icon="linkify",
description="URL or link where the code repository is hosted.",
description=_("URL or link where the code repository is hosted."),
),
),
dict(
field="code:programmingLanguage",
ui_widget="AutocompleteDropdown",
props=dict(
label="Programming language",
label=_("Programming language"),
icon="code",
description="Repository's programming language.",
placeholder="e.g. Python ...",
description=_("Repository's programming language."),
placeholder=_("e.g. Python ..."),
autocompleteFrom="/api/vocabularies/code:programmingLanguages",
autocompleteFromAcceptHeader="application/vnd.inveniordm.v1+json",
required=False,
Expand All @@ -81,10 +82,10 @@
field="code:developmentStatus",
ui_widget="Dropdown",
props=dict(
label="Development Status",
placeholder="Repository status",
label=_("Development Status"),
placeholder=_("Repository status"),
icon="heartbeat",
description="Repository current status.",
description=_("Repository current status."),
search=False,
multiple=False,
clearable=True,
Expand Down
9 changes: 5 additions & 4 deletions invenio_rdm_records/contrib/journal/custom_fields.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#
# 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.
Expand Down Expand Up @@ -86,22 +87,22 @@ def mapping(self):
},
"volume": {
"label": _("Volume"),
"placeholder": "e.g. 645",
"placeholder": _("e.g. 645"),
"description": "",
},
"issue": {
"label": _("Issue"),
"placeholder": "e.g. 7",
"placeholder": _("e.g. 7"),
"description": "",
},
"pages": {
"label": _("Page range or article number"),
"placeholder": "e.g. 15-23 or A29",
"placeholder": _("e.g. 15-23 or A29"),
"description": "",
},
"issn": {
"label": _("ISSN"),
"placeholder": "e.g. 2077-9550",
"placeholder": _("e.g. 2077-9550"),
"description": _("International Standard Serial Number"),
},
"icon": "newspaper outline",
Expand Down
3 changes: 2 additions & 1 deletion invenio_rdm_records/contrib/meeting/custom_fields.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#
# 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.
Expand Down Expand Up @@ -40,7 +41,7 @@ def field(self):
"session": SanitizedUnicode(),
"title": SanitizedUnicode(),
"url": SanitizedUnicode(
validate=_valid_url(error_msg="You must provide a valid URL."),
validate=_valid_url(error_msg=_("You must provide a valid URL.")),
),
}
)
Expand Down
6 changes: 4 additions & 2 deletions invenio_rdm_records/jobs/jobs.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# -*- coding: utf-8 -*-
#
# 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.

"""Jobs definition module."""

from invenio_i18n import lazy_gettext as _
from invenio_jobs.jobs import JobType

from invenio_rdm_records.services.tasks import update_expired_embargos
Expand All @@ -16,6 +18,6 @@
job_cls_name="UpdateEmbargoesJob",
id_="update_expired_embargos",
task=update_expired_embargos,
description="Updates expired embargos",
title="Update expired embargoes",
description=_("Updates expired embargoes"),
title=_("Update expired embargoes"),
)
4 changes: 3 additions & 1 deletion invenio_rdm_records/oaiserver/services/schema.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# -*- coding: utf-8 -*-
#
# Copyright (C) 2022 Graz University of Technology.
# 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.

"""OAI-PMH API schemas."""

from invenio_i18n import lazy_gettext as _
from marshmallow import EXCLUDE, Schema, fields, validate
from marshmallow_utils.fields import SanitizedUnicode

Expand All @@ -25,7 +27,7 @@ class OAIPMHSetSchema(Schema):
description = SanitizedUnicode(load_default=None, dump_default=None)
name = SanitizedUnicode(required=True, validate=validate.Length(min=1, max=255))
search_pattern = SanitizedUnicode(
required=True, metadata={"title": "Search pattern"}
required=True, metadata={"title": _("Search pattern")}
)
spec = SanitizedUnicode(
required=True,
Expand Down
Loading
Loading