Localizing enum values in resource bundle

后端 未结 5 725
借酒劲吻你
借酒劲吻你 2020-11-27 05:00

I have a problem with i18n enums in my JSF application. When I started, I had enums with the text defined inside. But now, I have keys tied to message bundles in the enum.

5条回答
  •  無奈伤痛
    2020-11-27 05:17

    In case anyone is looking for a simple utility library to handle enum internationalization, please take a look at https://github.com/thiagowolff/litefaces-enum-i18n

    The artifact is also available in Maven Central:

    
        br.com.litecode
        litefaces-enum-i18n
        1.0.1
    
    

    Basically, you just need to add the artifact to your project and define the enum respective keys following the described enum naming conventions. The translations (and also CSS class names) can be retrieved using the provided EL functions.

提交回复
热议问题