Explorar el Código

Translation WIP

Sondre Njåstad hace 1 año
padre
commit
592a30ca6d

+ 5 - 5
src/IPC.js

@@ -881,12 +881,12 @@ window.addEventListener('message', async (event) => {
                                     message: `<strong>${html_encode(err.entry_name)}</strong> already exists.`,
                                     buttons:[
                                         {
-                                            label: 'Replace',
+                                            label: i18n('replace'),
                                             value: 'replace',
                                             type: 'primary',
                                         },
                                         {
-                                            label: 'Cancel',
+                                            label: i18n('cancel'),
                                             value: 'cancel',
                                         },
                                     ],
@@ -1032,18 +1032,18 @@ window.addEventListener('message', async (event) => {
                             message: `<strong>${html_encode(err.entry_name)}</strong> already exists.`,
                             buttons:[
                                 {
-                                    label: 'Replace',
+                                    label: i18n('replace'),
                                     type: 'primary',
                                 },
                                 {
-                                    label: 'Cancel'
+                                    label: i18n('cancel')
                                 },
                             ],
                             parent_uuid: event.data.appInstanceID,
                         })
                         if(alert_resp === 'Replace'){
                             overwrite = true;
-                        }else if(alert_resp === 'Cancel'){
+                        }else if(alert_resp === 'cancel'){
                             item_with_same_name_already_exists = false;
                         }
                     }else{

+ 1 - 1
src/UI/UIAlert.js

@@ -37,7 +37,7 @@ function UIAlert(options){
         // provide an 'OK' button if no buttons are provided
         if(!options.buttons || options.buttons.length === 0){
             options.buttons = [
-                {label: 'OK', value: true, type: 'primary'}
+                {label: i18n('ok'), value: true, type: 'primary'}
             ]
         }
 

+ 7 - 7
src/UI/UIDesktop.js

@@ -1197,18 +1197,18 @@ $(document).on('click', '.user-options-menu-btn', async function(e){
                     // see if there are any open windows, if yes notify user
                     if($('.window-app').length > 0){
                         const alert_resp = await UIAlert({
-                            message: `<p>You have open apps. Are you sure you want to log out?</p>`,
+                            message: `<p></p>`,
                             buttons:[
                                 {
-                                    label: 'Close Windows and Log Out',
+                                    label: i18n('close_all_Windows_and_log_out'),
                                     type: 'primary',
                                 },
                                 {
-                                    label: 'Cancel'
+                                    label: i18n('cancel')
                                 },
                             ]
                         })
-                        if(alert_resp === 'Close Windows and Log Out')
+                        if(alert_resp === i18n('close_all_Windows_and_log_out'))
                             logout();
                     }
                     // no open windows
@@ -1285,16 +1285,16 @@ $(document).on('click', '.user-options-login-btn', async function(e){
         message: `<strong>Save session before exiting!</strong><p>You are in a temporary session and logging into another account will erase all data in your current session.</p>`,
         buttons:[
             {
-                label: 'Save session',
+                label: i18n('save_session'),
                 value: 'save-session',
                 type: 'primary',
             },
             {
-                label: 'Log into another account anyway',
+                label: i18n('log_into_another_account_anyway'),
                 value: 'login',
             },
             {
-                label: 'Cancel'
+                label: i18n('cancel')
             },
         ]
     })

+ 7 - 7
src/UI/UIItem.js

@@ -159,7 +159,7 @@ function UIItem(options){
         h += `</div>`;
 
         // name
-        h += `<span class="item-name" data-item-id="${item_id}" title="${html_encode(options.name)}">${html_encode(truncate_filename(options.name, TRUNCATE_LENGTH)).replaceAll(' ', '&nbsp;')}</span>`
+        h += `<span class="item-name" data-item-id="${item_id}" title="${html_encode(options.name)}">${options.is_trash ? i18n('trash') : html_encode(truncate_filename(options.name, TRUNCATE_LENGTH)).replaceAll(' ', '&nbsp;')}</span>`
         // name editor
         h += `<textarea class="item-name-editor hide-scrollbar" spellcheck="false" autocomplete="off" autocorrect="off" autocapitalize="off" data-gramm_editor="false">${html_encode(options.name)}</textarea>`
     h += `</div>`;
@@ -827,14 +827,14 @@ function UIItem(options){
                     html: i18n('delete_permanently'),
                     onClick: async function(){
                         const alert_resp = await UIAlert({
-                            message: `Are you sure you want to permanently delete these items?`,
+                            message: i18n('confirm_delete_multiple_items'),
                             buttons:[
                                 {
-                                    label: 'Delete',
+                                    label: i18n('delete'),
                                     type: 'primary',
                                 },
                                 {
-                                    label: 'Cancel'
+                                    label: i18n('cancel')
                                 },
                             ]
                         })
@@ -1245,14 +1245,14 @@ function UIItem(options){
                     html: i18n('delete_permanently'),
                     onClick: async function(){
                         const alert_resp = await UIAlert({
-                            message: `Are you sure you want to permanently delete this item?`,
+                            message: ` you want to permanently delete this item?`,
                             buttons:[
                                 {
-                                    label: 'Delete',
+                                    label: i18n('delete'),
                                     type: 'primary',
                                 },
                                 {
-                                    label: 'Cancel'
+                                    label: i18n('cancel')
                                 },
                             ]
                         })

+ 2 - 2
src/UI/UIPrompt.js

@@ -37,7 +37,7 @@ function UIPrompt(options){
         // provide an 'OK' button if no buttons are provided
         if(!options.buttons || options.buttons.length === 0){
             options.buttons = [
-                {label: i18n('Cancel'), value: false, type: 'default'},
+                {label: i18n('cancel'), value: false, type: 'default'},
                 {label: i18n('OK'), value: true, type: 'primary'},
             ]
         }
@@ -52,7 +52,7 @@ function UIPrompt(options){
         // buttons
         if(options.buttons && options.buttons.length > 0){
             h += `<div style="overflow:hidden; margin-top:20px; float:right;">`;
-                h += `<button class="button button-default prompt-resp-button prompt-resp-btn-cancel" data-label="${i18n('Cancel')}" style="padding: 0 20px;">${i18n('Cancel')}</button>`;
+                h += `<button class="button button-default prompt-resp-button prompt-resp-btn-cancel" data-label="${i18n('cancel')}" style="padding: 0 20px;">${i18n('cancel')}</button>`;
                 h += `<button class="button button-primary prompt-resp-button prompt-resp-btn-ok" data-label="${i18n('OK')}" data-value="true" autofocus>${i18n('OK')}</button>`;
             h += `</div>`;
         }

+ 1 - 1
src/UI/UITaskbar.js

@@ -217,7 +217,7 @@ async function UITaskbar(options){
     UITaskbarItem({
         icon: trash.is_empty ? window.icons['trash.svg'] : window.icons['trash-full.svg'],
         app: 'trash',
-        name: 'Trash',
+        name: `${i18n('trash')}`,
         sortable: false,
         keep_in_taskbar: true,
         lock_keep_in_taskbar: true,

+ 4 - 4
src/UI/UIWindow.js

@@ -2018,19 +2018,19 @@ async function UIWindow(options) {
                         // Empty Trash
                         // -------------------------------------------
                         {
-                            html: "Empty Trash",
+                            html: i18n('empty_trash'),
                             disabled: false,
                             onClick: async function(){
                                 const alert_resp = await UIAlert({
                                     message: i18n('empty_trash_confirmation'),
                                     buttons:[
                                         {
-                                            label: 'Yes',
+                                            label: i18n('yes'),
                                             value: 'yes',
                                             type: 'primary',
                                         },
                                         {
-                                            label: 'No',
+                                            label: i18n('no'),
                                             value: 'no',
                                         },
                                     ]
@@ -2517,7 +2517,7 @@ window.navbar_path = (abs_path)=>{
     }
     let str = `${path_seperator_html}<span class="window-navbar-path-dirname" data-path="${html_encode('/')}">${html_encode(window.root_dirname)}</span>`;
     for(let k=1; k<dirs.length; k++){
-        str += `${path_seperator_html}<span class="window-navbar-path-dirname" data-path="${html_encode(dirpaths[k])}">${html_encode(dirs[k])}</span>`;
+        str += `${path_seperator_html}<span class="window-navbar-path-dirname" data-path="${html_encode(dirpaths[k])}">${dirs[k] === 'Trash' ? i18n('trash') : html_encode(dirs[k])}</span>`;
     }
     return str;
 }

+ 1 - 1
src/UI/UIWindowMyWebsites.js

@@ -144,7 +144,7 @@ $(document).on('click', '.mywebsites-site-setting', function(e){
                                 type: 'primary',
                             },
                             {
-                                label: 'Cancel'
+                                label: i18n('cancel')
                             },
                         ]
                     })

+ 1 - 1
src/UI/UIWindowNewPassword.js

@@ -116,7 +116,7 @@ async function UIWindowNewPassword(options){
                         backdrop: true,
                         buttons:[
                             {
-                                label: 'Proceed to Login',
+                                label: i18n('proceed_to_login'),
                                 type: 'primary',
                             },
                         ],

+ 18 - 18
src/helpers.js

@@ -1030,7 +1030,7 @@ window.show_save_account_notice_if_needed = function(message){
                         body_icon: window.icons['reminder.svg'],
                         buttons:[
                             {
-                                label: 'Save session',
+                                label: i18n('save_session'),
                                 value: 'save-session',
                                 type: 'primary',
                             },
@@ -1562,9 +1562,9 @@ window.copy_clipboard_items = async function(dest_path, dest_container_element){
                         const alert_resp = await UIAlert({
                             message: `<strong>${html_encode(err.entry_name)}</strong> already exists.`,
                             buttons:[
-                                {label: 'Replace', type: 'primary'},
-                                ... (clipboard.length > 1) ? [{label: 'Replace all'}] : [],
-                                ... (clipboard.length > 1) ? [{label: 'Skip'}] : [{label: 'Cancel'}],
+                                {label: i18n('replace'), type: 'primary'},
+                                ... (clipboard.length > 1) ? [{label: i18n('replace_all')}] : [],
+                                ... (clipboard.length > 1) ? [{label: i18n('skip')}] : [{label: i18n('cancel')}],
                             ]
                         })
                         if(alert_resp === 'Replace'){
@@ -1572,7 +1572,7 @@ window.copy_clipboard_items = async function(dest_path, dest_container_element){
                         }else if (alert_resp === 'Replace all'){
                             overwrite = true;
                             overwrite_all = true;
-                        }else if(alert_resp === 'Skip' || alert_resp === 'Cancel'){
+                        }else if(alert_resp === 'Skip' || alert_resp === 'cancel'){
                             item_with_same_name_already_exists = false;
                         }
                     }
@@ -1659,9 +1659,9 @@ window.copy_items = function(el_items, dest_path){
                         const alert_resp = await UIAlert({
                             message: `<strong>${html_encode(err.entry_name)}</strong> already exists.`,
                             buttons:[
-                                { label: 'Replace', type: 'primary' },
-                                ... (el_items.length > 1) ? [{label: 'Replace all'}] : [],
-                                ... (el_items.length > 1) ? [{label: 'Skip'}] : [{label: 'Cancel'}],
+                                { label: i18n('replace'), type: 'primary' },
+                                ... (el_items.length > 1) ? [{label: i18n('replace_all')}] : [],
+                                ... (el_items.length > 1) ? [{label: i18n('skip')}] : [{label: i18n('cancel')}],
                             ]
                         })
                         if(alert_resp === 'Replace'){
@@ -1669,7 +1669,7 @@ window.copy_items = function(el_items, dest_path){
                         }else if (alert_resp === 'Replace all'){
                             overwrite = true;
                             overwrite_all = true;
-                        }else if(alert_resp === 'Skip' || alert_resp === 'Cancel'){
+                        }else if(alert_resp === 'Skip' || alert_resp === 'cancel'){
                             item_with_same_name_already_exists = false;
                         }
                     }
@@ -2205,12 +2205,12 @@ window.open_item = async function(options){
                     'Found no suitable apps to open this file with. Would you like to download it instead?',
                     [
                     {
-                        label: 'Download File',
+                        label: i18n('download_file'),
                         type: 'primary',
 
                     },
                     {
-                        label: 'Cancel'
+                        label: i18n('cancel')
                     }
                 ])
             if(alert_resp === 'Download File'){
@@ -2583,9 +2583,9 @@ window.move_items = async function(el_items, dest_path, is_undo = false){
                     const alert_resp = await UIAlert({
                         message: `<strong>${html_encode(err.entry_name)}</strong> already exists.`,
                         buttons:[
-                            { label: 'Replace', type: 'primary',},
-                            ... (el_items.length > 1) ? [{label: 'Replace all'}] : [],
-                            ... (el_items.length > 1) ? [{label: 'Skip'}] : [{label: 'Cancel'}],
+                            { label: i18n('replace'), type: 'primary',},
+                            ... (el_items.length > 1) ? [{label: i18n('replace_all')}] : [],
+                            ... (el_items.length > 1) ? [{label: i18n('skip')}] : [{label: i18n('cancel')}],
                         ]
                     })
                     if(alert_resp === 'Replace'){
@@ -2593,7 +2593,7 @@ window.move_items = async function(el_items, dest_path, is_undo = false){
                     }else if (alert_resp === 'Replace all'){
                         overwrite = true;
                         overwrite_all = true;
-                    }else if(alert_resp === 'Skip' || alert_resp === 'Cancel'){
+                    }else if(alert_resp === 'Skip' || alert_resp === 'cancel'){
                         item_with_same_name_already_exists = false;
                     }
                 }
@@ -2970,15 +2970,15 @@ window.upload_items = async function(items, dest_path){
 
 window.empty_trash = async function(){
     const alert_resp = await UIAlert({
-        message: `Are you sure you want to permanently delete the items in Trash?`,
+        message: i18n('empty_trash_confirmation'),
         buttons:[
             {
-                label: 'Yes',
+                label: i18n('yes'),
                 value: 'yes',
                 type: 'primary',
             },
             {
-                label: 'No',
+                label: i18n('no'),
                 value: 'no',
             },
         ]

+ 14 - 0
src/i18n/translations/en.js

@@ -16,8 +16,12 @@ const en = {
         change_password: "Change Password",
         change_username: "Change Username",
         close_all_windows: "Close All Windows",
+        close_all_windows_and_log_out: 'Close Windows and Log Out',
         color: 'Color',
         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.',
+        confirm_delete_multiple_items: 'Are you sure you want to permanently delete these items?',
+        configm_delete_single_item: 'Do you want to permanently delete this item?',
+        confirm_open_apps_log_out: 'You have open apps. Are you sure you want to log out?',
         confirm_new_password: "Confirm New Password",
         contact_us: "Contact Us",
         contain: 'Contain',
@@ -40,6 +44,7 @@ const en = {
         dir_published_as_website: `%strong% has been published to:`,
         disassociate_dir: "Disassociate Directory",
         download: 'Download',
+        download_file: 'Download File',
         downloading: "Downloading",
         email: "Email",
         email_or_username: "Email or Username",
@@ -62,6 +67,7 @@ const en = {
         jpeg_image: 'JPEG image',
         keep_in_taskbar: 'Keep in Taskbar',
         log_in: "Log In",
+        log_into_another_account_anyway: 'Log into another account anyway',
         log_out: 'Log Out',
         move: 'Move',
         moving: "Moving",
@@ -77,6 +83,7 @@ const en = {
         new_folder: 'New folder',
         new_password: "New Password",
         new_username: "New Username",
+        no: 'No',
         no_dir_associated_with_site: 'No directory associated with this address.',
         no_websites_published: "You have not published any websites yet.",
         ok: 'OK',
@@ -94,6 +101,7 @@ const en = {
         powered_by_puter_js: `Powered by <a href="https://docs.puter.com/" target="_blank">Puter.js</a>`,
         preparing: "Preparing...",
         preparing_for_upload: "Preparing for upload...",
+        proceed_to_login: 'Proceed to login',
         properties: "Properties",
         publish: "Publish",
         publish_as_website: 'Publish as website',
@@ -106,10 +114,14 @@ const en = {
         remove_from_taskbar:'Remove from Taskbar',
         rename: 'Rename',
         repeat: 'Repeat',
+        replace: 'Replace',
+        replace_all: 'Erstatt alle',
         resend_confirmation_code: "Re-send Confirmation Code",
         restore: "Restore",
+        save_account: 'Save account',
         save_account_to_get_copy_link: "Please create an account to proceed.",
         save_account_to_publish: 'Please create an account to proceed.',
+        save_session: 'Save session',
         save_session_c2a: 'Create an account to save your current session and avoid losing your work.',
         scan_qr_c2a: 'Scan the code below to log into this session from other devices',
         select: "Select",
@@ -125,6 +137,7 @@ const en = {
         sign_up: "Sign Up",
         signing_in: "Signing in…",
         size: 'Size',
+        skip: 'Skip',
         sort_by: 'Sort by',
         start: 'Start',
         taking_longer_than_usual: 'Taking a little longer than usual. Please wait...',
@@ -139,6 +152,7 @@ const en = {
         username: "Username",
         username_changed: 'Username updated successfully.',
         versions: "Versions",
+        yes: 'Yes',
         yes_release_it: 'Yes, Release It',
         you_have_been_referred_to_puter_by_a_friend: "You have been referred to Puter by a friend!",
         zip: "Zip",

+ 14 - 0
src/i18n/translations/nb.js

@@ -16,8 +16,12 @@ const nb = {
         change_password: "Endre passord",
         change_username: "Endre brukernavn",
         close_all_windows: "Lukk alle vinduer",
+        close_all_windows_and_log_out: 'Lukk alle vinduer og logg ut',
         color: "Farge",
         confirm_account_for_free_referral_storage_c2a: "Opprett en konto og bekreft e-postadressen din for å motta 1 GB gratis lagringsplass. Din venn vil også få 1 GB gratis lagringsplass.",
+        confirm_delete_multiple_items: 'Er du sikker på at du vil slette disse elementene permanent?',
+        configm_delete_single_item: 'Er du sikker på at du vil slette dette elemente permanent?',
+        confirm_open_apps_log_out: 'Du har åpene apper, er du sikker på at du vil logge ut?',
         confirm_new_password: "Bekreft nytt passord",
         contact_us: "Kontakt oss",
         contain: "Inneholde",
@@ -40,6 +44,7 @@ const nb = {
         dir_published_as_website: "%strong% er publisert på:",
         disassociate_dir: "Fjern tilknytning fra mappe",
         download: "Last ned",
+        download_file: 'Last ned fil',
         downloading: "Laster ned",
         email: "E-post",
         email_or_username: "E-post eller brukernavn",
@@ -62,6 +67,7 @@ const nb = {
         jpeg_image: "JPEG-bilde",
         keep_in_taskbar: "Behold i oppgavelinjen",
         log_in: "Logg inn",
+        log_into_another_account_anyway: 'Logg inn på en annen bruker uansett',
         log_out: "Logg ut",
         move: "Flytt",
         moving: "Flytter",
@@ -77,6 +83,7 @@ const nb = {
         new_folder: "Ny mappe",
         new_password: "Nytt passord",
         new_username: "Nytt brukernavn",
+        no: 'Nei',
         no_dir_associated_with_site: "Ingen mappe er tilknyttet denne adressen.",
         no_websites_published: "Du har ikke publisert noen nettsteder ennå.",
         ok: "OK",
@@ -95,6 +102,7 @@ const nb = {
         preparing: "Forbereder...",
         preparing_for_upload: "Forbereder opplasting...",
         properties: "Egenskaper",
+        proceed_to_login: 'Fortsett til innlogging',
         publish: "Publiser",
         publish_as_website: "Publiser som nettsted",
         recent: "Nylig",
@@ -106,10 +114,14 @@ const nb = {
         remove_from_taskbar: "Fjern fra oppgavelinjen",
         rename: "Gi nytt navn",
         repeat: "Gjenta",
+        replace: 'Erstatt',
+        replace_all: 'Erstatt alle',
         resend_confirmation_code: "Send bekreftelseskoden på nytt",
         restore: "Gjenopprett",
+        save_account: 'Lagre konto',
         save_account_to_get_copy_link: "Vennligst opprett en konto for å fortsette.",
         save_account_to_publish: "Vennligst opprett en konto for å fortsette.",
+        save_session: 'Lagre økt',
         save_session_c2a: "Opprett en konto for å lagre gjeldende økt og unngå å miste arbeidet ditt.",
         scan_qr_c2a: "Skann koden nedenfor for å logge inn på denne økten fra andre enheter",
         select: "Velg",
@@ -125,6 +137,7 @@ const nb = {
         sign_up: "Registrer deg",
         signing_in: "Logger inn…",
         size: "Størrelse",
+        skip: 'Hopp over',
         sort_by: "Sorter etter",
         start: "Start",
         taking_longer_than_usual: "Dette tar litt lenger tid enn vanlig. Vennligst vent...",
@@ -140,6 +153,7 @@ const nb = {
         username_changed: "Brukernavn oppdatert.",
         versions: "Versjoner",
         yes_release_it: "Ja, frigi den",
+        yes: 'ja',
         you_have_been_referred_to_puter_by_a_friend: "Du har blitt henvist til Puter av en venn!",
         zip: "Zip"
     }

+ 13 - 13
src/initgui.js

@@ -529,12 +529,12 @@ window.initgui = async function(){
                                                 message: `<strong>${html_encode(err.entry_name)}</strong> already exists.`,
                                                 buttons:[
                                                     {
-                                                        label: 'Replace',
+                                                        label: i18n('replace'),
                                                         value: 'replace',
                                                         type: 'primary',
                                                     },
                                                     {
-                                                        label: 'Cancel',
+                                                        label: i18n('cancel'),
                                                         value: 'cancel',
                                                     },
                                                 ],
@@ -885,12 +885,12 @@ window.initgui = async function(){
                                             message: `<strong>${html_encode(err.entry_name)}</strong> already exists.`,
                                             buttons:[
                                                 {
-                                                    label: 'Replace',
+                                                    label: i18n('replace'),
                                                     value: 'replace',
                                                     type: 'primary',
                                                 },
                                                 {
-                                                    label: 'Cancel',
+                                                    label: i18n('cancel'),
                                                     value: 'cancel',
                                                 },
                                             ],
@@ -1326,14 +1326,14 @@ window.initgui = async function(){
             let $selected_items = $(active_element).closest(`.item-container`).find(`.item-selected`);
             if($selected_items.length > 0){
                 const alert_resp = await UIAlert({
-                    message: `Are you sure you want to permanently delete these items?`,
+                    message: i18n('confirm_delete_multiple_items'),
                     buttons:[
                         {
-                            label: 'Delete',
+                            label: i18n('delete'),
                             type: 'primary',
                         },
                         {
-                            label: 'Cancel'
+                            label: i18n('cancel')
                         },
                     ]
                 })
@@ -1355,14 +1355,14 @@ window.initgui = async function(){
             let $selected_items = $(active_element).closest(`.item-container`).find(`.item-selected[data-path^="${trash_path + '/'}"]`);
             if($selected_items.length > 0){
                 const alert_resp = await UIAlert({
-                    message: `Are you sure you want to permanently delete these items?`,
+                    message: i18n('confirm_delete_multiple_items'),
                     buttons:[
                         {
-                            label: 'Delete',
+                            label: i18n('delete'),
                             type: 'primary',
                         },
                         {
-                            label: 'Cancel'
+                            label: i18n('cancel')
                         },
                     ]
                 })
@@ -1876,15 +1876,15 @@ window.initgui = async function(){
                 message: `<strong>Save account before logging out!</strong><p>You are using a temporary account and logging out will erase all your data.</p>`,
                 buttons:[
                     {
-                        label: 'Save Account',
+                        label: i18n('save_account'),
                         type: 'primary',
                     },
                     {
-                        label: 'Log Out',
+                        label: i18n('log_out'),
                         type: 'danger',
                     },
                     {
-                        label: 'Cancel',
+                        label: i18n('cancel'),
                     },
                 ]
             })