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 Missing Translations #290

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
4 changes: 3 additions & 1 deletion invenio_drafts_resources/resources/records/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Copyright (C) 2021 CERN.
# Copyright (C) 2021 TU Wien.
# Copyright (C) 2024 KTH Royal Institute of Technology.
#
# Invenio-Drafts-Resources 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 @@ -12,6 +13,7 @@
import json

from flask_resources.errors import HTTPJSONException
from invenio_i18n import lazy_gettext as _
from invenio_pidstore.errors import PIDDoesNotExistError


Expand All @@ -28,7 +30,7 @@ class RedirectException(HTTPJSONException):
def __init__(self, location, **kwargs):
"""Constructor."""
self.location = location
kwargs.setdefault("description", "Redirecting...")
kwargs.setdefault("description", _("Redirecting..."))
super().__init__(**kwargs)

def get_headers(self, environ=None, scope=None):
Expand Down
8 changes: 5 additions & 3 deletions invenio_drafts_resources/services/records/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# Copyright (C) 2020-2023 CERN.
# Copyright (C) 2020 Northwestern University.
# Copyright (C) 2024 KTH Royal Institute of Technology.
#
# Invenio-Drafts-Resources 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 @@ -11,6 +12,7 @@

from flask import current_app
from invenio_db import db
from invenio_i18n import gettext as _
from invenio_pidstore.errors import PIDDoesNotExistError
from invenio_records_resources.services import LinksTemplate
from invenio_records_resources.services import RecordService as RecordServiceBase
Expand Down Expand Up @@ -98,7 +100,7 @@ def draft_indexer(self):

def update(self, *args, **kwargs):
"""Do not use."""
raise NotImplementedError("Records should be updated via their draft.")
raise NotImplementedError(_("Records should be updated via their draft."))

def search_drafts(
self,
Expand Down Expand Up @@ -244,7 +246,7 @@ def read_latest(self, identity, id_, expand=False):
if version_state and version_state.latest_id:
record = self.record_cls.get_record(version_state.latest_id)
else:
raise NoResultFound("Failed to fetch the record versions.")
raise NoResultFound(_("Failed to fetch the record versions."))

self.require_permission(identity, "read", record=record)

Expand Down Expand Up @@ -504,7 +506,7 @@ def delete_draft(self, identity, id_, revision_id=None, uow=None):
def import_files(self, identity, id_, uow=None):
"""Import files from previous record version."""
if self.draft_files is None:
raise RuntimeError("Files support is not enabled.")
raise RuntimeError(_("Files support is not enabled."))

# Read draft
draft = self.draft_cls.pid.resolve(id_, registered_only=False)
Expand Down