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.
Summary: | I18N : Localized labels and menus revert to English after running "Build Installers" | ||
---|---|---|---|
Product: | installer | Reporter: | Masaki Katakai <masaki> |
Component: | NBI | Assignee: | dlipin <dlipin> |
Status: | VERIFIED FIXED | ||
Severity: | normal | Keywords: | I18N |
Priority: | P2 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | |
Attachments: | screenshot : menus are back to English |
Description
Masaki Katakai
2010-04-07 02:04:02 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.) 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. 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" Verified the fix on build 201004090201. Thank you Jesse and Dmitry! Great! ;-) |