Class LocalizedResourceHelper


  • public class LocalizedResourceHelper
    extends Object
    Helper class for loading a localized resource, specified through name, extension and current locale.
    Since:
    1.2.5
    Author:
    Juergen Hoeller
    • Method Detail

      • setSeparator

        public void setSeparator​(@Nullable
                                 String separator)
        Set the separator to use in-between file name parts. Default is an underscore ("_").
      • findLocalizedResource

        public Resource findLocalizedResource​(String name,
                                              String extension,
                                              @Nullable
                                              Locale locale)
        Find the most specific localized resource for the given name, extension and locale:

        The file will be searched with locations in the following order, similar to java.util.ResourceBundle's search order:

        • [name]_[language]_[country]_[variant][extension]
        • [name]_[language]_[country][extension]
        • [name]_[language][extension]
        • [name][extension]

        If none of the specific files can be found, a resource descriptor for the default location will be returned.

        Parameters:
        name - the name of the file, without localization part nor extension
        extension - the file extension (e.g. ".xls")
        locale - the current locale (may be null)
        Returns:
        the most specific localized resource found
        See Also:
        ResourceBundle