Work on translation

This commit is contained in:
Yokayo
2025-01-12 00:42:58 +07:00
parent f462436450
commit 1d5cf8d25c
8 changed files with 188 additions and 77 deletions

View File

@ -682,9 +682,9 @@ function getExtensionData(extension) {
* @return {string} - The HTML string for the module information.
*/
function getModuleInformation() {
let moduleInfo = modules.length ? `<p>${DOMPurify.sanitize(modules.join(', '))}</p>` : '<p class="failure">Not connected to the API!</p>';
let moduleInfo = modules.length ? `<p>${DOMPurify.sanitize(modules.join(', '))}</p>` : '<p class="failure">' + t`Not connected to the API!` + '</p>';
return `
<h3>Modules provided by your Extras API:</h3>
<h3>` + t`Modules provided by your Extras API:` + `</h3>
${moduleInfo}
`;
}
@ -703,11 +703,11 @@ async function showExtensionsDetails() {
initialScrollTop = oldPopup.content.scrollTop;
await oldPopup.completeCancelled();
}
const htmlDefault = $('<div class="marginBot10"><h3 class="textAlignCenter">Built-in Extensions:</h3></div>');
const htmlExternal = $('<div class="marginBot10"><h3 class="textAlignCenter">Installed Extensions:</h3></div>');
const htmlDefault = $('<div class="marginBot10"><h3 class="textAlignCenter">' + t`Built-in Extensions:` + '</h3></div>');
const htmlExternal = $('<div class="marginBot10"><h3 class="textAlignCenter">' + t`Installed Extensions:` + '</h3></div>');
const htmlLoading = $(`<div class="flex-container alignItemsCenter justifyCenter marginTop10 marginBot5">
<i class="fa-solid fa-spinner fa-spin"></i>
<span>Loading third-party extensions... Please wait...</span>
<span>` + t`Loading third-party extensions... Please wait...` + `</span>
</div>`);
htmlExternal.append(htmlLoading);
@ -728,7 +728,7 @@ async function showExtensionsDetails() {
/** @type {import('./popup.js').CustomPopupButton} */
const updateAllButton = {
text: 'Update all',
text: t`Update all`,
appendAtEnd: true,
action: async () => {
requiresReload = true;
@ -740,7 +740,7 @@ async function showExtensionsDetails() {
let waitingForSave = false;
const popup = new Popup(html, POPUP_TYPE.TEXT, '', {
okButton: 'Close',
okButton: t`Close`,
wide: true,
large: true,
customButtons: [updateAllButton],
@ -833,7 +833,7 @@ async function updateExtension(extensionName, quiet) {
toastr.success('Extension is already up to date');
}
} else {
toastr.success(`Extension ${extensionName} updated to ${data.shortCommitHash}`, 'Reload the page to apply updates');
toastr.success(t`Extension ${extensionName} updated to ${data.shortCommitHash}`, t`Reload the page to apply updates`);
}
} catch (error) {
console.error('Error:', error);
@ -1001,7 +1001,7 @@ export async function installExtension(url, global) {
}
const response = await request.json();
toastr.success(`Extension "${response.display_name}" by ${response.author} (version ${response.version}) has been installed successfully!`, 'Extension installation successful');
toastr.success(t`Extension '${response.display_name}' by ${response.author} (version ${response.version}) has been installed successfully!`, t`Extension installation successful`);
console.debug(`Extension "${response.display_name}" has been installed successfully at ${response.extensionPath}`);
await loadExtensionSettings({}, false, false);
await eventSource.emit(event_types.EXTENSION_SETTINGS_LOADED);
@ -1175,7 +1175,7 @@ async function checkForExtensionUpdates(force) {
await Promise.allSettled(promises);
if (updatesAvailable.length > 0) {
toastr.info(`${updatesAvailable.map(x => `${x}`).join('\n')}`, 'Extension updates available');
toastr.info(`${updatesAvailable.map(x => `${x}`).join('\n')}`, t`Extension updates available`);
}
}
@ -1189,7 +1189,7 @@ async function autoUpdateExtensions(forceAll) {
return;
}
const banner = toastr.info('Auto-updating extensions. This may take several minutes.', 'Please wait...', { timeOut: 10000, extendedTimeOut: 10000 });
const banner = toastr.info(t`Auto-updating extensions. This may take several minutes.`, t`Please wait...`, { timeOut: 10000, extendedTimeOut: 10000 });
const isCurrentUserAdmin = isAdmin();
const promises = [];
for (const [id, manifest] of Object.entries(manifests)) {