lan.js 13 KB

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