May 14, 2021 JFinal manual
The I18nInterceptor interceptor is an internationalized component for web applications, and here are the examples used in the freemarker template:
Configure I18nInterceptor as a global interceptor first
public void configInterceptor(Interceptors me) { me.add( new I18nInterceptor());
}
You can then get internationalized data _res freemarker by simply simply using the object
${_res.get("msg")}
The above code intercepts action requests by configuring I18nInterceptor, and then obtains internationalization data in the freemarker template file with an object named _res, and the specific workflow of I18nInterceptor is as follows:
The variable names "_locale" and "_res" in step I18nInterceptor above can be specified when the I18nInterceptor object is created and the default value is used when not specified. You can also customize more personalized features by inheriting I18nInterceptor and covering getLocalPara, getResName, getBaseName.
In some web systems, pages require too much internationalized text, and css and html are very different because of internationalization, for this scenario, you can make multiple sets of internationalized views with the same name, and store those views in locale subdirection classification, and finally use I The 18nInterceptor interceptor dynamically switches views based on locale, instead of interstates the text in the view one by one, simply set I18nInterceptor.isSwitchView to true, saving time and effort.