// 語言範本函數庫
(function() {
'use strict';
window.languageTemplates = function(lang) {
const styles = {
zh: {
inputStyle: `
position: absolute !important;
font-weight: bold !important;
right: 205px !important; /* 中文特定的右邊距 */
width: 80px !important;
top: 20px !important;
background-color: transparent !important;
color: red !important;
border: none !important;
z-index: 2 !important;
display: inline-block !important;
`
},
ja: {
inputStyle: `
position: absolute !important;
font-weight: bold !important;
right: 338px !important; /* 日文特定的右邊距 */
width: 80px !important;
top: 20px !important;
background-color: transparent !important;
color: red !important;
border: none !important;
z-index: 2 !important;
display: inline-block !important;
`
},
en: {
inputStyle: `
position: absolute !important;
font-weight: bold !important;
right: 281px !important; /* 英文特定的右邊距 */
width: 80px !important;
top: 20px !important;
background-color: transparent !important;
color: red !important;
border: none !important;
z-index: 2 !important;
display: inline-block !important;
`
},
};
// 根據語言返回對應的模板、警報和按鈕
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: "模版名称"
},
buttons: {
save: "保存模版",
delete: "删除模版"
},
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: "範本名稱"
},
buttons: {
save: "保存範本",
delete: "刪除範本"
},
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"
},
buttons: {
save: "Save Template",
delete: "Delete Template"
},
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: "テンプレート名"
},
buttons: {
save: "テンプレートを保存",
delete: "テンプレートを削除"
},
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"
},
buttons: {
save: "Save Template",
delete: "Delete Template"
},
styles: styles.en // 預設為英文樣式
};
}
};
})();