Rincl

Resource I18n Concern Library

Easy Java internationalization with unified API.

The Resource I18n Concern Library (Rincl) facilitates internationalization by providing access to localization resources via Csar.

Plain Java Rincl
Resource Types String, Object double, int, Object, Path, String, URI
Formatted Messages No Yes
Optional Resources No Yes
Class Resources Yes manually Yes
Inheritance Resolution No Yes
Properties Files (ISO-8859-1) Yes Yes
Properties Files (UTF-8) No Yes
Properties Files (XML) No Yes
Multiple Locale on JVM No Yes via Csar

Quick Start

1. Include Rincl Dependency

Include the appropriate Rincl dependency from Maven. To support resource bundles, simply add io.rincl:rincl-resourcebundle:x.x.x to your POM.

pom.xml
<project>
  …
  <dependencies>
    …
    <dependency>
      <groupId>io.rincl</groupId>
      <artifactId>rincl-resourcebundle</artifactId>
      <version>x.x.x</version>
    </dependency>
  </dependencies>
</project>

2. Provide Resource Properties Files

Provide localized resources for classes that need them. Feel free to consolidate resources into properties associated with base classes.

BaseClass.properties
user-label=Settings for user {0}.
BaseClass_pt.properties
user-label=Definições para usuário {0}.

3. Implement Rincled

Implement Rincledto bring quick and easy resource access to any class.

MyClass.java
public class MyClass extends BaseClass implements Rincled {
  …

4. Access Resources

Acquire a Resources instance via Rincled to gain access to a wide variety of resource types. Resources are automatically resolved to those defined for parent classes and interfaces!

MyClass.java
public class MyClass extends BaseClass implements Rincled {
  …

    final String userName = "Jane Doe";
    //Retrieve the formatted user label based upon the current locale.
    //en-US: "Settings for user Jane Doe."
    //pt-BR: "Definições para usuário Jane Doe."
    final String userLabel = getResources().getString("user-label", userName);
  …

5. Learn more.

You can access an in-depth introduction to Rincl, and learn more about internationalization in general.