To customize the EJBCA Admin GUI for your language specific characters, change the default page encoding in web.contentencoding in the conf/ file, to for example ISO-8859-1 instead of the default UTF-8.

Displaying, receiving, decoding and storing different char sets is complicated and the architecture is multilayered. There are the web browser, application server, database and operating system, all working together. If you change to UFT-8 to handle your char set, you must probably also specify that the database connection should use UTF-8. For MySQL this can be done in the connection-url in your datasource description (APPSRV_HOME/server/default/deploy/ejbca-ds.xml): jdbc:mysql://yourhost/ejbca?characterEncoding=UTF-8

You will also want to configure the database, for example in my.cnf, to use UTF-8.

You also want to configure your machine to use the locale you are using, otherwise some encoding/decoding to the database may get mixed up and throw a lot of errors (java XML decoding). For example in SUSE this is done with 'yast' and in Debian it is done with 'dpkg-reconfigure locales'.

For some languages (for example Chinese) the java scripts in the admin GUI will fail to recognize the characters when doing checks for allowed characters in DN etc. The easiest way to resolve this is to go into the file: src/adminweb/ejbcajslib.js And change all methods 'checkfield*()' to always return true directly.

If you can't get you national characters to work with the Admin GUI, you can try using the CLI instead (bin/ ra addendentity ...). That usually works.

To make everything work perfect you MAY have to also configure the encoding of URIs according to your settings in the application server. This is done automatically for JBoss using the 'web.contentencoding' in conf/

Adding a new language to the admin GUI

Java uses unicode internally, so the things that needs to be taken care of are:

  1. Make sure your system locale is set correctly, so Java will recognize input of your nations language. If Java does not automatically recognize your locale you might need to specify it as options to Java during startup (i.e. in JBoss and cmd line commands such as java -Duser.language=2-char-language-code -Duser.region=2-char-country-code example for Swedish: java -Duser.language=sv -Duser.region=SE

  2. Your database must also recognize the locale so it does not strip down to plain ascii. This is database and JDBC-driver dependent.

The Admin GUI is meant to support multiple languages through language files in modules/admin-gui/resources/languages. In order to add a language you should do the following:

  1. Rename the language file you have created to, where languagecode is the 2-letter language code (ISO 639-1), e.g. 'zh' for Chinese, and place it in the modules/admin-gui/resources/languages directory.

  2. Edit conf/ (create with conf/ as template if it does not exist).
    Change 'web.availablelanguages' and add your language code to the value:

  3. You may have to change the default page encoding in web.contentencoding to for example ISO-8859-1 instead of the default UTF-8.

  4. Clean and re-deploy ejbca with ant clean followed by ant deploy. Then restart JBoss and your browser.

Now it should be possible to select zh in the system configuration as default language and in the administrator preferences page. The language will be changed when the administrator visits a web page.

Internal Internationalization

It's also possible to translate internal log comments, some exception messages and approval notifications. This is done separately in it's own resource files since this is done internally in the core application and not in the web-layer.

The language used internally is configured in the conf/ file by setting the properties intresources.preferredlanguage and intresources.secondarylanguage to the language you want to use. The letters should be the same as the xx name in the files in the src/intresources directory. The secondary resource file is used if the resource isn't found in the preferred language. This is a global setting that cannot be overridden by administrators own settings in the web-layer.