Package com.lokalized
Class LocalizedStringLoader
java.lang.Object
com.lokalized.LocalizedStringLoader
Utility methods for loading localized strings files.
- Author:
- Mark Allen
-
Method Summary
Modifier and TypeMethodDescriptionstatic Map<Locale,
Set<LocalizedString>> loadFromClasspath
(String classpathPackage) Loads all localized string files present in the specified package on the classpath.static Map<Locale,
Set<LocalizedString>> loadFromFilesystem
(Path directory) Loads all localized string files present in the specified directory.
-
Method Details
-
loadFromClasspath
@Nonnull public static Map<Locale,Set<LocalizedString>> loadFromClasspath(@Nonnull String classpathPackage) Loads all localized string files present in the specified package on the classpath.Filenames must correspond to the IETF BCP 47 language tag format.
Example filenames:
en
es-MX
nan-Hant-TW
Like any classpath reference, packages are separated using the
/
character.Example package names:
strings
com/lokalized/strings
Note: this implementation only scans the specified package, it does not descend into child packages.
- Parameters:
classpathPackage
- location of a package on the classpath, not null- Returns:
- per-locale sets of localized strings, not null
- Throws:
LocalizedStringLoadingException
- if an error occurs while loading localized string files
-
loadFromFilesystem
Loads all localized string files present in the specified directory.Filenames must correspond to the IETF BCP 47 language tag format.
Example filenames:
en
es-MX
nan-Hant-TW
Note: this implementation only scans the specified directory, it does not descend into child directories.
- Parameters:
directory
- directory in which to search for localized string files, not null- Returns:
- per-locale sets of localized strings, not null
- Throws:
LocalizedStringLoadingException
- if an error occurs while loading localized string files
-