How can I create localization modules using Maven?
Note: These pages are being reviewed.
If you have localized versions of resources in your own modules, you can simply place them alongside the base version; for example,
src/main/resources/my/module/Bundle_de.properties would provide a German translation of
But to localize other people’s modules, then as explained in Physical Placement of Localized Resources you will need to create
modules/locale/_.jar JARs with the localized resources. (Simply bundling localized resources in your own module will not work, because these are usually searched for starting with the original module’s
ClassLoader, which cannot "see" your modules.)
The simplest way to do this is to use the existing [http://mojo.codehaus.org/nbm-maven-plugin/branding-mojo.html
nbm:branding goal], which despite its name can handle localization as well as branding. (These are nearly interchangeable in the NB Platform.)
demonstrates how to localize parts of the Options dialog to Czech. Take note of:
lokalizace/pom.xmlasks to use this goal when building the module. It overrides the "branding token" (otherwise inherited from the parent POM) with your locale identifier. (Specifying this custom execution is required in the 3.3 plugin; future versions may run the goal automatically during the package phase when there is anything to process, but you would still need to declare the locale in your plugin configuration.)
lokalizace/src/main/nbm-branding/contains the actual localizations.
Localizations must be grouped by module to be localized, under a folder path matching the path of the original module in its cluster.
The locale suffix (
_csin this case) is inserted automatically by the build, so the source file should be named simply
--locale csso that you can quickly test the localization just by running the app.
It also turns on
NbBundledebugging mode when requested by a special profile. This can be helpful to pinpoint where a particular English string is coming from: every visible string will be annotated with a bundle number (cross reference with console output) and line number. You can also use the Search field in the branding editor (available from the context menu of
lokalizace) to find all potentially localizable strings in the Platform matching some keyword; this editor also creates the right folder structure for you automatically when localizing new bundles.
The module bundling the localizations can now be included in your app, or distributed by any other means. When the specified locale is active, your localizations will be applied.