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 29580 - Add NbBundle.getLocalizedVariants(String)
Summary: Add NbBundle.getLocalizedVariants(String)
Status: RESOLVED WONTFIX
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 3.x
Hardware: All All
: P4 blocker (vote)
Assignee: Jesse Glick
URL:
Keywords: API, I18N
Depends on:
Blocks:
 
Reported: 2002-12-16 18:06 UTC by Jesse Glick
Modified: 2008-12-22 10:01 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2002-12-16 18:06:49 UTC
/**
 * Get localized variants of a resource name.
 * For the locale and branding search order, see
 * {@link #getLocalizingSuffixes}.
 * This method applies those suffixes to a resource
 * path, before the extension. An "extension" is
defined
 * as the minimal suffix of the resource string
beginning
 * with a period and coming after any slash, or if
no such
 * suffix exists, the empty string.
 * <p>For example, given the
 * resource path <samp>foo/bar.gif</samp>, you
might get
 * as results (German locale, branding
<samp>mybrand</samp>):
 * <ol>
 * <li><samp>foo/bar_mybrand_de.gif</samp>
 * <li><samp>foo/bar_mybrand.gif</samp>
 * <li><samp>foo/bar_de.gif</samp>
 * <li><samp>foo/bar.gif</samp>
 * </ol>
 * @param resource a resource path,
slash-separated, possibly
 *                 including a file extension
after a period
 * @return a list of locale and branding variants
of that path
 * @since 3.XXX
 */
public Iterator getLocalizedVariants(String resource);

This method should be used throughout the code
base wherever this basic piece of logic is done.
It is not particularly hard to write similar code
without the helper method, but it is repeated a
number of times, and there is one known bug in
some (but not all) implementations of this idiom,
which would be avoided by a centralized
implementation: the code to check for a dot does
not check if it comes after the last slash, so
that locale variants of "foo.bar/baz" would
incorrectly show e.g. "foo_de.bar/baz" rather than
the correct "foo.bar/baz_de".
Comment 1 Jesse Glick 2008-12-10 00:41:59 UTC
Later.