Skip to content

Commit

Permalink
i18n: add translation for invenio-github-init
Browse files Browse the repository at this point in the history
  • Loading branch information
Samk13 committed Oct 25, 2024
1 parent f98ade2 commit b512418
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
18 changes: 9 additions & 9 deletions invenio_github/assets/semantic-ui/js/invenio_github/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// This file is part of InvenioGithub
// Copyright (C) 2023 CERN.
// Copyright (C) 2024 KTH Royal Institute of Technology.
//
// Invenio Github 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 @@ if (sync_button) {
resultMessage,
"positive",
"checkmark",
"Repositories synced successfully. Please reload the page."
translations.repositories_synced
);
sync_button.classList.remove("disabled");
setTimeout(function () {
Expand All @@ -86,7 +87,7 @@ if (sync_button) {
resultMessage,
"negative",
"cancel",
`Request failed with status code: ${response.status}`
`${translations.request_failed} ${response.status}`
);
setTimeout(function () {
resultMessage.classList.add("hidden");
Expand All @@ -100,15 +101,14 @@ if (sync_button) {
resultMessage,
"warning",
"hourglass",
"This action seems to take some time, refresh the page after several minutes to inspect the synchronisation."
translations.timeout_message
);
}
else {
} else {
addResultMessage(
resultMessage,
"negative",
"cancel",
`There has been a problem: ${error}`
`${translations.problem_occurred} ${error}`
);
setTimeout(function () {
resultMessage.classList.add("hidden");
Expand Down Expand Up @@ -158,7 +158,7 @@ function sendEnableDisableRequest(checked, repo) {
switchMessage,
"positive",
"checkmark",
"Repository synced successfully. Please reload the page."
translations.repo_sync_success
);
setTimeout(function () {
switchMessage.classList.add("hidden");
Expand All @@ -168,7 +168,7 @@ function sendEnableDisableRequest(checked, repo) {
switchMessage,
"negative",
"cancel",
`Request failed with status code: ${response.status}`
`${translations.request_failed} ${response.status}`
);
setTimeout(function () {
switchMessage.classList.add("hidden");
Expand All @@ -179,7 +179,7 @@ function sendEnableDisableRequest(checked, repo) {
switchMessage,
"negative",
"cancel",
`There has been a problem: ${error}`
`${translations.problem_occurred} ${error}`
);
setTimeout(function () {
switchMessage.classList.add("hidden");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,24 @@

This file is part of Invenio.
Copyright (C) 2023 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.
#}
{%- extends "invenio_github/base.html" %}

{# We place the translations before any content in page_body loads.#}
{% block translations %}
<script type="text/javascript">
const translations = {
"repositories_synced": "{{ _('Repositories synced successfully. Please reload the page.') }}",
"request_failed": "{{ _('Request failed with status code:') }}",
"timeout_message": "{{ _('This action seems to take some time, refresh the page after several minutes to inspect the synchronisation.') }}",
"problem_occurred": "{{ _('There has been a problem:') }}",
"repo_sync_success": "{{ _('Repository synced successfully. Please reload the page.') }}",
};
</script>
{% endblock %}
{%- block page_body %}
{%- block settings_content %}
{%- endblock settings_content %}
Expand Down

0 comments on commit b512418

Please sign in to comment.