Class Languages
- java.lang.Object
-
- org.apache.commons.codec.language.bm.Languages
-
public class Languages extends java.lang.Object
Language codes.Language codes are typically loaded from resource files. These are UTF-8 encoded text files. They are systematically named following the pattern:
org/apache/commons/codec/language/bm/${
NameType.getName()languages.txtThe format of these resources is the following:
- Language: a single string containing no whitespace
- End-of-line comments: Any occurrence of '//' will cause all text following on that line to be discarded as a comment.
- Multi-line comments: Any line starting with '/*' will start multi-line commenting mode. This will skip all content until a line ending in '*' and '/' is found.
- Blank lines: All blank lines will be skipped.
Ported from language.php
This class is immutable and thread-safe.
- Since:
- 1.6
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classLanguages.LanguageSetA set of languages.static classLanguages.SomeLanguagesSome languages, explicitly enumerated.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringANYMarker for any language.static Languages.LanguageSetANY_LANGUAGEAny/all languages.static Languages.LanguageSetNO_LANGUAGESNo languages at all.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static LanguagesgetInstance(java.lang.String languagesResourceName)Gets a new instance for the given resource name.static LanguagesgetInstance(NameType nameType)Gets an instance for the given name type.java.util.Set<java.lang.String>getLanguages()Gets the language set.
-
-
-
Field Detail
-
ANY
public static final java.lang.String ANY
Marker for any language.- See Also:
- Constant Field Values
-
NO_LANGUAGES
public static final Languages.LanguageSet NO_LANGUAGES
No languages at all.
-
ANY_LANGUAGE
public static final Languages.LanguageSet ANY_LANGUAGE
Any/all languages.
-
-
Method Detail
-
getInstance
public static Languages getInstance(NameType nameType)
Gets an instance for the given name type.- Parameters:
nameType- The name type to lookup.- Returns:
- an instance for the given name type.
-
getInstance
public static Languages getInstance(java.lang.String languagesResourceName)
Gets a new instance for the given resource name.- Parameters:
languagesResourceName- the resource name to lookup.- Returns:
- a new instance.
-
getLanguages
public java.util.Set<java.lang.String> getLanguages()
Gets the language set.- Returns:
- the language set.
-
-