"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(20301),o=a(46693),r=a(89845),s=a(4857),l=a(86072);const i="@jupyterlab/translation-extension:plugin",c={id:"@jupyterlab/translation:translator",autoStart:!0,requires:[n.JupyterFrontEnd.IPaths,s.ISettingRegistry],optional:[n.ILabShell],provides:l.ITranslator,activate:async(e,t,a,n)=>{const r=await a.load(i),s=r.get("locale").composite;let c=r.get("stringsPrefix").composite;c=r.get("displayStringsPrefix").composite?c:"";const u=e.serviceManager.serverSettings,d=new l.TranslationManager(t.urls.translations,c,u);return await d.fetch(s),n&&(n.translator=d),o.Dialog.translator=d,d}},u={id:i,requires:[r.IMainMenu,s.ISettingRegistry,l.ITranslator],autoStart:!0,activate:(e,t,a,n)=>{const r=n.load("jupyterlab"),{commands:s}=e;let c;function u(e){c=e.get("locale").composite}a.load(i).then((a=>{var n;u(a),document.documentElement.lang=c,a.changed.connect(u);const i=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,l.requestTranslationsAPI)("","",{},g).then((e=>{for(const t in e.data){const n=e.data[t],l=n.displayName,c=n.nativeName,u=l===c,g=u?`${l}`:`${l} - ${c}`;d=`jupyterlab-translation:${t}`,s.addCommand(d,{label:g,caption:g,isEnabled:()=>!u,isVisible:()=>!0,isToggled:()=>u,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.",g),buttons:[o.Dialog.cancelButton({label:r.__("Cancel")}),o.Dialog.okButton({label:r.__("Change and reload")})]}).then((e=>{e.button.accept&&a.set("locale",t).then((()=>{window.location.reload()})).catch((e=>{console.error(e)}))}))}),i&&i.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]}}]);