Index: arms/html/template/page-header.html =================================================================== diff -u -re1bfa3264e347fb58c46d893f68c9501cdac7756 -r15217c3c55c59d40994493ab479873237b469d0f --- arms/html/template/page-header.html (.../page-header.html) (revision e1bfa3264e347fb58c46d893f68c9501cdac7756) +++ arms/html/template/page-header.html (.../page-header.html) (revision 15217c3c55c59d40994493ab479873237b469d0f) @@ -69,63 +69,29 @@ class="dropdown-toggle" data-toggle="dropdown"> - 8 + 3
@@ -197,6 +163,45 @@ + + + Index: reference/jquery-plugins/select2-4.0.13/src/scss/theme/default/layout.scss =================================================================== diff -u -r339995814f8050786da536f64b021d3b2fc6e37d -r15217c3c55c59d40994493ab479873237b469d0f --- reference/jquery-plugins/select2-4.0.13/src/scss/theme/default/layout.scss (.../layout.scss) (revision 339995814f8050786da536f64b021d3b2fc6e37d) +++ reference/jquery-plugins/select2-4.0.13/src/scss/theme/default/layout.scss (.../layout.scss) (revision 15217c3c55c59d40994493ab479873237b469d0f) @@ -168,7 +168,7 @@ function 로드_완료_이후_실행_함수() { 톱니바퀴_초기설정(); - setLocale(); + loadLocale(); widgsterWrapper(); 검색_이벤트_트리거(); @@ -1794,15 +1794,43 @@ location.href = `/php/gnuboard5/index.php?${new URLSearchParams(params).toString()}`; } +//////////////////////////////////////////////////////////////////////////////////////// +// 국제화 설정 +//////////////////////////////////////////////////////////////////////////////////////// +function loadLocale() { + const locale = getCookie("locale"); + changeLocale(locale || "ko"); +} -/** - * Locales - * */ +function changeLocale(locale) { + const allowedLocale = ["ko", "jp", "en"]; + const selectedLocale = allowedLocale.includes(locale) ? locale : "ko"; + const $localeMenu = $(".locale-menu"); + $localeMenu.find(".locale-item").removeClass("active"); + $localeMenu.find(".locale-selector[data-key=" + selectedLocale + "]").closest(".locale-item").addClass("active"); + setCookie("locale", selectedLocale, 365); + setLocale(selectedLocale); +} + +function setLocale(locale = "ko") { + $.ajax({ + url: `/arms/locales/${locale}.json`, + async: false, + dataType: "json" + }).done(function (data) { + bindLocaleText(flattenObject(data)); + }); +} + function bindLocaleText(locales) { const targets = document.querySelectorAll("[data-locale]"); targets.forEach((tag) => { const content = locales[tag.dataset.locale]; + if (content === undefined) { + console.warn("해당 키에 대한 국제화 문자열이 없습니다.", tag.dataset.locale); + return; + } if (isIncludeHTMLTag(content)) { tag.innerHTML = sanitizeHTML(content); } else { @@ -1816,7 +1844,7 @@ } function sanitizeHTML(content) { - const allowedTags = ['span', 'small', 'strong', 'p', 'b', 'ul', 'li']; + const allowedTags = ['span', 'small', 'strong', 'p', 'b', 'ul', 'li', 'br']; return content.replace(/<(\w+)[^>]*>|<\/(\w+)>/g, (match, openTag, closeTag) => { const tagName = (openTag || closeTag).toLowerCase(); if (allowedTags.includes(tagName)) { @@ -1841,23 +1869,16 @@ return result; } -function setLocale(locale = "ko") { - $.ajax({ - url: `/arms/locales/${locale}.json`, - async: false, - dataType: "json" - }).done(function (data) { - bindLocaleText(flattenObject(data)); - }); +///////////////////////////////////// +// 쿠키 설정 +///////////////////////////////////// +function setCookie(name, value, exp = 1) { + const path = "/arms"; + const date = new Date(); + date.setTime(date.getTime() + exp * 24 * 60 * 60 * 1000); + document.cookie = `${name}=${value};expires=${date.toUTCString()};path=${path}`; } -function chnageLoocale() { - const localeSelect = document.getElementById("localeSelect"); - - setLocale(localeSelect.options[localeSelect.selectedIndex].value); -} - - ///////////////////////////////////// // 검색_이벤트_트리거 ///////////////////////////////////// Index: arms/locales/jp.json =================================================================== diff -u --- arms/locales/jp.json (revision 0) +++ arms/locales/jp.json (revision 15217c3c55c59d40994493ab479873237b469d0f) @@ -0,0 +1 @@ \ No newline at end of file Index: arms/template.html =================================================================== diff -u -r6f33de556d0a37a640b5dcf4e79e3ba2c5f24310 -r15217c3c55c59d40994493ab479873237b469d0f --- arms/template.html (.../template.html) (revision 6f33de556d0a37a640b5dcf4e79e3ba2c5f24310) +++ arms/template.html (.../template.html) (revision 15217c3c55c59d40994493ab479873237b469d0f) @@ -341,15 +341,6 @@ -