mirror of
https://github.com/HeyPuter/puter.git
synced 2026-11-05 13:35:20 +00:00
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.
This commit is contained in:
1 parent
ccfe1a4fd6
commit
cf5d15ea33
3 files changed
+11
-6
No files matched your search
@@ -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,
|
||||
|
||||
@@ -60,18 +60,18 @@ const new_context_menu_item = function (dirname, append_to_element) {
|
||||
},
|
||||
// Web Link
|
||||
{
|
||||
html: 'Web Link',
|
||||
html: i18n('web_link'),
|
||||
icon: `<img src="${html_encode(window.icons['link.svg'])}" class="ctx-item-icon ctx-item-icon-monochrome">`,
|
||||
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: `<img src="${html_encode(window.icons['file-template.svg'])}" class="ctx-item-icon">`,
|
||||
items: window.file_templates.map(template => ({
|
||||
html: template.html,
|
||||
|
||||
@@ -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',
|
||||
|
||||
Reference in new issue
Block a user