From dcbca2f829e0bbef5065dd0acf3d9d78a841caab Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Wed, 3 Jul 2024 13:05:39 -0700 Subject: [PATCH] Add `i18n` keys for multiple terms --- src/UI/Settings/UITabLanguage.js | 2 +- src/UI/UIWindow.js | 22 +++++++++++----------- src/helpers/launch_app.js | 2 +- src/i18n/translations/en.js | 10 +++++++++- 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/UI/Settings/UITabLanguage.js b/src/UI/Settings/UITabLanguage.js index c65f611be..dfadec993 100644 --- a/src/UI/Settings/UITabLanguage.js +++ b/src/UI/Settings/UITabLanguage.js @@ -28,7 +28,7 @@ export default { // search h += `
- +
`; // list of languages diff --git a/src/UI/UIWindow.js b/src/UI/UIWindow.js index 0afbd0227..408231843 100644 --- a/src/UI/UIWindow.js +++ b/src/UI/UIWindow.js @@ -263,13 +263,13 @@ async function UIWindow(options) { draggable="false" >`; // favorites - h += `

Favorites

`; - h += `
Home
`; - h += `
Documents
`; - h += `
Public
`; - h += `
Pictures
`; - h += `
Desktop
`; - h += `
Videos
`; + h += `

${i18n('favorites')}

`; + h += `
${i18n('home')}
`; + h += `
${i18n('documents')}
`; + h += `
${i18n('public')}
`; + h += `
${i18n('pictures')}
`; + h += `
${i18n('desktop')}
`; + h += `
${i18n('videos')}
`; h += ``; } @@ -862,7 +862,7 @@ async function UIWindow(options) { // build item for context menu items.push({ - html: `${history_item === window.home_path ? 'Home' : path.basename(history_item)}`, + html: `${history_item === window.home_path ? i18n('home') : path.basename(history_item)}`, val: index, onClick: async function(e){ let history_index = e.value; @@ -2828,10 +2828,10 @@ window.update_window_path = async function(el_window, target_path){ $(el_window).find('.window-head-title').text('Desktop') }else if (target_path === window.home_path){ $(el_window).find('.window-head-icon').attr('src', window.icons['folder-home.svg']); - $(el_window).find('.window-head-title').text('Home') + $(el_window).find('.window-head-title').text(i18n('home')) }else if (target_path === window.docs_path){ $(el_window).find('.window-head-icon').attr('src', window.icons['folder-documents.svg']); - $(el_window).find('.window-head-title').text('Documents') + $(el_window).find('.window-head-title').text(i18n('documents')) }else if (target_path === window.public_path){ $(el_window).find('.window-head-icon').attr('src', window.icons['folder-public.svg']); $(el_window).find('.window-head-title').text('Public') @@ -2864,7 +2864,7 @@ window.update_window_path = async function(el_window, target_path){ $(el_window_item_container).attr('data-uid', fsentry.id); // title if (target_path === window.home_path) - $(el_window).find('.window-head-title').text('Home') + $(el_window).find('.window-head-title').text(i18n('home')) else $(el_window).find('.window-head-title').text(fsentry.name); // data-name diff --git a/src/helpers/launch_app.js b/src/helpers/launch_app.js index 2def610ba..79adde615 100644 --- a/src/helpers/launch_app.js +++ b/src/helpers/launch_app.js @@ -108,7 +108,7 @@ const launch_app = async (options)=>{ const svc_process = globalThis.services.get('process'); svc_process.register(process); if(options.path === window.home_path){ - title = 'Home'; + title = i18n('home'); icon = window.icons['folder-home.svg']; } else if(options.path === window.trash_path){ diff --git a/src/i18n/translations/en.js b/src/i18n/translations/en.js index 96ed9218f..d9130541c 100644 --- a/src/i18n/translations/en.js +++ b/src/i18n/translations/en.js @@ -46,7 +46,6 @@ const en = { close_all_windows_and_log_out: 'Close Windows and Log Out', change_always_open_with: "Do you want to always open this type of file with", color: 'Color', - hue: 'Hue', confirm_2fa_setup: 'I have added the code to my authenticator app', confirm_2fa_recovery: 'I have saved my recovery codes in a secure location', confirm_account_for_free_referral_storage_c2a: 'Create an account and confirm your email address to receive 1 GB of free storage. Your friend will get 1 GB of free storage too.', @@ -92,6 +91,7 @@ const en = { deleting_file: "Deleting %%", deploy_as_app: 'Deploy as app', descending: 'Descending', + desktop: 'Desktop', desktop_background_fit: "Fit", developers: "Developers", dir_published_as_website: `%strong% has been published to:`, @@ -99,6 +99,7 @@ const en = { disable_2fa_confirm: "Are you sure you want to disable 2FA?", disable_2fa_instructions: "Enter your password to disable 2FA.", disassociate_dir: "Disassociate Directory", + documents: 'Documents', download: 'Download', download_file: 'Download File', downloading: "Downloading", @@ -118,6 +119,7 @@ const en = { enter_password_to_confirm_delete_user: "Enter your password to confirm account deletion", error_unknown_cause: "An unknown error occurred.", error_uploading_files: "Failed to upload files", + favorites: "Favorites", feedback: "Feedback", feedback_c2a: "Please use the form below to send us your feedback, comments, and bug reports.", feedback_sent_confirmation: "Thank you for contacting us. If you have an email associated with your account, you will hear back from us as soon as possible.", @@ -129,7 +131,9 @@ const en = { get_a_copy_of_on_puter: `Get a copy of '%%' on Puter.com!`, get_copy_link: 'Get Copy Link', hide_all_windows: "Hide All Windows", + home: 'Home', html_document: 'HTML document', + hue: 'Hue', image: 'Image', incorrect_password: "Incorrect password", invite_link: "Invite Link", @@ -188,6 +192,7 @@ const en = { personalization: "Personalization", pick_name_for_website: "Pick a name for your website:", picture: "Picture", + pictures: 'Pictures', plural_suffix: 's', powered_by_puter_js: `Powered by {{link=docs}}Puter.js{{/link}}`, preparing: "Preparing...", @@ -202,6 +207,7 @@ const en = { process_type_init: 'Init', process_type_ui: 'UI', properties: "Properties", + public: 'Public', publish: "Publish", publish_as_website: 'Publish as website', puter_description: `Puter is a privacy-first personal cloud to keep all your files, apps, and games in one secure place, accessible from anywhere at any time.`, @@ -231,6 +237,7 @@ const en = { scan_qr_c2a: 'Scan the code below\nto log into this session from other devices', scan_qr_2fa: 'Scan the QR code with your authenticator app', scan_qr_generic: 'Scan this QR code using your phone or another device', + search: 'Search', seconds: 'seconds', security: "Security", select: "Select", @@ -284,6 +291,7 @@ const en = { username_changed: 'Username updated successfully.', username_required: 'Username is required.', versions: "Versions", + videos: 'Videos', visibility: 'Visibility', yes: 'Yes', yes_release_it: 'Yes, Release It',