In JViews JavaScript applications,
the use of Unicode is strongly encouraged. Specifically, the UTF-8
encoding should be used for HTML, CSS and JavaScript files. When files are encoded in UTF-8, be certain
to specify the encoding properly in the HTTP headers, HTML META, and
SCRIPT tags.
The locale
determination for JViews JavaScript applications is similar to the procedure for JViews JSF applications.
The locale determination is based on requests, However, in JavaScript applications, the locale is determined by the Servlet
class. When the browser sends a new HTTP request to the server side,
the Servlet class analyzes the "Accept-Language"
attribute,
retrieves requested locales from the HTTP header, and then takes the
first requested locale as the active locale. (If no "Accept-Language"
attribute
is found in the HTTP header because no language option has been set
in the browser, then the default JVM locale is used). After the locale
has been determined, it is stored in the current thread context and
used directly for later tasks in the current thread. The stored locale
is cleaned up when the request is finished.
Starting with version 8.7, JViews uses the Servlet class and JavaScript technologies to provide multicultural support for JavaScript web applications:
Use the Servlet class to retrieve locale
information from the attribute "Accept-Language"
from
the HTTP header when a new HTTP request comes in.
Store localized data in the JavaScript class within curly brackets.
Load the resource bundle into the web
page by using JViews Asynchronous JavaScript And XML (Ajax) components.
Reference localized data by using the
complete JavaScript class path, such as ChildClassName.key
.