Search code examples
open-liberty

How to change Open Liberty runtime language?


I want to change the language of Open Liberty runtime to en_US from within Eclipse IDE but I don't know how.

Tried to set it with preferences for the JVM arguments too but it didn't work.

-Duser.language=en -Duser.country=US -Duser.variant=US

This is the boot log, as you can see it is grabbing it from my local environment "pt_BR".

Ativando liberty (Open Liberty 19.0.0.3/wlp-1.0.26.cl190320190321-1636) em OpenJDK 64-Bit Server VM, versão 11.0.2+9 (pt_BR)
[AUDITORIA] CWWKE0001I: O servidor liberty foi ativado.
[AUDITORIA] CWWKZ0058I: Monitorando dropins para aplicativos.
[AUDITORIA] CWWKI0001I: O servidor de nome CORBA está agora disponível em corbaloc:iiop:localhost:2809/NameService.
[AUDITORIA] J2CA7001I: Adaptador de recursos wmqjmsra instalado em 7,108 segundos.
[WARNING ] CNTR4015W: O terminal de mensagens para o bean acionado por mensagens PedidoListener não pode ser ativado porque a especificação de ativação filemanager/PedidoListener não está disponível. O terminal de mensagens não receberá mensagens até que a especificação de ativação fique disponível.
[AUDITORIA] CWWKT0016I: Aplicativo da Web disponível (default_host): http://localhost:9080/filemanager/
[AUDITORIA] CWWKZ0001I: O aplicativo filemanager foi iniciado em 3,343 segundos.
[AUDITORIA] CWWKF0012I: O servidor instalou os recursos a seguir: [appClientSupport-1.0, appSecurity-2.0, appSecurity-3.0, batch-1.0, beanValidation-2.0, cdi-2.0, concurrent-1.0, distributedMap-1.0, ejb-3.2, ejbHome-3.2, ejbLite-3.2, ejbPersistentTimer-3.2, ejbRemote-3.2, el-3.0, j2eeManagement-1.1, jacc-1.5, jaspic-1.1, javaMail-1.6, javaee-8.0, jaxb-2.2, jaxrs-2.1, jaxrsClient-2.1, jaxws-2.2, jca-1.7, jcaInboundSecurity-1.0, jdbc-4.2, jms-2.0, jndi-1.0, jpa-2.2, jpaContainer-2.2, jsf-2.3, jsonb-1.0, jsonp-1.1, jsp-2.3, localConnector-1.0, managedBeans-1.0, mdb-3.2, servlet-4.0, ssl-1.0, wasJmsClient-2.0, wasJmsSecurity-1.0, wasJmsServer-1.0, webProfile-8.0, websocket-1.1].
[AUDITORIA] CWWKF0011I: O servidor liberty está pronto para executar um planeta mais inteligente.

Solution

  • The user language can be set using system properties for the JVM that runs the Liberty server. There are two main ways of setting system properties for a Liberty JVM:

    1 - Use a jvm.options file

    You can create a plain file at ${server.config.dir}/jvm.options (right next to your server.xml) with 1 JVM option per line in the file. In this case, -Duser.language=en would do the trick

    2 - On the server start command

    Normally a Liberty server is started with the bin/server start myServer command. You can also add JVM options to the end of this command, and they will be applied to server when it starts. For example:

    $ bin/server start myServer -Duser.language=en
    

    More details can be found on the official documentation at: Customizing the Liberty environment