(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[6815],{56815:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>d});var n=a(21483),o=a(30603),s=a(53110),r=a(89959),i=a(43821);const l="@jupyterlab/translation-extension:plugin",c={id:"@jupyterlab/translation:translator",autoStart:!0,requires:[n.JupyterFrontEnd.IPaths,r.ISettingRegistry],provides:i.ITranslator,activate:async(e,t,a)=>{const n=await a.load(l),o=n.get("locale").composite;let s=n.get("stringsPrefix").composite;s=n.get("displayStringsPrefix").composite?s:"";const r=e.serviceManager.serverSettings,c=new i.TranslationManager(t.urls.translations,s,r);return await c.fetch(o),c}},u={id:l,requires:[s.IMainMenu,r.ISettingRegistry,i.ITranslator],autoStart:!0,activate:(e,t,a,n)=>{const s=n.load("jupyterlab"),{commands:r}=e;let c;function u(e){c=e.get("locale").composite}a.load(l).then((a=>{var n;u(a),document.documentElement.lang=c,a.changed.connect(u);const l=null===(n=t.settingsMenu.items.find((e=>{var t;return"submenu"===e.type&&"jp-mainmenu-settings-language"===(null===(t=e.submenu)||void 0===t?void 0:t.id)})))||void 0===n?void 0:n.submenu;let d;const g=e.serviceManager.serverSettings;(0,i.requestTranslationsAPI)("","",{},g).then((e=>{for(const t in e.data){const n=e.data[t],i=n.displayName,c=n.nativeName,u=i===c,g=u?`${i}`:`${i} - ${c}`;d=`jupyterlab-translation:${t}`,r.addCommand(d,{label:g,caption:g,isEnabled:()=>!u,isVisible:()=>!0,isToggled:()=>u,execute:()=>(0,o.showDialog)({title:s.__("Change interface language?"),body:s.__("After changing the interface language to %1, you will need to reload JupyterLab to see the changes.",g),buttons:[o.Dialog.cancelButton({label:s.__("Cancel")}),o.Dialog.okButton({label:s.__("Change and reload")})]}).then((e=>{e.button.accept&&a.set("locale",t).then((()=>{window.location.reload()})).catch((e=>{console.error(e)}))}))}),l&&l.addItem({command:d,args:{}})}})).catch((e=>{console.error(`Available locales errored!\n${e}`)}))})).catch((e=>{console.error(`The jupyterlab translation extension appears to be missing.\n${e}`)}))}},d=[c,u]}}]);