Solution:
1.SPRING MVC itself comes with I18N configuration. Two new configuration files with names like messages_en_US.properties and messages_zh_CN.properties are used to configure English and Chinese.
2. The JSP page refers to the spring tag library, and the <spring:message code="msg.code"> tag can load the corresponding message according to the current locale.
3. Add the following content to the JSP:
<script> var i18n=new Object(); i18n['yes']='<spring:message code="msg.yes"/>'; </script>
4. The corresponding JS file can directly refer to i18n['yes'].