From cf5d15ea33459e06e43d61190e227646ceaa0cbc Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Fri, 23 Oct 2026 14:47:51 -0700 Subject: [PATCH] fix(dashboard): translate the New menu's Web Link and templates strings "Web Link", its URL prompt, validation and failure messages, the "User templates" submenu, and the account prompt before publishing a worker were hardcoded English in the Files New and item menus. --- src/gui/src/helpers/generateFileContextMenu.js | 2 +- src/gui/src/helpers/newContextMenuItem.js | 10 +++++----- src/gui/src/i18n/translations/en.js | 5 +++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/gui/src/helpers/generateFileContextMenu.js b/src/gui/src/helpers/generateFileContextMenu.js index 0783ded5b..af81ab481 100644 --- a/src/gui/src/helpers/generateFileContextMenu.js +++ b/src/gui/src/helpers/generateFileContextMenu.js @@ -162,7 +162,7 @@ const generate_file_context_menu = async function (options) { if ( window.user.is_temp && !await UIWindowSaveAccount({ send_confirmation_code: true, - message: 'Please create an account to proceed.', + message: i18n('save_account_to_publish'), window_options: { backdrop: true, close_on_backdrop_click: false, diff --git a/src/gui/src/helpers/newContextMenuItem.js b/src/gui/src/helpers/newContextMenuItem.js index 494ae8b29..86261f1b5 100644 --- a/src/gui/src/helpers/newContextMenuItem.js +++ b/src/gui/src/helpers/newContextMenuItem.js @@ -60,18 +60,18 @@ const new_context_menu_item = function (dirname, append_to_element) { }, // Web Link { - html: 'Web Link', + html: i18n('web_link'), icon: ``, onClick: async function () { // Prompt user for URL const url = await UIPrompt({ - message: 'Enter the URL for the web link:', + message: i18n('web_link_url_prompt', [], false), placeholder: 'https://example.com', defaultValue: 'https://', validator: (value) => { // Simple URL validation return value.startsWith('http://') || value.startsWith('https://') ? - true : 'Please enter a valid URL starting with http:// or https://'; + true : i18n('web_link_invalid_url', [], false); }, }); @@ -130,7 +130,7 @@ const new_context_menu_item = function (dirname, append_to_element) { }); } catch ( error ) { console.error('Error creating web link:', error); - UIAlert(`Error creating web link: ${ error.message}`); + UIAlert(i18n('web_link_create_failed', [error.message], false)); } } }, @@ -187,7 +187,7 @@ router.get('/*page', ({request, params}) => { // User templates baseItems.push({ - html: 'User templates', + html: i18n('user_templates'), icon: ``, items: window.file_templates.map(template => ({ html: template.html, diff --git a/src/gui/src/i18n/translations/en.js b/src/gui/src/i18n/translations/en.js index 080d114b8..ba34c1d37 100644 --- a/src/gui/src/i18n/translations/en.js +++ b/src/gui/src/i18n/translations/en.js @@ -913,6 +913,11 @@ const en = { 'item_shared_by_you': 'You have shared this item with at least one other user.', 'item_shortcut': 'Shortcut', 'item_already_exists': '%strong% already exists.', + 'web_link': 'Web Link', + 'web_link_url_prompt': 'Enter the URL for the web link:', + 'web_link_invalid_url': 'Please enter a valid URL starting with http:// or https://', + 'web_link_create_failed': 'Error creating web link: %%', + 'user_templates': 'User templates', 'item_associated_websites': 'Associated website', 'item_associated_websites_plural': 'Associated websites', 'no_suitable_apps_found': 'No suitable apps found',