Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.modeshape.common.i18n
Class ClasspathLocalizationRepository

    java.lang.Object
      org.modeshape.common.i18n.ClasspathLocalizationRepository

All Implemented Interfaces:
  LocalizationRepository

    public class ClasspathLocalizationRepository

extends Object
implements LocalizationRepository

Implementation of a `LocalizationRepository` that loads a properties file from the classpath of the supplied `class loader`.

This repository for a property file by building locations of the form "path/to/class_locale.properties", where "path/to/class" is created from the fully-qualified classname and all "." replaced with "/" characters, "locale" is the a variant of the locale (first the full locale, then subsequently with the last segment removed). As soon as a property file is found, its URL is returned immediately.

named with a name that matches

Constructor Summary
`ClasspathLocalizationRepository()` Create a repository using the current thread's `context class loader` or, if that is null, the same class loader that loaded this class.
`ClasspathLocalizationRepository(ClassLoader classLoader)` Create a repository using the supplied class loader.

Method Summary
`URL` | `getLocalizationBundle(String bundleName, Locale locale)` Obtain the URL to the properties file containing the localized messages given the supplied bundle name.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ClasspathLocalizationRepository

    public ClasspathLocalizationRepository()

  Create a repository using the current thread's `context class loader` or, if that is null, the same class loader that loaded this class.

### ClasspathLocalizationRepository

    public ClasspathLocalizationRepository(ClassLoader classLoader)

  Create a repository using the supplied class loader. Null may be passed if the class loader should be obtained from the current thread's `context class loader` or, if that is null, the same class loader that loaded this class.

  Parameters:
    `classLoader` - the class loader to use; may be null

Method Detail

### getLocalizationBundle

    public URL getLocalizationBundle(String bundleName,
                                     Locale locale)

  Obtain the URL to the properties file containing the localized messages given the supplied bundle name. This method is responsible for searching to find the most appropriate localized messages given the locale, but does not need to search using the `default locale` (as that is done by the `calling` method.

  Specified by:
    `getLocalizationBundle` in interface `LocalizationRepository`
  Parameters:
    `bundleName` - the name of the bundle of properties; never null
    `locale` - the locale for which the properties file URL is desired
  Returns:
    the URL to the properties file containing the localized messages for the named bundle, or null if no such bundle could be found

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2008-2012 JBoss, a division of Red Hat. All Rights Reserved.