Files
eryao/web/assets/js/i18n.js
T

336 lines
36 KiB
JavaScript
Raw Normal View History

(function () {
'use strict';
var SUPPORTED = ['en', 'zh', 'zh_Hant'];
var STORAGE_KEY = 'meeyao_lang';
var DEFAULT_LANG = 'en';
var currentLang = resolveInitialLang();
function resolveInitialLang() {
var stored = localStorage.getItem(STORAGE_KEY);
if (stored && SUPPORTED.indexOf(stored) !== -1) return stored;
return DEFAULT_LANG;
}
function getLang() {
return currentLang;
}
function setLang(lang) {
if (SUPPORTED.indexOf(lang) === -1) return;
currentLang = lang;
localStorage.setItem(STORAGE_KEY, lang);
applyAll();
}
function applyAll() {
applyText();
applyHtml();
applyPlaceholder();
applyDocumentLang();
updateSwitcher();
applyPrivacyContent();
}
function applyText() {
var els = document.querySelectorAll('[data-i18n]');
for (var i = 0; i < els.length; i++) {
var key = els[i].getAttribute('data-i18n');
var val = t(key);
if (val) els[i].textContent = val;
}
}
function applyHtml() {
var els = document.querySelectorAll('[data-i18n-html]');
for (var i = 0; i < els.length; i++) {
var key = els[i].getAttribute('data-i18n-html');
var val = t(key);
if (val) els[i].innerHTML = val;
}
}
function applyPlaceholder() {
var els = document.querySelectorAll('[data-i18n-placeholder]');
for (var i = 0; i < els.length; i++) {
var key = els[i].getAttribute('data-i18n-placeholder');
var val = t(key);
if (val) els[i].setAttribute('placeholder', val);
}
}
function applyDocumentLang() {
var htmlLang = currentLang === 'zh_Hant' ? 'zh-Hant' : currentLang;
document.documentElement.lang = htmlLang;
}
function applyPrivacyContent() {
var privacyEl = document.getElementById('privacy-content');
if (privacyEl) {
privacyEl.innerHTML = getPrivacyContent(currentLang);
}
}
function updateSwitcher() {
var selects = document.querySelectorAll('#lang-select');
for (var i = 0; i < selects.length; i++) {
selects[i].value = currentLang;
}
}
function t(key) {
var keys = key.split('.');
var obj = translations[currentLang];
if (!obj) return key;
for (var i = 0; i < keys.length; i++) {
if (obj[keys[i]] === undefined) return key;
obj = obj[keys[i]];
}
return obj;
}
function initSwitchers() {
var selects = document.querySelectorAll('#lang-select');
for (var i = 0; i < selects.length; i++) {
selects[i].value = currentLang;
selects[i].addEventListener('change', function () {
setLang(this.value);
});
}
}
var translations = {
en: {
nav: {
features: 'Features',
about: 'About',
privacy: 'Privacy Policy',
contact: 'Contact',
home: 'Home',
support: 'Support',
lang_en: 'EN',
lang_zh: '蝞',
lang_zh_hant: '蝜葉'
},
hero: {
badge: 'AI-Powered Cultural Wisdom',
title: 'Ancient I Ching Wisdom<br>Meets Modern AI',
subtitle: 'MeeYao Divination brings the profound tradition of Six-Line hexagram culture to your fingertips. Explore life\'s questions through the lens of ancient Eastern philosophy, enhanced by AI-powered interpretation.',
},
about: {
title: 'What is MeeYao Divination?',
p1: 'MeeYao Divination is an AI-assisted cultural reference app focused on traditional Six-Line culture and the timeless wisdom of the I Ching. Rooted in Eastern philosophical traditions, it helps users explore cultural connotations and gain diverse perspectives on everyday life.',
p2: 'By combining hexagram culture, traditional Five-Element theories, and GanZhi calendrical concepts, MeeYao offers a unique way to broaden your thinking and approach daily choices with clarity and a peaceful mindset.'
},
features: {
title: 'Core Features',
subtitle: 'Explore traditional divination culture with modern tools',
f1_title: 'Manual Coin Divination',
f1_desc: 'Perform traditional Six-Line hexagram casting with the classic coin method. Follow guided steps to build your hexagram authentically, preserving the ceremonial tradition.',
f2_title: 'Quick Auto Divination',
f2_desc: 'Generate a hexagram instantly when you need quick cultural reference. The app derives the hexagram based on traditional timing principles for a rapid interpretation.',
f3_title: 'AI-Powered Interpretation',
f3_desc: 'Receive thoughtful, structured analysis combining traditional Six-Line theory with AI-generated cultural insights. Each reading includes sign level, focus points, and practical advice.',
f4_title: 'Session History',
f4_desc: 'Review all your past divination sessions with complete hexagram details and AI interpretations. Follow up on previous readings for deeper exploration through conversational follow-up questions.'
},
culture: {
title: 'Rooted in Tradition',
desc: 'Six-Line culture originates from the I Ching, one of the oldest Chinese classics. It embodies the traditional understanding of the connection between personal thoughts, timing, and natural changes. Through Five-Element theory and GanZhi calendrical systems, users can explore Eastern cultural wisdom in a modern context.',
iching_title: 'I Ching',
iching_label: 'Classic Foundation',
elements_title: 'Elements',
elements_label: 'Wood Fire Earth Metal Water',
hexagrams_title: 'Hexagrams',
hexagrams_label: 'Symbolic Patterns'
},
disclaimer: {
title: 'Important Disclaimer',
text: 'All AI-generated content and cultural interpretation materials are for <strong>entertainment, cultural appreciation, and personal reference only</strong>. This app does not provide professional advice of any kind, including but not limited to business, finance, investment, medical, psychological, legal, career, or life decision-making guidance. All generated content shall not be regarded as factual basis or decision-making direction. Please approach traditional culture rationally.'
},
contact_section: {
title: 'Get in Touch',
desc: 'Have questions, feedback, or need support? We\'d love to hear from you.',
button: 'ann@xunmee.com'
},
footer: {
privacy: 'Privacy Policy',
support: 'Support',
developer: 'Developer: Ann Lee',
contact: 'Contact: ann@xunmee.com',
copyright: '\u00a9 2026 Ann Lee. All Rights Reserved.'
},
privacy: {
title: 'Privacy Policy',
updated: 'Last Updated: April 27, 2026',
effective: 'Effective Date: April 27, 2026'
}
},
zh: {
nav: {
features: '',
about: '',
privacy: '',
contact: '𠉛頂睲賑',
home: '擐㚚△',
support: '',
lang_en: 'EN',
lang_zh: '蝞',
lang_zh_hant: '蝜葉'
},
hero: {
badge: 'AI 撽勗𢆡𡝗惣',
title: '蝏𤩺惣<br>唬誨 AI',
subtitle: '閫蝑暸䔮撠𡁶西情隡删撣血撠硔銝𨀣䲮脣郎閫笔𨭌 AI 閫Y揣暑銝剔',
},
about: {
title: '閫蝑暸䔮',
p1: '閫蝑暸䔮甈曆誑 AI 蝏笔銝箸瓲敹隡删銝𨀣䲮脣郎隡删拍鍂瑟䔝蝝X瘨蛛憭𡁜瘣餃閫鉝',
p2: '西情銵𣬚霈箏撟脫𣈲隡删鈭箸艙嚗諹颱蛹靘𤤿𡠺萘輕嚗䔶誑𠉛𣬚批像𣬚𠯫撣豢'
},
features: {
title: '',
subtitle: '隞亦緵隞瑟䔝蝝V蝏笔𨀣',
f1_title: '见𢆡韏瑕㩋',
f1_desc: '雿輻鍂蝏誩𣈯兝瘜閗銵䔶蝏笔餉絲甇仿炊撘訫紡嚗喳𧑐西情嚗䔶蝏煺貌撘譌',
f2_title: '敹恍蠘䌊刻絲',
f2_desc: '𧒄嚗䔶𣂼㩋鞊~典抅鈭𦒘𧒄冽綫瞍𥪜㩋鞊∴𣂷單𧒄閫',
f3_title: 'AI 粉',
f3_desc: '隡删捏銝 AI 瘣𧼮楛摨衣甈∟圾霂餃怎倌蝥扼瘜刻摰䂿鍂撱箄悅',
f4_title: '隡朞蟮',
f4_desc: '鮋▽霂嘅鉄摰峕㟲西情霂行 AI 閫撖孵蝏剝䔮憸条餈賡䔮撘誩笆霂嘅瘛勗Y揣銋见'
},
culture: {
title: '隡删',
desc: '皞鞱䌊𥪯葉蝏誩銋衤輯蝸支犖撖孵敹萸𧒄摨譍憭拙𧑐蝏蠘恕鈭磰瘜蓥蝟鳴函緵隞祗憓Y揣銝𨀣䲮',
iching_title: '',
iching_label: '蝏誩孵抅',
elements_title: '鈭磰',
elements_label: '',
hexagrams_title: '西情',
hexagrams_label: '鞊∪雿梶頂'
},
disclaimer: {
title: '滩提憯唳',
text: ' AI 捆銝擧𤥁圾霂餉<strong>憡曹𤥁𣂷銝芯犖</strong>雿輻鍂𧋦摨𠉛鍂銝齿靘𥕢遙雿蓥銝𡁏撖澆遣霈殷𡠺雿𣂷𨰜敺卝銝𡁜鈭箇蝑厰𣂼摰嫣敺𦯀銝箔摰硺𢆡𣈲銝找蝙冽𧋦摨𠉛鍂'
},
contact_section: {
title: '𠉛頂睲賑',
desc: '劐遙雿閖䔮憸塩甈Z𤩺𧒄𠉛頂',
button: 'ann@xunmee.com'
},
footer: {
privacy: '',
support: '',
developer: '撘𤏸Ann Lee',
contact: '𠉛頂桃拳嚗惨nn@xunmee.com',
copyright: '\u00a9 2026 Ann Lee 靽萘'
},
privacy: {
title: '',
updated: '擧凒唳𠯫2026撟427',
effective: '2026撟427'
}
},
zh_Hant: {
nav: {
features: '',
about: '𨀣䲰',
privacy: '',
contact: '舐鼠',
home: '擐㚚',
support: '',
lang_en: 'EN',
lang_zh: '蝪∩葉',
lang_zh_hant: '蝜葉'
},
hero: {
badge: 'AI 撽𡝗惣',
title: '蝬𤘪惣<br>曆誨 AI',
subtitle: '閬梶蝪賢𡁶西情喟絞撣嗅撠硔𡁻望䲮脣飛閬𤥁笔𨭌 AI 閫銵橒Y揣暑銝剔',
},
about: {
title: '閬梶蝪賢暻潘',
p1: '閬梶蝪賢甈曆誑 AI 銵瓐蝯勗𤥁箸瓲敹喟絞寞䲰望䲮脣飛喟絞嚗拍鍂嗆䔝蝝X瘨蛛憭𡁜瘣餃閫鉝',
p2: '𡁻西情銵𣬚隢硋撟脫𣈲喟絞鈭箸艙嚗諹靘𤤿崕萘雁嚗䔶誑閬𤥁𣬚批像𣬚亙虜瘣餌'
},
features: {
title: '',
subtitle: '隞亦𣶹隞瑟䔝蝝W蝯勗𨀣',
f1_title: '韏瑕㩋',
f1_desc: '雿輻鍂蝬枏椙瘜閖喟絞韏瑕㩋甇仿撘訫喳𧑐瑽见遣西情嚗蝯勗撘譌',
f2_title: '敹恍蠘䌊閗絲',
f2_desc: '嚗䔶𣂼㩋鞊~典抅蝯望閙綫瞍𥪜㩋鞊∴𣂷',
f3_title: 'AI ',
f3_desc: '喟絞 AI 瘣𧼮楛摨衣瑽见甈∟圾霈鉄蝪賜瘜刻暺𧼮撖衣鍂撱箄降',
f4_title: '店甇瑕蟮',
f4_desc: '鮋“㗇風閰梧鉄摰峕㟲西情閰單 AI 閫𡁻撠滚憿𣬚餈賢撘誩閰梧瘛勗Y揣銋见'
},
culture: {
title: '喟絞',
desc: '皞鞱䌊𥪯葉𧢲蝬枏銋衤堒𧂈鈭箏摨讛憭拙𧑐霈𠰴蝯梯𡁻鈭磰瘜閖蝟鳴函𣶹隞Y揣望䲮',
iching_title: '',
iching_label: '蝬枏孵抅',
elements_title: '鈭磰',
elements_label: '',
hexagrams_title: '西情',
hexagrams_label: '鞊∪噩擃𠉛頂'
},
disclaimer: {
title: '滩痊',
text: ' AI 批捆𤥁圾霈<strong>憡𥟇𤥁衤犖</strong>雿輻鍂𧋦厩鍂銝齿靘𥕢遙雿訫璆剜撠𤾸遣霅堆𡠺雿鞉䲰敺卝璆剖鈭箇瘙箇蝑厰𣂼摰嫣敺𦯀撖虫𡁏瘙箇𣈲銝璅蹱蝯望找蝙冽𧋦厩鍂'
},
contact_section: {
title: '舐鼠',
desc: '劐遙雿訫憿䎚擖𧢲甇∟舐鼠',
button: 'ann@xunmee.com'
},
footer: {
privacy: '',
support: '',
developer: '讠䔄Ann Lee',
contact: '舐鼠萇拳嚗惨nn@xunmee.com',
copyright: '\u00a9 2026 Ann Lee 靽萘'
},
privacy: {
title: '',
updated: '敺峕凒唳𠯫2026撟427',
effective: '2026撟427'
}
}
};
function getPrivacyContent(lang) {
return privacyTranslations[lang] || privacyTranslations['en'];
}
var privacyTranslations = {
en: '<h2>Introduction</h2><p>Dear User, Welcome to MeeYao Divination (the "App"), independently developed and operated by an <strong>individual developer</strong> ("I", "me", "my"). I am committed to protecting your personal privacy and complying with applicable U.S. federal and state privacy laws, including the California Consumer Privacy Act (CCPA/CPRA), the Children\'s Online Privacy Protection Act (COPPA), CalOPPA, and other U.S. state privacy regulations.</p><p>This Privacy Policy clearly explains:</p><ul><li>What personal information I collect</li><li>How your data is used, stored and shared</li><li>Your legal privacy rights under U.S. regulations</li><li>How you can submit data requests</li></ul><p>This policy applies to all users of this App. California residents are granted additional rights specified in Section 5.</p><hr><h2>1. Information We Collect</h2><p>I only collect necessary data to provide, maintain and optimize App cultural reference functions. All data is classified as Personal Information and Sensitive Personal Information (SPI) in accordance with CCPA/CPRA.</p><h3>1.1 Information You Provide Directly</h3><ul><li><strong>Account Information</strong>: Email address, verification code (required for account registration and security verification)</li><li><strong>Profile Information</strong>: Optional nickname or display name voluntarily set by you</li><li><strong>Personal Content</strong>: Your input questions, cultural interpretation records and local session content</li><li><strong>Support Information</strong>: Feedback, consultation messages you send for user assistance</li></ul><h3>1.2 Information Collected Automatically</h3><p>When you use the App, limited automatic data will be collected to ensure normal operation:</p><ul><li><strong>Device Information</strong>: Device model, operating system version, unique device identifier, device configuration</li><li><strong>Technical Data</strong>: IP address (for rough regional access recognition), access time, crash logs and operation performance data</li><li><strong>Usage Data</strong>: Function usage records, app stay duration and in-app interaction behavior</li></ul><hr><h2>2. How We Use Your Information</h2><p>Your information will only be used for the following legitimate and limited purposes:</p><ol><li><strong>Provide Core Functions</strong>: Process your input content, generate AI cultural interpretation content, and record local usage records.</li><li><strong>Account Security</strong>: Complete user verification, prevent abnormal login and protect your account security.</li><li><strong>Product Optimization</strong>: Analyze anonymous usage data to fix bugs, optimize operation experience and improve product performance.</li><li><strong>User Assistance</strong>: Reply to your feedback and solve your use problems.</li><li><strong>Service Reminders</strong>: Push necessary system notices and policy update reminders.</li><li><strong>Legal Compliance</strong>: Meet statutory compliance requirements and official platform review rules.</li></ol><p>I will <strong>not</strong> use your personal sensitive content for commercial advertising or unauthorized marketing without your explicit consent.</p><hr><h2>3. Data Storage, Retention &amp; Cross-Border Transfers</h2><h3>3.1 Storage Location</h3><p>User data collected through this App may be stored on secure third-party cloud servers located in the United States. All cross-border data transmission adopts encrypted transmission protocols to ensure data security.</p><h3>3.2 Retention Period</h3><p>Data will only be retained within the necessary time limit:</p><ul><li><strong>Account data</strong>: Retained during your active use, and cleaned up reasonably after you cancel your account.</li><li><strong>Personal content records</strong>: Reserved within a reasonable cycle and regularly cleaned or anonymized.</li><li><strong>Device and log data</strong>: Automatically deleted after a limited period.</li></ul><hr><h2>4. Sharing &amp; Disclosure of Information</h2><h3>4.1 Sale of Personal Information</h3><p><str
zh: '<h2>撘閗</h2><p>𦠜𨯵 MeeYao""<strong>𤏸</strong>""𡠺𨯫𦒘𡠺𠰴CCPA/CPRA𠰴COPPAalOPPA 𤾸𤙴</p><p>𡝗𠬍</p><ul><li>𤣰𪑛𥕢</li><li></li><li>𤾸𤙴</li><li>𣂷</li></ul><p>𧋦𠉛𧼮5𡁶</p><hr><h2>1. 𤣰</h2><p>𠉛 CCPA/CPRA 𤩺𠄎PI</p><h3>1.1 𤤿</h3><ul><li><strong></strong>𡁶𧑐</li><li><strong></strong>𡁏</li><li><strong></strong>𡁏𤥁𧑐</li><li><strong></strong>𡁏</li></ul><h3>1.2 𢆡</h3><p>𤘪𧒄</p><ul><li><strong></strong>𦦵𣈲</li><li><strong></strong>P 𡒊𧒄𠯫</li><li><strong></strong>𡁜𨰻𧒄𠉛</li></ul><hr><h2>2. </h2><p>𦒘𤌍</p><ol><li><strong>𣂷</strong>𡁜 AI 𧋦𨰻</li><li><strong></strong>𡁜</li><li><strong></strong>𡁜𣂼𡝗𣂼</li><li><strong>𨭌</strong>𡁜齿</li><li><strong>𦛚</strong>𡁏𡁶𡝗</li><li><strong></strong>𡁏𡁜</li></ol><p>𡒊<strong></strong>𤾸𡁜𦠜𨯫</p><hr><h2>3. </h2><h3>3.1 </h3><p>𤣰𦒘𡒊𦛚</p><h3>3.2 </h3><p></p><ul><li><strong></strong>𡁜𤾸</li><li><strong></strong>𡁜𡁏</li><li><strong>𠯫</strong>𡁜</li></ul><hr><h2>4. </h2><h3>4.1 </h3><p><strong></strong>𣬚𡁜𠰴</p><h3>4.2 𡒊𦛚𣂷</h3><p>𤾸𥕦</p><ul><li>𦛚</li><li>𠉛𨯫</li><li>𦛚</li></ul><p>𡒊𡠺</p><h3>4.3 </h3><p>𧢲</p><ul><li>𦶢
zh_Hant: '<h2>撘閗</h2><p>撠𦠜𨯵甇∟雿輻鍂 閬梶 MeeYao嚗誑銝讠陛蝔晞峕𧋦厩鍂嚗峕𧋦厩鍂<strong>衤犖讠䔄</strong>嚗讠䔄霅瑟衤犖嚗䔶蒂拍鍂撌鮋黸蝘敺页𡠺𠰴撌墧鞎餉黸蝘CCPA/CPRA嚗剹𠰴蝡亙銁蝺𡁻黸蝘霅瑟COPPA嚗剹alOPPA 隞亙蝢𤾸撌鮋黸蝘閬譌</p><p>祇黸蝘錇蝑𡝗啗牧𠬍</p><ul><li>烐𤣰𪑛鈭𥕦衤犖靽⊥</li><li>鋡思蝙曹澈</li><li>典銁蝢𤾸瘜閗銝讠瘜訫甈𠰴⏚</li><li>憒𣂷漱隢𧢲</li></ul><p>祆錇蝑㚚冽䲰厩鍂撌𧼮瘞睲澈厩洵5蝭閬誩憭𡝗</p><hr><h2>1. 烐𤣰靽⊥</h2><p>穃蘨靘䜘雁霅瑕厩鍂𠾼㗇彍𡁏覔 CCPA/CPRA 衤犖靽⊥衤犖靽⊥嚗𠄎PI嚗剹</p><h3>1.1 函凒靘𤤿靽⊥</h3><ul><li><strong>鞈祆靽⊥</strong>嚗𡁻𤓖摮鞾蝞勗𧑐霅厩Ⅳ嚗嗉酉𠰴摰匧撽𡑒</li><li><strong>衤犖鞈</strong>嚗𡁏閮剔蔭黸蝔望憿舐內滨迂</li><li><strong>衤犖批捆</strong>嚗𡁏頛詨憿䎚𤥁圾霈閮㗛峕𧋦閰勗</li><li><strong>靽⊥</strong>嚗𡁏垣閰X</li></ul><h3>1.2 </h3><p>雿輻鍂閙彍帋誑蝣箔</p><ul><li><strong>閮剖靽⊥</strong>嚗朞身雿𦦵頂蝯梁𣈲銝閮剖璅躰蝚艾</li><li><strong>銵𤘪彍</strong>嚗䥑P 蠘赤𤩺援瞏唳𠯫隤</li><li><strong>雿輻鍂</strong>嚗𡁜賭蝙厩鍂找漱鈭坿</li></ul><hr><h2>2. 雿蓥蝙</h2><p>靽⊥潔誑銝见瘜蓥𤌍</p><ol><li><strong>𣂷</strong>嚗朞摰對 AI 批捆嚗諹𧋦唬蝙</li><li><strong>鞈祆摰匧</strong>嚗𡁜鞟鍂霅㚁脫迫啣虜嚗䔶霅瑟</li><li><strong></strong>嚗𡁜𣂼鈡滢蝙冽彍帋誑靽桀儔航炊𡝗雿𣈯撽堒𣂼</li><li><strong>𥪜𨭌</strong>嚗𡁜擖页雿輻鍂</li><li><strong></strong>嚗𡁏綫蝟餌絞𡁶䰻峕錇蝑𡝗凒</li><li><strong>瘜訫</strong>嚗𡁏遛頞單摰𡁜閬讛摰䀹䲮撟喳蝱撖拇瓲閬誩</li></ol><p>𡒊Ⅱ嚗峕<strong>銝齿</strong>撠衤犖𤩺批捆冽䲰平撱𡝗𧊋蝬𤘪甈羓罸啹</p><hr><h2>3. 摮睃頝典唾撓</h2><h3>3.1 摮睃雿滨蔭</h3><p>𡁻冽𤣰摮睃蝚砌券𤩅㕑楊憓𡁜頛詨∠鍂唾撓磰降隞亦Ⅱ靽脲彍𡁜</p><h3>3.2 靽萘</h3><p>銁敹</p><ul><li><strong>鞈祆</strong>嚗𡁜銁冽暑頨滢蝙閮駁啹鞈祆</li><li><strong>衤犖批捆閮㗛</strong>嚗𡁜銁摰𡁏硋鈡</li><li><strong>閮剖峕𠯫隤峕彍</strong>嚗𡁜銁敺諹䌊訫⏛</li></ul><hr><h2>4. 靽⊥曹澈</h2><h3>4.1 衤犖靽⊥</h3><p><strong>銝滢誑隞颱敶W箏睸枂蝘鈭斗衤犖靽⊥</strong>嚗𣬚銝齿璆剖⏚𠰴枂𠾼</p><h3>4.2 洵銝㗇䲮𣂷</h3><p>穃蘨銵峕虾靽∟陷蝚砌靘𥕦曹澈嚗䔶蒂蝪賜蔡湔聢霅琿</p><ul><li></li><li>厩鍂援瞏啁𧙗批極</li><li>𧢲摰䀹䲮蝟餌絞</li></ul><p>厩洵銝㗇䲮◤蝳迫撠𡁶鍂潛崕蝡讠</p><h3>4.3 瘜訫恍蠧</h3><p>銁隞乩銝𧢲𡁜虾質◤恍蠧嚗</p><ul><li>瘜訫閬譌W𦶢隞斗摰䀹䲮
};
window.MeeYaoI18n = {
getLang: getLang,
setLang: setLang,
applyAll: applyAll,
initSwitchers: initSwitchers,
t: t,
getPrivacyContent: getPrivacyContent
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', onReady);
} else {
onReady();
}
function onReady() {
applyAll();
initSwitchers();
}
})();