반응형
i18n이란?
- i18n은 Internationalization의 축약형임(가장 첫글자와 마지막글자 사이 18글자라서 i + 18 + n)
cf1) SW국제화 : 국제적으로 통용되는 SW를 설계하고 개발 하는 것
cf2) SW현지화 : 현지(Locale)에 맞게 SW를 설계하고 개발 하는 것
i18n 용도
- 쿠키 값을 이용해 언어 정보를 받아와 처리
- 웹페이지의 국제화가 목적
- Spring의 MessageSource를 이용해 언어별 페이지 구현
Uncaught TypeError: $.i18n is not a function
at Object.error (common.js:316:41)
at c (jquery-3.6.0.min.js:2:28327)
at Object.fireWith [as rejectWith] (jquery-3.6.0.min.js:2:29072)
at l (jquery-3.6.0.min.js:2:79926)
at XMLHttpRequest.<anonymous> (jquery-3.6.0.min.js:2:82355)
언어 설정
@Override
public List<Map<String,Object>> getLocalization(String codeType, HttpServletRequest req){
String locale = String.valueOf(req.getSession().getAttribute("lang"));
if("null".equals(locale)) {
locale = "ko";
}
List<Map<String,Object>> result = new ArrayList<Map<String,Object>>();
if(CommonCode.getCodeList(codeType) != null) {
if(locale.equals("ko")) {
result = CommonCode.getCodeList(codeType);
}else {
result = CommonCode.getCodeList(codeType+"_en");
}
}
return result;
}
@Override
public void changeLocale (HttpServletRequest req,@RequestParam Map<String,Object> lang) {
req.getSession().setAttribute("lang", lang.get("lang"));
}
반응형
'Backend > Spring | SpringBoot' 카테고리의 다른 글
application.yml 설정 (0) | 2024.02.19 |
---|---|
Failed to load resource: the server responded with a status of 404 () (0) | 2024.02.19 |
Tomcat 에러 (0) | 2024.02.19 |
[Spring] 예외처리(Exception Handler)(2) (0) | 2023.11.30 |
[Spring] 예외처리(Exception Handler)(1) (0) | 2023.11.28 |