Skip to content

Commit

Permalink
Revert "i18n: add translation for invenio-github-init"
Browse files Browse the repository at this point in the history
* reverting for unable to test it locally.
  • Loading branch information
Samk13 committed Oct 27, 2024
1 parent cea0080 commit 0a21287
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 30 deletions.
26 changes: 9 additions & 17 deletions invenio_github/assets/semantic-ui/js/invenio_github/index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// 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 All @@ -13,14 +12,6 @@ function addResultMessage(element, color, icon, message) {
element.querySelector(".content").textContent = message;
}

const gh_translations = window.gh_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 synchronization.",
problem_occurred: "There has been a problem:",
repo_sync_success: "Repository synced successfully. Please reload the page."
};

// function from https://www.w3schools.com/js/js_cookies.asp
function getCookie(cname) {
let name = cname + "=";
Expand Down Expand Up @@ -84,7 +75,7 @@ if (sync_button) {
resultMessage,
"positive",
"checkmark",
gh_translations?.repositories_synced
"Repositories synced successfully. Please reload the page."
);
sync_button.classList.remove("disabled");
setTimeout(function () {
Expand All @@ -95,7 +86,7 @@ if (sync_button) {
resultMessage,
"negative",
"cancel",
`${gh_translations?.request_failed} ${response.status}`
`Request failed with status code: ${response.status}`
);
setTimeout(function () {
resultMessage.classList.add("hidden");
Expand All @@ -109,14 +100,15 @@ if (sync_button) {
resultMessage,
"warning",
"hourglass",
gh_translations?.timeout_message
"This action seems to take some time, refresh the page after several minutes to inspect the synchronisation."
);
} else {
}
else {
addResultMessage(
resultMessage,
"negative",
"cancel",
`${gh_translations?.problem_occurred} ${error}`
`There has been a problem: ${error}`
);
setTimeout(function () {
resultMessage.classList.add("hidden");
Expand Down Expand Up @@ -166,7 +158,7 @@ function sendEnableDisableRequest(checked, repo) {
switchMessage,
"positive",
"checkmark",
gh_translations?.repo_sync_success
"Repository synced successfully. Please reload the page."
);
setTimeout(function () {
switchMessage.classList.add("hidden");
Expand All @@ -176,7 +168,7 @@ function sendEnableDisableRequest(checked, repo) {
switchMessage,
"negative",
"cancel",
`${gh_translations?.request_failed} ${response.status}`
`Request failed with status code: ${response.status}`
);
setTimeout(function () {
switchMessage.classList.add("hidden");
Expand All @@ -187,7 +179,7 @@ function sendEnableDisableRequest(checked, repo) {
switchMessage,
"negative",
"cancel",
`${gh_translations?.problem_occurred} ${error}`
`There has been a problem: ${error}`
);
setTimeout(function () {
switchMessage.classList.add("hidden");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,12 @@

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">
window.gh_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 0a21287

Please sign in to comment.