- // 語言範本函數庫
- (function() {
- 'use strict';
-
- window.languageTemplates = function(lang) {
- const styles = {
- zh: {
- inputStyle: `...`
- },
- ja: {
- inputStyle: `...`
- },
- en: {
- inputStyle: `...`
- },
- };
-
- // 根據語言返回對應的模板、警報和按鈕
- if (lang.startsWith('zh-CN')) {
- return {
- templates: {
- "模版 1": "这是模版1的内容。",
- "模版 2": "这是模版2的内容。",
- "模版 3": "这是模版3的内容。",
- "模版 4": "这是模版4的内容。",
- "模版 5": "这是模版5的内容。"
- },
- alerts: {
- saveSuccess: "模版已保存!",
- deleteConfirm: "确定要删除选中的模版吗?",
- deleteSuccess: "模版已删除!",
- editorNotFound: "未找到具体的编辑器区域元素",
- iframeNotFound: "未找到 iframe 元素",
- enterTemplateName: "模版名称",
- clearCachePrompt: "输入 'delete' 来确认清除缓存。",
- clearCacheSuccess: "缓存已成功清除!",
- clearCacheCancel: "缓存清除操作已取消。"
- },
- buttons: {
- save: "保存模版",
- delete: "删除模版"
- },
- menuCommands: {
- clearCache: "清除缓存"
- },
- styles: styles.zh // 將樣式包含進來
- };
- } else if (lang.startsWith('zh')) {
- return {
- templates: {
- "範本 1": "這是範本1的內容。",
- "範本 2": "這是範本2的內容。",
- "範本 3": "這是範本3的內容。",
- "範本 4": "這是範本4的內容。",
- "範本 5": "這是範本5的內容。"
- },
- alerts: {
- saveSuccess: "範本已保存!",
- deleteConfirm: "確定要刪除選中的範本嗎?",
- deleteSuccess: "範本已刪除!",
- editorNotFound: "未找到具體的編輯器區域元素",
- iframeNotFound: "未找到 iframe 元素",
- enterTemplateName: "範本名稱",
- clearCachePrompt: "輸入 'delete' 來確認清除緩存。",
- clearCacheSuccess: "緩存已成功清除!",
- clearCacheCancel: "緩存清除操作已取消。"
- },
- buttons: {
- save: "保存範本",
- delete: "刪除範本"
- },
- menuCommands: {
- clearCache: "清除緩存"
- },
- styles: styles.zh // 將樣式包含進來
- };
- } else if (lang.startsWith('en')) {
- return {
- templates: {
- "Template 1": "This is the content of Template 1.",
- "Template 2": "This is the content of Template 2.",
- "Template 3": "This is the content of Template 3.",
- "Template 4": "This is the content of Template 4.",
- "Template 5": "This is the content of Template 5."
- },
- alerts: {
- saveSuccess: "Template saved!",
- deleteConfirm: "Are you sure you want to delete the selected template?",
- deleteSuccess: "Template deleted!",
- editorNotFound: "Editor area element not found",
- iframeNotFound: "Iframe element not found",
- enterTemplateName: "Template",
- clearCachePrompt: "Type 'delete' to confirm clearing the cache.",
- clearCacheSuccess: "Cache has been cleared successfully!",
- clearCacheCancel: "Cache clearing operation has been canceled."
- },
- buttons: {
- save: "Save Template",
- delete: "Delete Template"
- },
- menuCommands: {
- clearCache: "Clear Cache"
- },
- styles: styles.en // 將樣式包含進來
- };
- } else if (lang.startsWith('ja')) {
- return {
- templates: {
- "テンプレート 1": "これはテンプレート1の内容です。",
- "テンプレート 2": "これはテンプレート2の内容です。",
- "テンプレート 3": "これはテンプレート3の内容です。",
- "テンプレート 4": "これはテンプレート4の内容です。",
- "テンプレート 5": "これはテンプレート5の内容です。"
- },
- alerts: {
- saveSuccess: "テンプレートが保存されました!",
- deleteConfirm: "選択したテンプレートを削除しますか?",
- deleteSuccess: "テンプレートが削除されました!",
- editorNotFound: "エディターエリアが見つかりません",
- iframeNotFound: "iframeが見つかりません",
- enterTemplateName: "テンプレート名",
- clearCachePrompt: "キャッシュをクリアするには 'delete' と入力してください。",
- clearCacheSuccess: "キャッシュが正常にクリアされました!",
- clearCacheCancel: "キャッシュクリア操作はキャンセルされました。"
- },
- buttons: {
- save: "テンプレートを保存",
- delete: "テンプレートを削除"
- },
- menuCommands: {
- clearCache: "キャッシュをクリア"
- },
- styles: styles.ja // 將樣式包含進來
- };
- } else {
- return {
- templates: {
- "Template 1": "This is the content of Template 1.",
- "Template 2": "This is the content of Template 2.",
- "Template 3": "This is the content of Template 3.",
- "Template 4": "This is the content of Template 4.",
- "Template 5": "This is the content of Template 5."
- },
- alerts: {
- saveSuccess: "Template saved!",
- deleteConfirm: "Are you sure you want to delete the selected template?",
- deleteSuccess: "Template deleted!",
- editorNotFound: "Editor area element not found",
- iframeNotFound: "Iframe element not found",
- enterTemplateName: "Template",
- clearCachePrompt: "Type 'delete' to confirm clearing the cache.",
- clearCacheSuccess: "Cache has been cleared successfully!",
- clearCacheCancel: "Cache clearing operation has been canceled."
- },
- buttons: {
- save: "Save Template",
- delete: "Delete Template"
- },
- menuCommands: {
- clearCache: "Clear Cache"
- },
- styles: styles.en // 預設為英文樣式
- };
- }
- };
- })();