lan.js 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. //設定cookie
  2. function setCookie(name,value)
  3. {
  4. var Days = 30;
  5. var exp = new Date();
  6. exp.setTime(exp.getTime() + Days*24*60*60*1000);
  7. document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString();
  8. }
  9. //獲取cookie
  10. function getCookie(name)
  11. {
  12. var arr,reg=new RegExp("(^| )"+name+"=([^;]*)(;|$)");
  13. if(arr=document.cookie.match(reg))
  14. return unescape(arr[2]);
  15. else
  16. return null;
  17. }
  18. // 讀取語系設定
  19. let lang = localStorage.getItem('lan');
  20. console.log('目前語系設定: ' + lang); // test
  21. if(lang == null) {
  22. console.log('未設定語系'); // test
  23. // 自動設定語系
  24. var userlang = window.navigator.userLanguage || window.navigator.language;
  25. userlang = userlang.toLowerCase();
  26. console.log('userlang: ' + userlang); // test
  27. if (userlang == 'zh-tw') {
  28. console.log('自動設定語系: 繁體中文');
  29. lang = 'zh';
  30. } else if (userlang == 'en-us') {
  31. console.log('自動設定語系: 英文');
  32. lang = 'en';
  33. } else if (userlang == 'zh-cn') {
  34. console.log('自動設定語系: 繁體中文');
  35. lang = 'zh';
  36. } else {
  37. console.log('自動設定語系: 繁體中文');
  38. lang = 'zh';
  39. }
  40. }
  41. var zh = {
  42. "logleftbox1": "將你的生活、創作 、宣傳做成影片",
  43. "logleftbox2": "開始使用 AI Spokesgirl",
  44. "make_video" : "影片製作",
  45. "make_slides" : "投影影片製作",
  46. "make_video_long": "長影片製作",
  47. "make_video_eng": "純英文影片製作",
  48. "login" : "登入",
  49. "login_link" : "立即登入",
  50. "user_profile": "會員資料",
  51. "logout": "登出",
  52. "userName": "使用者名稱",
  53. "emailAddress": "電子信箱",
  54. "register_password": "設定密碼",
  55. "confirm_password": "確認密碼",
  56. "password_length": "(4-12位數密碼)",
  57. "password_confirm_txt": "(再次輸入您的密碼)",
  58. "logout-m": "<i class='fas fa-sign-out-alt text-white me-3'></i>登&emsp;&ensp;出",
  59. "en": "English",
  60. "zh": "中文",
  61. "choose_character": "選擇人物",
  62. "usage_intro": "使用說明",
  63. "history": "歷史紀錄",
  64. "preview_videos": "預覽影片",
  65. "video_link": "影片連結",
  66. "video_title": "標題",
  67. "p_choose_character": "請選擇人物",
  68. "lines": "台詞",
  69. "content": "內容素材",
  70. "img_link": "影像連結",
  71. "processing_progress": "處理進度",
  72. "usage_intro": "使用說明",
  73. "slide_howto_use": "1. 投影片將作為背景圖,備註中的文字則為虛擬主播的講稿內容。",
  74. "one_line_to_one_img": "1. 一句台詞請對應提供一個影像連結做為搭配",
  75. "sup_img_profile": "2. 影像連結檔案格式支援:",
  76. "submit_to_wait": "3. 點選“送出”之後需等待一段影片製作的時間,請您耐心等候,待製作完畢可於通知網址查看",
  77. "add_eng": "加入英文:",
  78. "submit": "送出",
  79. "privacy_term": "同意隱私政策及使用條款",
  80. "privacy_term_1": "註冊即表示您已閱讀並同意",
  81. "privacy_term_2": "服務條款",
  82. "privacy_term_3": "及",
  83. "privacy_term_4": "隱私權政策",
  84. "newHere": "還沒有帳號?",
  85. "oldHere": "已經有帳號?",
  86. "goRegister": "註冊",
  87. "goRegister_link": "立即註冊",
  88. "pricing" : "早鳥方案",
  89. "pricing-m" : "<i class='fas fa-tags me-2'></i>&ensp;早鳥方案",
  90. "errorEmail": "請輸入正確E-mail",
  91. "errorPsd": "密碼至少為4個字元",
  92. "errorConsistentPsd": "密碼輸入需一致",
  93. "used": "已使用",
  94. "left": "未使用",
  95. "sec": "秒",
  96. "username": "帳號/用戶名稱",
  97. "password": "密碼",
  98. "resetPsd": "更改密碼",
  99. "forgotPsd": "忘記密碼",
  100. "details": "查看詳情",
  101. "refill": "我要加值",
  102. "Createsthtoday": "今天要做甚麼影片呢?",
  103. "date": "日期",
  104. "video_duration": "影片時間 / 秒",
  105. "slide_link": "SLIDE 連結",
  106. "new_pwd": "新密碼",
  107. "confirm_pwd": "驗證碼",
  108. "pricing_lan": "語言選擇: 中文 | 英文",
  109. "pricing_avatars": "多款預設AI代言主播任你選",
  110. "pricing_content": "畫面素材支援: 圖檔 | 影檔 | 簡報",
  111. "pricing_discount": "限時優惠",
  112. "pricing_checkout": "立即註冊",
  113. "mins": "分鐘",
  114. "launch_special": "早鳥方案",
  115. "index_li1_1": "支援中英文內容",
  116. "index_li1_2": "可加入字幕",
  117. "index_li2_1": "無人物肖像權問題",
  118. "index_li2_2": "人物表情、動作自然",
  119. "index_li2_3": "因應主題,選擇合適人物",
  120. "index_li3_1": "可上傳圖片或是影片作為背景",
  121. "index_li3_2": "可輸入文字腳本及投影片",
  122. "index_action": "想要快速製作影音內容?立即註冊,開始創作!",
  123. "follow_us": "關注我們",
  124. "contact_name": "集仕多股份有限公司",
  125. "address": "新竹縣竹北市復興二路229號9樓之9",
  126. "contact_tel": "聯絡電話",
  127. "contact_mail": "聯絡信箱",
  128. "draft_edit": "編輯",
  129. "drafts": "草稿夾",
  130. "save_draft_btn": "存為草稿",
  131. "upload_file": "上傳檔案",
  132. "intro_img": "static/img/intro2.jpg",
  133. "no_draft": "目前沒有草稿喔",
  134. "trial_title": "想要免費獲得更多時間額度?",
  135. "trial_txt": "透過社群分享專屬連結,邀請好友註冊 AI Spokesgirl,凡是好友透過連結註冊成功,您可以免費獲得2分鐘製作額度。",
  136. "share": "分享",
  137. "close": "關閉",
  138. "video_long_title": "長影片範例",
  139. "index-usecases": "應用情境",
  140. "usecase_1": "產品介紹",
  141. "usecase_2": "教育培訓",
  142. "usecase_3": "氣象播報",
  143. "usecase_4": "新聞播報",
  144. "usecase_5": "個人內容創作",
  145. "usecase_6": "觀光導覽",
  146. "usecase_7": "展覽導覽",
  147. "usecase_8": "廣告行銷",
  148. "hero_title": "製作影片 一鍵合成",
  149. "hero_txt1": "輸入文字素材,即速產生影片,創作影片,不再需要錄影機、演員、麥克風繁雜器材。大幅省下時間、人力、器材成本。",
  150. "Virtual_Anchor":"虛擬AI擬真主播",
  151. "Virtual_Anchor_text":"匯集多種AI智能技術、能說各種國外語言、技術強大快速部屬、影片經濟效益大、無論內銷外銷、嘴型真實感。",
  152. "index-sec02":"static/img/index/组 29.webp",
  153. "index-sec02-m":"static/img/index/组 29-m.webp",
  154. "errorUsername": "請輸入英文字元及數字"
  155. };
  156. var en = {
  157. "logleftbox1": "Make your first video for promotion, creation and life today",
  158. "logleftbox2": "Let's get started with AI Spokesgirl",
  159. "make_video" : "Make Videos",
  160. "make_slides" : "Make Videos By Slides",
  161. "make_video_long": "Make Long Videos",
  162. "make_video_eng": "Make English Video",
  163. "login" : "Login",
  164. "login_link" : "Login",
  165. "user_profile": "User Profile",
  166. "logout": "Logout",
  167. "userName": "User name",
  168. "emailAddress": "Email Address",
  169. "register_password": "Password",
  170. "confirm_password": "Confirm Password",
  171. "password_length": "(4-12 Characters long)",
  172. "password_confirm_txt": "(Type your password again)",
  173. "en": "English",
  174. "zh": "中文",
  175. "choose_character": "Choose Character",
  176. "usage_intro": "Usage Introduction",
  177. "history": "History",
  178. "preview_videos": "Preview Videos",
  179. "video_link": "Video Link",
  180. "video_title": "Video Title",
  181. "p_choose_character": "Choose Character",
  182. "lines": "Lines",
  183. "content": "Content",
  184. "img_link": "Image Link",
  185. "processing_progress": "Processing Progress",
  186. "usage_intro": "Usage Introduction",
  187. "slide_howto_use": "1. Each slide would appear as main image and the the content speaker notes will be the content what the avatar says.",
  188. "one_line_to_one_img": "1. Please Provide an Image Link Corresponding to a Line as a Collocation",
  189. "sup_img_profile": "2. Supported File Format:",
  190. "submit_to_wait": "3. After Clicking Submit, You Will Need To Wait For A Period Of Time For The Production Of The Video. Please Wait Patiently. You Can Check It At The Notification URL When The Production Is Completed.",
  191. "add_eng": "Allow English Lines:",
  192. "submit": "Submit",
  193. "privacy_term": "I Agree to privacy policy and terms of use.",
  194. "privacy_term_1": "Registeration implies acception of",
  195. "privacy_term_2": "terms of use",
  196. "privacy_term_3": "and",
  197. "privacy_term_4": "privacy policy",
  198. "newHere": "New here?",
  199. "oldHere": "Already have an account?",
  200. "goRegister": "REGISTER",
  201. "goRegister_link": "REGISTER",
  202. "pricing" : "Pricing",
  203. "errorEmail": "Please enter valid Email format.",
  204. "errorPsd": "Passwords must be at least 4 characters long.",
  205. "errorConsistentPsd": "Two input password must be consistent.",
  206. "used": "Already Used",
  207. "left": "Left",
  208. "sec": "Sec",
  209. "username": "User Name",
  210. "password": "Password",
  211. "resetPsd": "Reset Password",
  212. "forgotPsd": "Forgot Password",
  213. "details": "Details",
  214. "refill": "Refill",
  215. "Createsthtoday": "Create something today!",
  216. "date": "Date",
  217. "video_duration": "Duration / sec",
  218. "slide_link": "SLIDE Link",
  219. "new_pwd": "New Password",
  220. "confirm_pwd": "Confirmation Code",
  221. "pricing_lan": "Language Options: Ch | Eng",
  222. "pricing_avatars": "Over 6 Avatars Available",
  223. "pricing_content": "You can upload: images, MP4, slides",
  224. "pricing_discount": "Special Discount",
  225. "pricing_checkout": "Check it out",
  226. "mins": "Minutes",
  227. "launch_special": "Launch special",
  228. "index_li1_1": "Support english & chinese content",
  229. "index_li1_2": "Caption included",
  230. "index_li2_1": "Free of portrait rights",
  231. "index_li2_2": "Natural facial expression",
  232. "index_li2_3": "Choose built-in avatars for your need",
  233. "index_li3_1": "Generate videos from text",
  234. "index_li3_2": "Upload images, video, slides as backgrounds",
  235. "index_action": "Want to make video faster? Sign up to start creating!",
  236. "follow_us": "Follow us",
  237. "contact_name": "Choozmo Inc.",
  238. "address": "Rm. 9, 9F., No. 229, Fuxing 2nd Rd., Zhubei City, Hsinchu County 302052, Taiwan (R.O.C.)",
  239. "contact_tel": "Tel",
  240. "contact_mail": "Email",
  241. "draft_edit": "Edit",
  242. "drafts": "Drafts",
  243. "save_draft_btn": "Save as Draft",
  244. "upload_file": "Upload",
  245. "intro_img": "static/img/intro_en.png",
  246. "no_draft": "No drafts yet.",
  247. "trial_title": "Want to get more minutes?",
  248. "trial_txt": "Invite your friends to AI Spokesgirl and for each eligible one that signs up from your referral, we'll give you 2 more minutes free!",
  249. "share": "Share:",
  250. "close": "Close",
  251. "video_long_title": "Long Video Demo",
  252. "index-usecases": "Use Cases",
  253. "usecase_1": "Product Walkthrough",
  254. "usecase_2": "Learning & Development",
  255. "usecase_3": "Weather Report",
  256. "usecase_4": "News Report",
  257. "usecase_5": "Personal Creation",
  258. "usecase_6": "Sightseeing Guide",
  259. "usecase_7": "Museum Guide",
  260. "usecase_8": "Marketing",
  261. "hero_title": "Create AI video at a click!",
  262. "hero_txt1": "No more actors, cameras and microphones.Make a video by typing and clicking in 3 steps.AI Spokesgirl saves you time and money.",
  263. "Virtual_Anchor": "Virtual Anchor",
  264. "Virtual_Anchor_text":"Create video from text. make a video in 3 steps. produce in more than 20 languages. get video in minutes. a variety of avatars available.",
  265. "index-sec02":"static/img/index/Group 29.webp",
  266. "index-sec02-m":"static/img/index/Group 30.webp",
  267. "errorUsername": "Please enter number or english characters only."
  268. };
  269. function switchLanContent(val){
  270. $('[set-lan]').each(function(){
  271. var me = $(this);
  272. var a = me.attr('set-lan').split(':');
  273. var p = a[0]; //文字放置位置
  274. var m = a[1]; //文字標示
  275. //用虎選擇語言後保存在cookie中,這裡讀取cooikes的語言版本
  276. // var lan = getCookie('lan');
  277. // console.log(lan);
  278. //選取語言文字
  279. switch(val){
  280. case 'zh':
  281. var t = zh[m];
  282. break;
  283. case 'en':
  284. var t = en[m];
  285. break;
  286. default:
  287. var t = zh[m];
  288. }
  289. //所選語言沒有就換
  290. if(t==undefined) t = en[m];
  291. if(t==undefined) t = zh[m];
  292. if(t==undefined) return true; //都沒有就跳出
  293. //文字放置位置有(html,val等,可以自己添加)
  294. switch(p){
  295. case 'html':
  296. me.html(t);
  297. break;
  298. case 'placeholder':
  299. me.attr('placeholder', t);
  300. console.log("placeholder");
  301. case 'val':
  302. case 'value':
  303. me.val(t);
  304. break;
  305. case 'img':
  306. me.attr('src', t);
  307. break;
  308. default:
  309. me.html(t);
  310. }
  311. });
  312. }
  313. changeLang(lang);
  314. function changeLang(val) {
  315. localStorage.setItem('lan', `${val}`);
  316. // setCookie('lan', val);
  317. switchLanContent(val);
  318. }
  319. // 4. 轉換
  320. function changeLan(val) {
  321. var val = val.value;
  322. console.log(`val: ${val}`);
  323. localStorage.setItem('lan', `${val}`);
  324. // setCookie('lan', val);
  325. switchLanContent(val);
  326. }
  327. // js裡面的轉換
  328. function get_lan(m)
  329. {
  330. //獲取文字
  331. var lan = getCookie('lan'); //語言版本
  332. //選取語言文字
  333. switch(lan){
  334. case 'zh':
  335. var t = zh[m];
  336. break;
  337. case 'hk':
  338. var t = hk[m];
  339. break;
  340. default:
  341. var t = en[m];
  342. }
  343. //如果沒有找到就轉換其他語言
  344. if(t==undefined) t = zh[m];
  345. if(t==undefined) t = en[m];
  346. if(t==undefined) t = hk[m];
  347. if(t==undefined) t = m; //如果還是沒有就直接用標示
  348. return t;
  349. }