Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var arrLang = {
- "en-us": {
- "firstOption" : "Lonesome road",
- "secondOption" : "Too Dark",
- "thirdOption" : "There was an incident",
- "fourthOption" : "Red-light district",
- "fifthOption" : "Etc",
- "thxMsgTitle" : "Thank you!",
- "thxMsgContent" : "Your input has been recorded.",
- "textboxMsgTitle" : "Why do you feel unsafe here?",
- "textboxMsgInputPlaceholder" : "Type your message :)",
- "textboxMsgInputValidator" : "You need to write something!",
- "textboxMsgValidationMsg" : "You entered",
- "cancelMsgTitle" : 'Are you sure?',
- "cancelConfirmMsgTitle" : 'Recorded!',
- "cancelConfirmMsgText" : 'Your input has been deleted.',
- },
- "ko": {
- "firstOption" : "인적이 드물어요",
- "secondOption" : "어두워요",
- "thirdOption" : "사고가 난 적 있어요",
- "fourthOption" : "유흥가에요",
- "fifthOption" : "기타",
- "thxMsgTitle" : "감사합니다!",
- "thxMsgContent" : "의견이 입력되었습니다.",
- "textboxMsgTitle" : "왜 이곳이 위험하다고 생각하시나요?",
- "textboxMsgInputPlaceholder" : "의견을 작성해주세요 :)",
- "textboxMsgInputValidator" : "아무것도 적지 않으셨어요!",
- "textboxMsgValidationMsg" : "입력하신 의견이에요",
- "cancelMsgTitle" : '삭제하실건가요?',
- "cancelConfirmMsgTitle" : '기록되었습니다!',
- "cancelConfirmMsgText" : '의견이 삭제되었습니다.',
- }
- };
- // The default language is Korean
- var lang = "ko";
- // Check for localStorage support (save language choice)
- if("localStorage" in window){
- var usrLang = localStorage.getItem("uiLang");
- if(usrLang) {
- lang = usrLang
- }
- }
- $(document).ready(function() {
- // // * language setting START
- $(".lang").each(function(index, element) {
- $(this).text(arrLang[lang][$(this).attr("key")]);
- });
- // get/set the selected language
- $(".translate").click(function() {
- var lang = $(this).attr("id");
- // update localStorage key
- if("localStorage" in window){
- localStorage.setItem("uiLang", lang);
- // console.log( localStorage.getItem('uiLang') );
- }
- $(".lang").each(function(index, element) {
- $(this).text(arrLang[lang][$(this).attr("key")]);
- });
- });
- // // * language setting END
- }
Add Comment
Please, Sign In to add comment