lan.js 12 KB

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