lan.js 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264
  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. let lang = localStorage.getItem('lan') || 'zh';
  19. if(lang == 'undefined') {
  20. lang = 'zh'
  21. }
  22. var zh = {
  23. "logleftbox1": "將你的生活、創作 、宣傳做成影片",
  24. "logleftbox2": "開始使用 AI Spokesgirl",
  25. "make_video" : "影片製作",
  26. "make_slides" : "投影影片製作",
  27. "make_video_long": "長影片製作",
  28. "make_video_eng": "英文影片製作",
  29. "login" : "登入",
  30. "user_profile": "會員資料",
  31. "logout": "登出",
  32. "en": "English",
  33. "zh": "中文",
  34. "choose_character": "選擇人物",
  35. "usage_intro": "使用說明",
  36. "history": "歷史紀錄",
  37. "preview_videos": "預覽影片",
  38. "video_link": "影片連結",
  39. "video_title": "標題",
  40. "p_choose_character": "請選擇人物",
  41. "lines": "台詞",
  42. "img_link": "影像連結",
  43. "processing_progress": "處理進度",
  44. "usage_intro": "使用說明",
  45. "one_line_to_one_img": "1. 一句台詞請對應提供一個影像連結做為搭配",
  46. "sup_img_profile": "2. 影像連結檔案格式支援:",
  47. "submit_to_wait": "3. 點選“送出”之後需等待一段影片製作的時間,請您耐心等候,待製作完畢可於通知網址查看",
  48. "add_eng": "加入英文:",
  49. "submit": "送出",
  50. "privacy_term": "同意隱私政策及使用條款",
  51. "newHere": "還沒有帳號?",
  52. "goRegister": "註冊",
  53. "pricing" : "早鳥方案",
  54. "errorEmail": "請輸入正確E-mail",
  55. "errorPsd": "密碼至少為4個字元",
  56. "used": "已使用",
  57. "left": "未使用",
  58. "sec": "秒",
  59. "username": "帳號/用戶名稱",
  60. "password": "密碼",
  61. "resetPsd": "更改密碼",
  62. "details": "查看詳情",
  63. "refill": "我要加值",
  64. "Createsthtoday": "今天要做甚麼影片呢?",
  65. "date": "日期",
  66. "video_duration": "影片時間",
  67. "slide_link": "SLIDE 連結",
  68. "new_pwd": "新密碼",
  69. "confirm_pwd": "驗證碼",
  70. "pricing_lan": "語言選擇: 中文 | 英文",
  71. "pricing_avatars": "多款預設AI代言主播任你選",
  72. "pricing_content": "畫面素材支援: 圖檔 | 影檔 | 簡報",
  73. "pricing_discount": "限時優惠",
  74. "pricing_checkout": "立即查看",
  75. "mins": "分鐘",
  76. "launch_special": "早鳥方案",
  77. "index_li1_1": "支援中英文內容",
  78. "index_li1_2": "可加入字幕",
  79. "index_li2_1": "無人物肖像權問題",
  80. "index_li2_2": "人物表情、動作自然",
  81. "index_li2_3": "因應主題,選擇合適人物",
  82. "index_li3_1": "可上傳圖片或是影片作為背景",
  83. "index_li3_2": "可輸入文字腳本及投影片",
  84. "index_action": "想要快速製作影音內容?立即註冊,開始創作!",
  85. "follow_us": "關注我們",
  86. "contact_name": "集仕多股份有限公司",
  87. "address": "新竹縣竹北市復興二路229號9樓之9",
  88. "contact_tel": "聯絡電話",
  89. "contact_mail": "聯絡信箱",
  90. "draft_edit": "編輯",
  91. "drafts": "草稿夾",
  92. "save_draft_btn": "存為草稿",
  93. "upload_file": "上傳檔案"
  94. };
  95. var en = {
  96. "logleftbox1": "Make your first video for promotion, creation and life today",
  97. "logleftbox2": "Let's get started with AI Spokesgirl",
  98. "make_video" : "Make Videos",
  99. "make_slides" : "Make Videos By Slides",
  100. "make_video_long": "Make Long Videos",
  101. "make_video_eng": "Make English Video",
  102. "login" : "Login",
  103. "user_profile": "User Profile",
  104. "logout": "Logout",
  105. "en": "English",
  106. "zh": "中文",
  107. "choose_character": "Choose Character",
  108. "usage_intro": "Usage Introduction",
  109. "history": "History",
  110. "preview_videos": "Preview Videos",
  111. "video_link": "Video Link",
  112. "video_title": "Video Title",
  113. "p_choose_character": "Choose Character",
  114. "lines": "Lines",
  115. "img_link": "Image Link",
  116. "processing_progress": "Processing Progress",
  117. "usage_intro": "Usage Introduction",
  118. "one_line_to_one_img": "1. Please Provide an Image Link Corresponding to a Line as a Collocation",
  119. "sup_img_profile": "2. Support File Format:",
  120. "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.",
  121. "add_eng": "Allow English Lines:",
  122. "submit": "Submit",
  123. "privacy_term": "I Agree to privacy policy and terms of use.",
  124. "newHere": "New here?",
  125. "goRegister": "REGISTER",
  126. "pricing" : "Pricing",
  127. "errorEmail": "Please enter valid Email format.",
  128. "errorPsd": "Passwords must be at least 4 characters long.",
  129. "used": "Already Used",
  130. "left": "Left",
  131. "sec": "Sec",
  132. "username": "User Name",
  133. "password": "password",
  134. "resetPsd": "Reset Password",
  135. "details": "Details",
  136. "refill": "Refill",
  137. "Createsthtoday": "Create something today!",
  138. "date": "Date",
  139. "video_duration": "Duration",
  140. "slide_link": "SLIDE Link",
  141. "new_pwd": "New Password",
  142. "confirm_pwd": "Confirmation Code",
  143. "pricing_lan": "Language Options: Ch | Eng",
  144. "pricing_avatars": "Over 6 Avatars Available",
  145. "pricing_content": "You can upload: images, MP4, slides",
  146. "pricing_discount": "Special Discount",
  147. "pricing_checkout": "Check it out",
  148. "mins": "Minutes",
  149. "launch_special": "Launch special",
  150. "index_li1_1": "Support english & chinese content",
  151. "index_li1_2": "Caption included",
  152. "index_li2_1": "Free of portrait rights",
  153. "index_li2_2": "Natural facial expression",
  154. "index_li2_3": "Choose built-in avatars for your need",
  155. "index_li3_1": "Generate videos from text",
  156. "index_li3_2": "Upload images, video, slides as backgrounds",
  157. "index_action": "Want to make video faster? Sign up to start creating!",
  158. "follow_us": "Follow us",
  159. "contact_name": "Choozmo Inc.",
  160. "address": "Rm. 9, 9F., No. 229, Fuxing 2nd Rd., Zhubei City, Hsinchu County 302052, Taiwan (R.O.C.)",
  161. "contact_tel": "Tel",
  162. "contact_mail": "Email",
  163. "draft_edit": "Edit",
  164. "drafts": "Drafts",
  165. "save_draft_btn": "Save as Draft",
  166. "upload_file": "Upload"
  167. };
  168. function switchLanContent(val){
  169. $('[set-lan]').each(function(){
  170. var me = $(this);
  171. var a = me.attr('set-lan').split(':');
  172. var p = a[0]; //文字放置位置
  173. var m = a[1]; //文字標示
  174. //用虎選擇語言後保存在cookie中,這裡讀取cooikes的語言版本
  175. // var lan = getCookie('lan');
  176. // console.log(lan);
  177. //選取語言文字
  178. switch(val){
  179. case 'zh':
  180. var t = zh[m];
  181. break;
  182. case 'en':
  183. var t = en[m];
  184. break;
  185. default:
  186. var t = zh[m];
  187. }
  188. //所選語言沒有就換
  189. if(t==undefined) t = en[m];
  190. if(t==undefined) t = zh[m];
  191. if(t==undefined) return true; //都沒有就跳出
  192. //文字放置位置有(html,val等,可以自己添加)
  193. switch(p){
  194. case 'html':
  195. me.html(t);
  196. break;
  197. case 'placeholder':
  198. me.attr('placeholder', t);
  199. console.log("placeholder");
  200. case 'val':
  201. case 'value':
  202. me.val(t);
  203. break;
  204. default:
  205. me.html(t);
  206. }
  207. });
  208. }
  209. changeLang(lang);
  210. function changeLang(val) {
  211. localStorage.setItem('lan', `${val}`);
  212. // setCookie('lan', val);
  213. switchLanContent(val);
  214. }
  215. // 4. 轉換
  216. function changeLan(val) {
  217. var val = val.value;
  218. console.log(`val: ${val}`);
  219. localStorage.setItem('lan', `${val}`);
  220. // setCookie('lan', val);
  221. switchLanContent(val);
  222. }
  223. // js裡面的轉換
  224. function get_lan(m)
  225. {
  226. //獲取文字
  227. var lan = getCookie('lan'); //語言版本
  228. //選取語言文字
  229. switch(lan){
  230. case 'zh':
  231. var t = zh[m];
  232. break;
  233. case 'hk':
  234. var t = hk[m];
  235. break;
  236. default:
  237. var t = en[m];
  238. }
  239. //如果沒有找到就轉換其他語言
  240. if(t==undefined) t = zh[m];
  241. if(t==undefined) t = en[m];
  242. if(t==undefined) t = hk[m];
  243. if(t==undefined) t = m; //如果還是沒有就直接用標示
  244. return t;
  245. }