Package com.mrivanplays.jdcf.translation
Class Translations
- java.lang.Object
-
- com.mrivanplays.jdcf.translation.Translations
-
public class Translations extends java.lang.Object
Represents a class, holding translations for a specific language.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static @NotNull Translations
get(@NotNull TranslationFile translationFile, @NotNull java.lang.String language)
Retrieves a newTranslations
instance with the specifiedTranslationFile
static @NotNull Translations
get(@NotNull java.io.InputStream in, @NotNull java.lang.String language)
Retrieves a newTranslations
which are bound to the ".properties" file type.static @NotNull Translations
get(@NotNull java.io.Reader reader, @NotNull java.lang.String language)
Retrieves a newTranslations
which are bound to the ".properties" file type.@NotNull java.util.Collection<java.lang.String>
getKeys()
Returns a immutable collection of the translation keys@NotNull java.lang.String
getLanguage()
Returns the language of the translations held@NotNull java.lang.String
getTranslation(@NotNull java.lang.String key, @Nullable java.lang.Object... args)
Retrieves the translation, held by the specified key.@NotNull java.lang.String
getTranslationFileType()
Returns the file type, where the translations are stored.
-
-
-
Method Detail
-
get
@NotNull public static @NotNull Translations get(@NotNull @NotNull TranslationFile translationFile, @NotNull @NotNull java.lang.String language)
Retrieves a newTranslations
instance with the specifiedTranslationFile
- Parameters:
translationFile
- translation filelanguage
- language of the translations- Returns:
- translations
-
get
@NotNull public static @NotNull Translations get(@NotNull @NotNull java.io.InputStream in, @NotNull @NotNull java.lang.String language) throws java.io.IOException
Retrieves a newTranslations
which are bound to the ".properties" file type.- Parameters:
in
- a ".properties" resource's input streamlanguage
- the language of these translations- Returns:
- translations
- Throws:
java.io.IOException
- if an i/o error occurs
-
get
@NotNull public static @NotNull Translations get(@NotNull @NotNull java.io.Reader reader, @NotNull @NotNull java.lang.String language) throws java.io.IOException
Retrieves a newTranslations
which are bound to the ".properties" file type.- Parameters:
reader
- a ".properties" resource's readerlanguage
- the language of these translations- Returns:
- translations
- Throws:
java.io.IOException
- if an i/o error occurs
-
getTranslation
@NotNull public @NotNull java.lang.String getTranslation(@NotNull @NotNull java.lang.String key, @Nullable @Nullable java.lang.Object... args)
Retrieves the translation, held by the specified key.- Parameters:
key
- the key of the translation you want to getargs
- the arguments to replace in the translation- Returns:
- translation, or a message saying that it is missing
-
getKeys
@NotNull public @NotNull java.util.Collection<java.lang.String> getKeys()
Returns a immutable collection of the translation keys- Returns:
- keys
-
getTranslationFileType
@NotNull public @NotNull java.lang.String getTranslationFileType()
Returns the file type, where the translations are stored.- Returns:
- file type
-
getLanguage
@NotNull public @NotNull java.lang.String getLanguage()
Returns the language of the translations held- Returns:
- language
-
-