The easiest way to localize a LuciadLightspeed application is through Lucy. The Lucy internationalization approach is based on the standard Java concept of ResourceBundle. See https://docs.oracle.com/javase/tutorial/i18n/resbundle/concept.html for more information.

You can adjust the already provided French and Dutch localizations to your liking, or plug in your own bundle.

If you don’t use Lucy, you can still plug your localization strings into LuciadLightspeed. Most of the code that shows messages to the end user is sample code: you can directly change the strings in the source code, or adapt it to link it to your preferred internalization mechanism.

Some API classes also display text messages to the end user. Usually, those classes offer a simple localization entry point, using the ILcdStringTranslator class. By default all classes retrieve the translator from TLcdServiceLoader. In order to add translations just register your own string translator by annotating it with LcdService. More information on how the services mechanism works can be found here. Below is an example that configures such a string translator:

Program: internationalizing LuciadLightspeed by implementing an ILcdStringTranslator service.

@LcdService(service = ILcdStringTranslator.class)
public class CustomTranslator implements ILcdStringTranslator {

  private Map<String, String> fMyLocalization;

  public CustomTranslator() {
    fMyLocalization = retrieveLocalization(Locale.getDefault());
  }

  @Override
  public String translate(String aOriginalString) {
    String translation = fMyLocalization.get(aOriginalString);
    if(translation == null) {
      throw new IllegalArgumentException("Could not translate '" + aOriginalString + "'");
    }
    return translation;
  }
}