lan.js 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  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. "intro_img": "static/img/intro2.jpg",
  95. "no_draft": "目前沒有草稿喔"
  96. };
  97. var en = {
  98. "logleftbox1": "Make your first video for promotion, creation and life today",
  99. "logleftbox2": "Let's get started with AI Spokesgirl",
  100. "make_video" : "Make Videos",
  101. "make_slides" : "Make Videos By Slides",
  102. "make_video_long": "Make Long Videos",
  103. "make_video_eng": "Make English Video",
  104. "login" : "Login",
  105. "user_profile": "User Profile",
  106. "logout": "Logout",
  107. "en": "English",
  108. "zh": "中文",
  109. "choose_character": "Choose Character",
  110. "usage_intro": "Usage Introduction",
  111. "history": "History",
  112. "preview_videos": "Preview Videos",
  113. "video_link": "Video Link",
  114. "video_title": "Video Title",
  115. "p_choose_character": "Choose Character",
  116. "lines": "Lines",
  117. "img_link": "Image Link",
  118. "processing_progress": "Processing Progress",
  119. "usage_intro": "Usage Introduction",
  120. "one_line_to_one_img": "1. Please Provide an Image Link Corresponding to a Line as a Collocation",
  121. "sup_img_profile": "2. Support File Format:",
  122. "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.",
  123. "add_eng": "Allow English Lines:",
  124. "submit": "Submit",
  125. "privacy_term": "I Agree to privacy policy and terms of use.",
  126. "newHere": "New here?",
  127. "goRegister": "REGISTER",
  128. "pricing" : "Pricing",
  129. "errorEmail": "Please enter valid Email format.",
  130. "errorPsd": "Passwords must be at least 4 characters long.",
  131. "used": "Already Used",
  132. "left": "Left",
  133. "sec": "Sec",
  134. "username": "User Name",
  135. "password": "password",
  136. "resetPsd": "Reset Password",
  137. "details": "Details",
  138. "refill": "Refill",
  139. "Createsthtoday": "Create something today!",
  140. "date": "Date",
  141. "video_duration": "Duration",
  142. "slide_link": "SLIDE Link",
  143. "new_pwd": "New Password",
  144. "confirm_pwd": "Confirmation Code",
  145. "pricing_lan": "Language Options: Ch | Eng",
  146. "pricing_avatars": "Over 6 Avatars Available",
  147. "pricing_content": "You can upload: images, MP4, slides",
  148. "pricing_discount": "Special Discount",
  149. "pricing_checkout": "Check it out",
  150. "mins": "Minutes",
  151. "launch_special": "Launch special",
  152. "index_li1_1": "Support english & chinese content",
  153. "index_li1_2": "Caption included",
  154. "index_li2_1": "Free of portrait rights",
  155. "index_li2_2": "Natural facial expression",
  156. "index_li2_3": "Choose built-in avatars for your need",
  157. "index_li3_1": "Generate videos from text",
  158. "index_li3_2": "Upload images, video, slides as backgrounds",
  159. "index_action": "Want to make video faster? Sign up to start creating!",
  160. "follow_us": "Follow us",
  161. "contact_name": "Choozmo Inc.",
  162. "address": "Rm. 9, 9F., No. 229, Fuxing 2nd Rd., Zhubei City, Hsinchu County 302052, Taiwan (R.O.C.)",
  163. "contact_tel": "Tel",
  164. "contact_mail": "Email",
  165. "draft_edit": "Edit",
  166. "drafts": "Drafts",
  167. "save_draft_btn": "Save as Draft",
  168. "upload_file": "Upload",
  169. "intro_img": "static/img/intro_en.png",
  170. "no_draft": "No drafts yet."
  171. };
  172. function switchLanContent(val){
  173. $('[set-lan]').each(function(){
  174. var me = $(this);
  175. var a = me.attr('set-lan').split(':');
  176. var p = a[0]; //文字放置位置
  177. var m = a[1]; //文字標示
  178. //用虎選擇語言後保存在cookie中,這裡讀取cooikes的語言版本
  179. // var lan = getCookie('lan');
  180. // console.log(lan);
  181. //選取語言文字
  182. switch(val){
  183. case 'zh':
  184. var t = zh[m];
  185. break;
  186. case 'en':
  187. var t = en[m];
  188. break;
  189. default:
  190. var t = zh[m];
  191. }
  192. //所選語言沒有就換
  193. if(t==undefined) t = en[m];
  194. if(t==undefined) t = zh[m];
  195. if(t==undefined) return true; //都沒有就跳出
  196. //文字放置位置有(html,val等,可以自己添加)
  197. switch(p){
  198. case 'html':
  199. me.html(t);
  200. break;
  201. case 'placeholder':
  202. me.attr('placeholder', t);
  203. console.log("placeholder");
  204. case 'val':
  205. case 'value':
  206. me.val(t);
  207. break;
  208. case 'img':
  209. me.attr('src', t);
  210. break;
  211. default:
  212. me.html(t);
  213. }
  214. });
  215. }
  216. changeLang(lang);
  217. function changeLang(val) {
  218. localStorage.setItem('lan', `${val}`);
  219. // setCookie('lan', val);
  220. switchLanContent(val);
  221. }
  222. // 4. 轉換
  223. function changeLan(val) {
  224. var val = val.value;
  225. console.log(`val: ${val}`);
  226. localStorage.setItem('lan', `${val}`);
  227. // setCookie('lan', val);
  228. switchLanContent(val);
  229. }
  230. // js裡面的轉換
  231. function get_lan(m)
  232. {
  233. //獲取文字
  234. var lan = getCookie('lan'); //語言版本
  235. //選取語言文字
  236. switch(lan){
  237. case 'zh':
  238. var t = zh[m];
  239. break;
  240. case 'hk':
  241. var t = hk[m];
  242. break;
  243. default:
  244. var t = en[m];
  245. }
  246. //如果沒有找到就轉換其他語言
  247. if(t==undefined) t = zh[m];
  248. if(t==undefined) t = en[m];
  249. if(t==undefined) t = hk[m];
  250. if(t==undefined) t = m; //如果還是沒有就直接用標示
  251. return t;
  252. }