"use strict";(self.webpackChunk_JUPYTERLAB_CORE_OUTPUT=self.webpackChunk_JUPYTERLAB_CORE_OUTPUT||[]).push([[6815],{56815:(e,t,a)=>{a.r(t),a.d(t,{default:()=>d});var n=a(89965),o=a(23450),l=a(38356),r=a(6513),s=a(98836);const i="@jupyterlab/translation-extension:plugin",c={id:"@jupyterlab/translation:translator",autoStart:!0,requires:[n.JupyterFrontEnd.IPaths,r.ISettingRegistry],optional:[n.ILabShell],provides:s.ITranslator,activate:async(e,t,a,n)=>{const l=await a.load(i),r=l.get("locale").composite;let c=l.get("stringsPrefix").composite;c=l.get("displayStringsPrefix").composite?c:"";const u=e.serviceManager.serverSettings,d=new s.TranslationManager(t.urls.translations,c,u);return await d.fetch(r),n&&(n.translator=d),o.Dialog.translator=d,d}},u={id:i,requires:[r.ISettingRegistry,s.ITranslator],optional:[l.IMainMenu,o.ICommandPalette],autoStart:!0,activate:(e,t,a,n,l)=>{const r=a.load("jupyterlab"),{commands:c}=e;let u;function d(e){u=e.get("locale").composite}t.load(i).then((t=>{var a;d(t),document.documentElement.lang=(null!=u?u:"").replace("_","-"),t.changed.connect(d);const i=n?null===(a=n.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===a?void 0:a.submenu:null;let g;const m=e.serviceManager.serverSettings;(0,s.requestTranslationsAPI)("","",{},m).then((e=>{for(const a in e.data){const n=e.data[a],s=n.displayName,u=n.nativeName,d=s===u,m=d?`${s}`:`${s} - ${u}`;g=`jupyterlab-translation:${a}`,c.addCommand(g,{label:m,caption:m,isEnabled:()=>!d,isVisible:()=>!0,isToggled:()=>d,execute:()=>(0,o.showDialog)({title:r.__("Change interface language?"),body:r.__("After changing the interface language to %1, you will need to reload JupyterLab to see the changes.",m),buttons:[o.Dialog.cancelButton({label:r.__("Cancel")}),o.Dialog.okButton({label:r.__("Change and reload")})]}).then((e=>{e.button.accept&&t.set("locale",a).then((()=>{window.location.reload()})).catch((e=>{console.error(e)}))}))}),i&&i.addItem({command:g,args:{}}),l&&l.addItem({category:r.__("Display Languages"),command:g})}})).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]}}]);