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: Fix untranslated strings in vocabularies #449

Open
wants to merge 2 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
16 changes: 7 additions & 9 deletions invenio_vocabularies/administration/views/vocabularies.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,20 @@

"""Vocabularies admin interface."""

from invenio_administration.views.base import (
AdminResourceEditView,
AdminResourceListView,
)
from invenio_administration.views.base import AdminResourceListView
from invenio_i18n import lazy_gettext as _


class VocabulariesListView(AdminResourceListView):
"""Configuration for vocabularies list view."""

api_endpoint = "/vocabularies/"
name = "vocabulary-types"
menu_label = "Vocabulary Types"
menu_label = _("Vocabulary Types")
resource_config = "vocabulary_admin_resource"
search_request_headers = {"Accept": "application/json"}
title = "Vocabulary Types"
category = "Site management"
title = _("Vocabulary Types")
category = _("Site management")

pid_path = "id"
icon = "exchange"
Expand All @@ -36,8 +34,8 @@ class VocabulariesListView(AdminResourceListView):
display_create = False

item_field_list = {
"id": {"text": "Name", "order": 1},
"count": {"text": "Number of entries", "order": 2},
"id": {"text": _("Name"), "order": 1},
"count": {"text": _("Number of entries"), "order": 2},
}

search_config_name = "VOCABULARIES_TYPES_SEARCH"
Expand Down
22 changes: 11 additions & 11 deletions invenio_vocabularies/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import datetime

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

from invenio_vocabularies.services.tasks import process_datastream
Expand All @@ -27,8 +27,8 @@ class ProcessDataStreamJob(JobType):
class ProcessRORAffiliationsJob(ProcessDataStreamJob):
"""Process ROR affiliations datastream registered task."""

description = "Process ROR affiliations"
title = "Load ROR affiliations"
description = _("Process ROR affiliations")
title = _("Load ROR affiliations")
id = "process_ror_affiliations"

@classmethod
Expand Down Expand Up @@ -65,8 +65,8 @@ def build_task_arguments(cls, job_obj, since=None, **kwargs):
class ProcessRORFundersJob(ProcessDataStreamJob):
"""Process ROR funders datastream registered task."""

description = "Process ROR funders"
title = "Load ROR funders"
description = _("Process ROR funders")
title = _("Load ROR funders")
id = "process_ror_funders"

@classmethod
Expand Down Expand Up @@ -103,8 +103,8 @@ def build_task_arguments(cls, job_obj, since=None, **kwargs):
class ImportAwardsOpenAIREJob(ProcessDataStreamJob):
"""Import awards from OpenAIRE registered task."""

description = "Import awards from OpenAIRE"
title = "Import Awards OpenAIRE"
description = _("Import awards from OpenAIRE")
title = _("Import Awards OpenAIRE")
id = "import_awards_openaire"

@classmethod
Expand Down Expand Up @@ -138,8 +138,8 @@ def build_task_arguments(cls, job_obj, since=None, **kwargs):
class UpdateAwardsCordisJob(ProcessDataStreamJob):
"""Update awards from CORDIS registered task."""

description = "Update awards from CORDIS"
title = "Update Awards CORDIS"
description = _("Update awards from CORDIS")
title = _("Update Awards CORDIS")
id = "update_awards_cordis"

@classmethod
Expand All @@ -166,8 +166,8 @@ def build_task_arguments(cls, job_obj, since=None, **kwargs):
class ImportORCIDJob(ProcessDataStreamJob):
"""Import ORCID data registered task."""

description = "Import ORCID data"
title = "Import ORCID data"
description = _("Import ORCID data")
title = _("Import ORCID data")
id = "import_orcid"

@classmethod
Expand Down
3 changes: 2 additions & 1 deletion invenio_vocabularies/records/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"""Vocabulary models."""

from invenio_db import db
from invenio_i18n import gettext as _
from invenio_records.models import RecordMetadataBase


Expand Down Expand Up @@ -79,7 +80,7 @@ def create(cls, **data):
"""Create a new vocabulary subtype."""
banned = [",", ":"]
for b in banned:
assert b not in data["id"], f"No '{b}' allowed in VocabularyScheme.id"
assert b not in data["id"], _("No '%(banned_char)s' allowed in VocabularyScheme.id", banned_char=b)

with db.session.begin_nested():
obj = cls(**data)
Expand Down
8 changes: 4 additions & 4 deletions invenio_vocabularies/services/custom_fields/subject.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,12 @@ def mapping(self):
ui_widget="SubjectAutocompleteDropdown",
isGenericVocabulary=False,
props=dict(
label="Keywords and subjects",
label=_("Keywords and subjects"),
icon="tag",
description="The subjects related to the community",
placeholder="Search for a subject by name e.g. Psychology ...",
description=_("The subjects related to the community"),
placeholder=_("Search for a subject by name e.g. Psychology ..."),
autocompleteFrom="api/subjects",
noQueryMessage="Search for subjects...",
noQueryMessage=_("Search for subjects..."),
autocompleteFromAcceptHeader="application/vnd.inveniordm.v1+json",
required=False,
multiple=True,
Expand Down