LanguageTemplateManager

Language

目前為 2024-10-19 提交的版本,檢視 最新版本

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @require https://update.gf.qytechs.cn/scripts/513138/1467672/LanguageTemplateManager.js

  1. // 語言範本函數庫
  2. (function() {
  3. 'use strict';
  4. window.languageTemplates = function(lang) {
  5. const styles = {
  6. zh: {
  7. inputStyle: `...`
  8. },
  9. ja: {
  10. inputStyle: `...`
  11. },
  12. en: {
  13. inputStyle: `...`
  14. },
  15. };
  16. // 根據語言返回對應的模板、警報和按鈕
  17. if (lang.startsWith('zh-CN')) {
  18. return {
  19. templates: {
  20. "模版 1": "这是模版1的内容。",
  21. "模版 2": "这是模版2的内容。",
  22. "模版 3": "这是模版3的内容。",
  23. "模版 4": "这是模版4的内容。",
  24. "模版 5": "这是模版5的内容。"
  25. },
  26. alerts: {
  27. saveSuccess: "模版已保存!",
  28. deleteConfirm: "确定要删除选中的模版吗?",
  29. deleteSuccess: "模版已删除!",
  30. editorNotFound: "未找到具体的编辑器区域元素",
  31. iframeNotFound: "未找到 iframe 元素",
  32. enterTemplateName: "模版名称",
  33. clearCachePrompt: "输入 'delete' 来确认清除缓存。",
  34. clearCacheSuccess: "缓存已成功清除!",
  35. clearCacheCancel: "缓存清除操作已取消。"
  36. },
  37. buttons: {
  38. save: "保存模版",
  39. delete: "删除模版"
  40. },
  41. menuCommands: {
  42. clearCache: "清除缓存"
  43. },
  44. styles: styles.zh // 將樣式包含進來
  45. };
  46. } else if (lang.startsWith('zh')) {
  47. return {
  48. templates: {
  49. "範本 1": "這是範本1的內容。",
  50. "範本 2": "這是範本2的內容。",
  51. "範本 3": "這是範本3的內容。",
  52. "範本 4": "這是範本4的內容。",
  53. "範本 5": "這是範本5的內容。"
  54. },
  55. alerts: {
  56. saveSuccess: "範本已保存!",
  57. deleteConfirm: "確定要刪除選中的範本嗎?",
  58. deleteSuccess: "範本已刪除!",
  59. editorNotFound: "未找到具體的編輯器區域元素",
  60. iframeNotFound: "未找到 iframe 元素",
  61. enterTemplateName: "範本名稱",
  62. clearCachePrompt: "輸入 'delete' 來確認清除緩存。",
  63. clearCacheSuccess: "緩存已成功清除!",
  64. clearCacheCancel: "緩存清除操作已取消。"
  65. },
  66. buttons: {
  67. save: "保存範本",
  68. delete: "刪除範本"
  69. },
  70. menuCommands: {
  71. clearCache: "清除緩存"
  72. },
  73. styles: styles.zh // 將樣式包含進來
  74. };
  75. } else if (lang.startsWith('en')) {
  76. return {
  77. templates: {
  78. "Template 1": "This is the content of Template 1.",
  79. "Template 2": "This is the content of Template 2.",
  80. "Template 3": "This is the content of Template 3.",
  81. "Template 4": "This is the content of Template 4.",
  82. "Template 5": "This is the content of Template 5."
  83. },
  84. alerts: {
  85. saveSuccess: "Template saved!",
  86. deleteConfirm: "Are you sure you want to delete the selected template?",
  87. deleteSuccess: "Template deleted!",
  88. editorNotFound: "Editor area element not found",
  89. iframeNotFound: "Iframe element not found",
  90. enterTemplateName: "Template",
  91. clearCachePrompt: "Type 'delete' to confirm clearing the cache.",
  92. clearCacheSuccess: "Cache has been cleared successfully!",
  93. clearCacheCancel: "Cache clearing operation has been canceled."
  94. },
  95. buttons: {
  96. save: "Save Template",
  97. delete: "Delete Template"
  98. },
  99. menuCommands: {
  100. clearCache: "Clear Cache"
  101. },
  102. styles: styles.en // 將樣式包含進來
  103. };
  104. } else if (lang.startsWith('ja')) {
  105. return {
  106. templates: {
  107. "テンプレート 1": "これはテンプレート1の内容です。",
  108. "テンプレート 2": "これはテンプレート2の内容です。",
  109. "テンプレート 3": "これはテンプレート3の内容です。",
  110. "テンプレート 4": "これはテンプレート4の内容です。",
  111. "テンプレート 5": "これはテンプレート5の内容です。"
  112. },
  113. alerts: {
  114. saveSuccess: "テンプレートが保存されました!",
  115. deleteConfirm: "選択したテンプレートを削除しますか?",
  116. deleteSuccess: "テンプレートが削除されました!",
  117. editorNotFound: "エディターエリアが見つかりません",
  118. iframeNotFound: "iframeが見つかりません",
  119. enterTemplateName: "テンプレート名",
  120. clearCachePrompt: "キャッシュをクリアするには 'delete' と入力してください。",
  121. clearCacheSuccess: "キャッシュが正常にクリアされました!",
  122. clearCacheCancel: "キャッシュクリア操作はキャンセルされました。"
  123. },
  124. buttons: {
  125. save: "テンプレートを保存",
  126. delete: "テンプレートを削除"
  127. },
  128. menuCommands: {
  129. clearCache: "キャッシュをクリア"
  130. },
  131. styles: styles.ja // 將樣式包含進來
  132. };
  133. } else {
  134. return {
  135. templates: {
  136. "Template 1": "This is the content of Template 1.",
  137. "Template 2": "This is the content of Template 2.",
  138. "Template 3": "This is the content of Template 3.",
  139. "Template 4": "This is the content of Template 4.",
  140. "Template 5": "This is the content of Template 5."
  141. },
  142. alerts: {
  143. saveSuccess: "Template saved!",
  144. deleteConfirm: "Are you sure you want to delete the selected template?",
  145. deleteSuccess: "Template deleted!",
  146. editorNotFound: "Editor area element not found",
  147. iframeNotFound: "Iframe element not found",
  148. enterTemplateName: "Template",
  149. clearCachePrompt: "Type 'delete' to confirm clearing the cache.",
  150. clearCacheSuccess: "Cache has been cleared successfully!",
  151. clearCacheCancel: "Cache clearing operation has been canceled."
  152. },
  153. buttons: {
  154. save: "Save Template",
  155. delete: "Delete Template"
  156. },
  157. menuCommands: {
  158. clearCache: "Clear Cache"
  159. },
  160. styles: styles.en // 預設為英文樣式
  161. };
  162. }
  163. };
  164. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址