This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 234883 - I18N of netbeans platform applications doesn't work
Summary: I18N of netbeans platform applications doesn't work
Status: RESOLVED FIXED
Alias: None
Product: apisupport
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.4
Hardware: PC Windows 7
: P3 normal (vote)
Assignee: Milos Kleint
URL: https://jira.codehaus.org/browse/MNBM...
Keywords:
: 234313 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-08-23 13:33 UTC by arittner
Modified: 2013-08-31 16:47 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Patch for codehaus mojo maven branding plugin (9.14 KB, patch)
2013-08-27 12:30 UTC, Martin Kozeny
Details | Diff
Updated patch for codehaus mojo maven branding plugin (9.13 KB, patch)
2013-08-27 12:45 UTC, Martin Kozeny
Details | Diff
Maven project as tastcase (8.89 KB, application/x-zip-compressed)
2013-08-28 10:16 UTC, arittner
Details
Patched maven plugin (209.37 KB, application/x-zip-compressed)
2013-08-28 10:19 UTC, arittner
Details
Repaired patch for codehaus mojo maven branding plugin (34.81 KB, patch)
2013-08-28 11:24 UTC, Martin Kozeny
Details | Diff
reworked branding patch (7.33 KB, patch)
2013-08-28 11:36 UTC, Milos Kleint
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description arittner 2013-08-23 13:33:27 UTC
It's possible to edit branding l10n files, it compiles and creates jars in the target-locale folder, but it doesn't work. 

The created bundle file are named like:

Bundle_de_de_brandingToken.properties
Bundle_de_brandingToken.properties

But the Netbeans documentation describes another way:

http://bits.netbeans.org/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/i18n-branding.html

Bundle_f4jce_ja_JP.properties
Bundle_f4jce_ja.properties

(first the brandingToken, then the language id - case sensitive)

I don't know, if this is the problem. But the application shows only the English text.

---

Product Version: NetBeans IDE Dev (Build 201308222300)
Java: 1.8.0-ea; Java HotSpot(TM) 64-Bit Server VM 25.0-b45
Runtime: Java(TM) SE Runtime Environment 1.8.0-ea-b103
System: Windows 7 version 6.1 running on amd64; Cp1252; de_DE (nb)
Comment 1 Milos Kleint 2013-08-26 05:41:51 UTC
mkozeny: you are working on this?
Comment 2 Martin Kozeny 2013-08-26 06:09:13 UTC
*** Bug 234313 has been marked as a duplicate of this bug. ***
Comment 3 Martin Kozeny 2013-08-27 12:30:49 UTC
Created attachment 139309 [details]
Patch for codehaus mojo maven branding plugin
Comment 4 Martin Kozeny 2013-08-27 12:45:59 UTC
Created attachment 139311 [details]
Updated patch for codehaus mojo maven branding plugin
Comment 5 arittner 2013-08-28 10:12:23 UTC
Hi!

Ok, I've pached a local copy of the nbm-maven-plugin (my local version is 3.10.1-patched. The Bundles are now named like the documentation.

But the filenames of the jars are know creepy:

--- nbm-maven-plugin:3.10.1-patched:branding (default-branding) @ BrDemo-branding ---
Building jar: C:\Entw\Work\projects\BrandingDemo\BrDemo\branding\target\nbm\netbeans\brdemo\core\locale\core_brdemo.jar
Building jar: C:\Entw\Work\projects\BrandingDemo\BrDemo\branding\target\nbm\netbeans\brdemo\core\locale\core_brdemo_de_de.jar
Building jar: C:\Entw\Work\projects\BrandingDemo\BrDemo\branding\target\nbm\netbeans\brdemo\core\locale\core_brdemo_brdemo_de.jar
Building jar: C:\Entw\Work\projects\BrandingDemo\BrDemo\branding\target\nbm\netbeans\brdemo\modules\locale\org-netbeans-core-execution_brdemo_de_de.jar
Building jar: C:\Entw\Work\projects\BrandingDemo\BrDemo\branding\target\nbm\netbeans\brdemo\modules\locale\org-netbeans-core-windows_brdemo.jar
Building jar: C:\Entw\Work\projects\BrandingDemo\BrDemo\branding\target\nbm\netbeans\brdemo\modules\locale\org-netbeans-core_brdemo.jar
Building jar: C:\Entw\Work\projects\BrandingDemo\BrDemo\branding\target\nbm\netbeans\brdemo\modules\locale\org-netbeans-core_brdemo_de_de.jar
org\netbeans\core\actions\Bundle_brdemo_de_de.properties already added, skipping
org\netbeans\core\ui\Bundle_brdemo_de_de.properties already added, skipping
Building jar: C:\Entw\Work\projects\BrandingDemo\BrDemo\branding\target\nbm\netbeans\brdemo\modules\locale\org-netbeans-core_brdemo_brdemo_de.jar
Building jar: C:\Entw\Work\projects\BrandingDemo\BrDemo\branding\target\nbm\netbeans\brdemo\modules\locale\org-netbeans-modules-autoupdate-ui_brdemo_de_de.jar
org\netbeans\modules\autoupdate\ui\actions\Bundle_brdemo_de_de.properties already added, skipping
org\netbeans\modules\autoupdate\ui\Bundle_brdemo_de_de.properties already added, skipping
Building jar: C:\Entw\Work\projects\BrandingDemo\BrDemo\branding\target\nbm\netbeans\brdemo\modules\locale\org-netbeans-modules-print_brdemo_de_de.jar
Building jar: C:\Entw\Work\projects\BrandingDemo\BrDemo\branding\target\nbm\netbeans\brdemo\modules\locale\org-openide-actions_brdemo_brdemo_de.jar

You can see, the branding token 'brdemo' is sometimes doubled, sometimes not.

Anyway, the \nbm\netbeans\brdemo\modules\locale\org-netbeans-core_brdemo_de_de.jar contains a translation for the exit menu:

Bundle_brdemo_de_de.properties
Exit=Beenden

But the application shows only the English label "Exit". I don't know, what is going wrong. I'll add my small demo maven project.
Comment 6 arittner 2013-08-28 10:16:00 UTC
Created attachment 139352 [details]
Maven project as tastcase

This is a very small standard Netbeans platform maven project with some few translations (e.g. the Exit action in the file menu). 

Please run this project with a patched nbm maven plugin to see the duplicated branding tokens in jar names. However the translation doesn't work.
Comment 7 arittner 2013-08-28 10:19:20 UTC
Created attachment 139353 [details]
Patched maven plugin

This is the patched maven plugin (source only) with the second patch (139311) from this issue.
Comment 8 Martin Kozeny 2013-08-28 11:24:49 UTC
Created attachment 139360 [details]
Repaired patch for codehaus mojo maven branding plugin

Thanks a lot, you're right. I've already attached repaired patch, so you can try it. If you run the app, I think that it will take first as a locale the one passed as param (--locale swich should work for this option) -> if not found - your default OS locale and if it is also not found, classic branding is used.
Comment 9 Milos Kleint 2013-08-28 11:36:39 UTC
Created attachment 139362 [details]
reworked branding patch

Well, unfortunately our work clashed here. I've reworked the patch to eliminate the use of regexp pattern and sort out the locales in target/ directory on the initial copy. That way we don't have to compute the includes and always just take what's present in the given directory.
Comment 10 Milos Kleint 2013-08-28 12:12:39 UTC
I've created an issue for the nbm-maven-plugin - https://jira.codehaus.org/browse/MNBMODULE-222

applied my patch there and will attempt a 3.11 release soon. (to have archetypes updated for 7.4)
Comment 11 arittner 2013-08-28 12:47:33 UTC
Yes, the last patch works much better. The JAR naming is correct and the branding names are also right.

But (and I don't know, if it's a bug, a feature, my fault or nitpicking), IMHO the order of picking the right branding file is wrong.

I've three created branding-jars (see my testcase):
\modules\locale\org-netbeans-core_brdemo.jar
\modules\locale\org-netbeans-core_brdemo_de.jar
\modules\locale\org-netbeans-core_brdemo_de_de.jar

The org-netbeans-core_brdemo.jar is without any specific l10n for the Exit action. 

org-netbeans-core_brdemo_de and org-netbeans-core_brdemo_de_de are with different l10n for Exit:

org-netbeans-core_brdemo_de!org/netbeans/core/actions/Bundle_brdemo_de.properties
Exit=Beenden!

org-netbeans-core_brdemo_de_de!org/netbeans/core/actions/Bundle_brdemo_de_de.properties 
Exit=Beenden

My system comes with the locale de_DE (System: Windows 7 version 6.1 running on amd64; Cp1252; de_DE (nb))

But the applications shows "Beenden!" *not* "Beenden". So netbeans catches the _de-Bundle, not the more specific _de_de Bundle. Is this a bug? And IMHO not in the Mojo, this is a Netbeans API problem?

However, thank you for your great support :)
Comment 12 arittner 2013-08-28 13:30:25 UTC
The order of picking the l10n is defined in this document:

http://bits.netbeans.org/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/i18n-branding.html#branding (same URL as above)

"For example, in Japanese locale the search list for a bundle might look like this:"

1. /some/path/to/your/Bundle_f4jce_ja_JP.properties
2. /some/path/to/your/Bundle_f4jce_ja.properties
3. /some/path/to/your/Bundle_f4jce.properties
4. /some/path/to/your/Bundle_ja_JP.properties
5. /some/path/to/your/Bundle_ja.properties
6. /some/path/to/your/Bundle.properties

"As with all localizations, searches automatically fall back to simpler resources if the specific locale plus branding was not found; when using bundle files (with NbBundle.getBundle and similar calls), there may be multiple matching bundles, in which case any given key will be searched in all available bundles in order (so that you can override only the keys you need)."
Comment 13 Martin Kozeny 2013-08-29 08:41:59 UTC
This changeset capitalize branding locale variant. Milos will probably make a release of updated nbm maven plugin tomorrow.
https://hg.netbeans.org/core-main/rev/9a0966b022d4
Comment 14 Martin Kozeny 2013-08-29 10:36:58 UTC
Note: use pattern --locale en:US or switching branding locale -> http://bits.netbeans.org/dev/javadoc/org-openide-modules/org/openide/modules/doc-files/i18n-branding.html.
Comment 15 arittner 2013-08-29 11:18:29 UTC
(In reply to Martin Kozeny from comment #13)
> This changeset capitalize branding locale variant. Milos will probably make
> a release of updated nbm maven plugin tomorrow.
> https://hg.netbeans.org/core-main/rev/9a0966b022d4

Hey Martin, thank you. 

To test this, probably brings me to my limits;-)

Of course I have a hg clone here with current pull/update and an successful ant-built. But the test case is indeed maven based project, with artifacts. I suppose I need to test it as ant-driven application platform, to see whether the order is correct? Or is there a way to build "artifacts" from the hg clone?

br, josh.
Comment 16 arittner 2013-08-30 14:40:54 UTC
Ok, after a long testcase, building my own complete local test center (with maven artifacts -> http://www.aljoscha-rittner.de/blog/archive/2013/08/29/mavenization-of-netbeans-platform-projects-7x-releases/ ) and manually correcting the branding extension (_de_de to _de_DE) in my old testcase, I can confirm the fix :D

Now the application picks up the right branding file and the IDE creates correct capitalized branding locales.

Both of you, thank you very much :-)
Comment 17 Milos Kleint 2013-08-31 16:47:14 UTC
unfortunately the release 3.11 of nbm-maven-plugin is still not synced to central. probably something went wrong with codehaus setup. no estimate yet when it will be working and synced