Localization

The default CAS Web application includes a number of localized message files. As of CAS 3.3.4, the following languages have localized files:

  • English (US)
  • Spanish
  • French
  • Russian
  • Netherlands (Nederlands)
  • Swedish (Svenskt)
  • Italian (Italiano)
  • Urdu
  • Chinese (Simplified)
  • Dutch (Deutsch)
  • Japanese
  • Croatian
  • Czech
  • Slovenian
  • Polish
  • Portuguese (Brazil)
  • Turkish
  • Farsi
  • Arabic

Adding Your Own

If you need a language translation, we don't provide we recommend the following steps:

  1. Create a new messages.properties file for your language, generally called something like (messages_LANGUAGECODE.properties) and place it in the WEB-INF/classes directory
  2. Base your translations off the English translation, which always contains the most recent listing of messages.
  3. Add your language to the casLoginView.jsp if necessary (if you're supporting multiple languages)
  4. Open an issue for your new language translation so we can include it in the next CAS distribution!
  5. You'll need to rebuild your web application in order to incorporate the new file.

If your language file contains non-ASCII characters, you'll need to use the Native-to-ASCII Converter included with the Sun JVM. Otherwise, it may not display properly in your browser or SVN.

Selecting CSS per language/locale

Something like this in casLoginView.jsp:

<%
    String cssFileName = "mylogin.css"; // default
    Locale locale = request.getLocale();

    if (locale != null && StringUtils.isNotBlank(locale.getLanguage())){
       String languageCssFileName = "mylogin_" + locale.getLanguage() + ".css";
       // Maybe test here if languageCssFile exists...
       cssFileName = languageCssFileName;
    }

%>
<link href="/path/to/css/files/<%=cssFileName%>" rel="stylesheet" type="text/css"/>

The above snippet is only experimental and may need to be reviewed further. Use at your own risk.