lan.js 8.7 KB

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