daily pastebin goal
35%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var arrLang = {
  2.     "en-us": {
  3.         "firstOption" : "Lonesome road",
  4.         "secondOption" : "Too Dark",
  5.         "thirdOption" : "There was an incident",
  6.         "fourthOption" : "Red-light district",
  7.         "fifthOption" : "Etc",
  8.         "thxMsgTitle" : "Thank you!",
  9.         "thxMsgContent" : "Your input has been recorded.",
  10.         "textboxMsgTitle" : "Why do you feel unsafe here?",
  11.         "textboxMsgInputPlaceholder" : "Type your message :)",
  12.         "textboxMsgInputValidator" : "You need to write something!",
  13.         "textboxMsgValidationMsg" : "You entered",
  14.         "cancelMsgTitle" : 'Are you sure?',
  15.         "cancelConfirmMsgTitle" : 'Recorded!',
  16.         "cancelConfirmMsgText" : 'Your input has been deleted.',
  17.     },
  18.     "ko": {
  19.         "firstOption" : "인적이 드물어요",
  20.         "secondOption" : "어두워요",
  21.         "thirdOption" : "사고가 난 적 있어요",
  22.         "fourthOption" : "유흥가에요",
  23.         "fifthOption" : "기타",
  24.         "thxMsgTitle" : "감사합니다!",
  25.         "thxMsgContent" : "의견이 입력되었습니다.",
  26.         "textboxMsgTitle" : "왜 이곳이 위험하다고 생각하시나요?",
  27.         "textboxMsgInputPlaceholder" : "의견을 작성해주세요 :)",
  28.         "textboxMsgInputValidator" : "아무것도 적지 않으셨어요!",
  29.         "textboxMsgValidationMsg" : "입력하신 의견이에요",
  30.         "cancelMsgTitle" : '삭제하실건가요?',
  31.         "cancelConfirmMsgTitle" : '기록되었습니다!',
  32.         "cancelConfirmMsgText" : '의견이 삭제되었습니다.',
  33.     }
  34. };
  35.  
  36. // The default language is Korean
  37. var lang = "ko";
  38. // Check for localStorage support (save language choice)
  39. if("localStorage" in window){
  40.     var usrLang = localStorage.getItem("uiLang");
  41.         if(usrLang) {
  42.             lang = usrLang
  43.         }
  44. }
  45.  
  46. $(document).ready(function() {
  47.     // // * language setting START
  48.     $(".lang").each(function(index, element) {
  49.         $(this).text(arrLang[lang][$(this).attr("key")]);
  50.     });
  51.    
  52.     // get/set the selected language
  53.     $(".translate").click(function() {
  54.         var lang = $(this).attr("id");
  55.  
  56.         // update localStorage key
  57.         if("localStorage" in window){
  58.             localStorage.setItem("uiLang", lang);
  59.             // console.log( localStorage.getItem('uiLang') );
  60.         }
  61.         $(".lang").each(function(index, element) {
  62.           $(this).text(arrLang[lang][$(this).attr("key")]);
  63.         });
  64.     });
  65.     // // * language setting END
  66. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top