Skip to content

Commit

Permalink
[BUGFIX] Only update translations list on translation task
Browse files Browse the repository at this point in the history
  • Loading branch information
Sascha Löffler committed Jul 11, 2024
1 parent ec5302b commit d58d748
Showing 1 changed file with 20 additions and 18 deletions.
38 changes: 20 additions & 18 deletions Resources/Public/JavaScript/AjaxMetaGenerate.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,24 +158,26 @@ function callAjaxMetaSaveAction(fileIdentifier, textarea, doTranslate, button, b
if (response && response.saved) {

// html list of all translations from response.translations
let otherLanguages = blockElement.querySelector('.otherLanguages');
otherLanguages.innerHTML = '';
let ul = document.createElement('ul');
response.translations.forEach((translation) => {
let li = document.createElement('li');
let img = document.createElement('img');
let link = document.createElement('a');
img.src = '/typo3/sysext/core/Resources/Public/Icons/Flags/' + translation.languageFlagIdentifier + '.webp'; // Adjust the path as necessary
img.title = translation.title;
li.appendChild(img);

link.href = translation.editLink + '&returnUrl=' + encodeURIComponent(currentUrl);
link.textContent = ' ' + translation.altTextTranslated;
li.appendChild(link);
ul.appendChild(li);

otherLanguages.appendChild(ul);
});
if (doTranslate) {
let otherLanguages = blockElement.querySelector('.otherLanguages');
otherLanguages.innerHTML = '';
let ul = document.createElement('ul');
response.translations.forEach((translation) => {
let li = document.createElement('li');
let img = document.createElement('img');
let link = document.createElement('a');
img.src = '/typo3/sysext/core/Resources/Public/Icons/Flags/' + translation.languageFlagIdentifier + '.webp'; // Adjust the path as necessary
img.title = translation.title;
li.appendChild(img);

link.href = translation.editLink + '&returnUrl=' + encodeURIComponent(currentUrl);
link.textContent = ' ' + translation.altTextTranslated;
li.appendChild(link);
ul.appendChild(li);

otherLanguages.appendChild(ul);
});
}

top.TYPO3.Notification.success('Saved Metadata', 'Saved Metadata successful', 5);
button.dispatchEvent(new CustomEvent('ajaxComplete'));
Expand Down

0 comments on commit d58d748

Please sign in to comment.