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 183611 - I18N : Localized labels and menus revert to English after running "Build Installers"
Summary: I18N : Localized labels and menus revert to English after running "Build Inst...
Status: VERIFIED FIXED
Alias: None
Product: installer
Classification: Unclassified
Component: NBI (show other bugs)
Version: 6.x
Hardware: All All
: P2 normal (vote)
Assignee: dlipin
URL:
Keywords: I18N
Depends on:
Blocks:
 
Reported: 2010-04-07 02:04 UTC by Masaki Katakai
Modified: 2010-04-09 07:22 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
screenshot : menus are back to English (196.29 KB, image/png)
2010-04-07 02:04 UTC, Masaki Katakai
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Masaki Katakai 2010-04-07 02:04:02 UTC
Created attachment 96824 [details]
screenshot : menus are back to English

I'm trying build 201004060201 on Mac and Windows XP and
seeing this strange behavior.

Localized menus and labels of IDE will revert back to English
when I run "Build Installers".

1. Install daily build

2. Unzip localized jar files into the installation directory
   http://netbeans.org/projects/nblocalization/downloads/download/6.9%252Fpseudol10n-201004050201.zip

   These jar files are pseudo localized. All menu and labels are
   displayed as "[File]". Full-width "[" and "]" are displayed.

   (there is no official ml-build yet)

3. Start NetBeans in Japanese locale (or use --locale ja option)
   You can see all labels and menus are localized with "[" and "]".

4. Create a "NetBeans Platform Application" project

5. Try to display the context menu of the project
   All menus are localized.

6. Run "Build Installers"

7. Try to display the context menu again
   Most of menus are now English.
   Other UIs are also back to English.

8. Exit NetBeans and start again

9. Try to display the menu again
   Now all menus are Japanese.
Comment 1 Jesse Glick 2010-04-07 15:31:36 UTC
Three NBI classes call Locale.setDefault, for reasons unclear to me:

nbi/engine/src/org/netbeans/installer/utils/cli/options/LocaleOption.java
nbi/infra/lib/registries-management/src/org/netbeans/installer/infra/lib/registries/impl/RegistriesManagerImpl.java
nbi/infra/server/modules/ejb/src/java/org/netbeans/installer/infra/server/ejb/ManagerBean.java

Never do this, except where it is necessary to call third-party code which calls Locale.getDefault() and cannot be told to use a particular Locale object. In such a case, use the following idiom:

Locale old = Locale.getDefault();
Locale.setDefault(whatever);
// no intervening statements here!
try {
  ...
} finally {
  Locale.setDefault(old);
}

This is essentially like Scheme fluid-let on a global variable; the same idiom is occasionally used to call buggy libraries relying on Thread.contextClassLoader.

(BTW, reporter: in general using -J-Dorg.openide.util.NbBundle.DEBUG=true is a far easier way to simulate localization and its discontents. Happens to not work to reproduce this particular bug, since bundle debug mode does not need to switch locale, and this bug is about the very rare case of a locale switch.)
Comment 2 dlipin 2010-04-07 16:00:41 UTC
Usage Locale.setDefault() in LocaleOption.java is done for the same purpose as in 
core.startup/src/org/netbeans/core/startup/CLIoptions.java.

As for RegistriesManagerImpl.java and ManagerBean.java then it is likely unnecessary and I'll fix in core-main#90ae179e37e9.

Thanks for bringing this up and explanation in details.
Comment 3 Quality Engineering 2010-04-09 04:51:23 UTC
Integrated into 'main-golden', will be available in build *201004090201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/90ae179e37e9
User: Dmitry Lipin <dlipin@netbeans.org>
Log: Issue #183611 I18N : Localized labels and menus revert to English after running "Build Installers"
Comment 4 Masaki Katakai 2010-04-09 07:22:06 UTC
Verified the fix on build 201004090201.

Thank you Jesse and Dmitry! Great! ;-)