Package com.mrivanplays.jdcf.translation
Class Translations
- java.lang.Object
-
- com.mrivanplays.jdcf.translation.Translations
-
public class Translations extends java.lang.ObjectRepresents 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 Translationsget(@NotNull TranslationFile translationFile, @NotNull java.lang.String language)Retrieves a newTranslationsinstance with the specifiedTranslationFilestatic @NotNull Translationsget(@NotNull java.io.InputStream in, @NotNull java.lang.String language)Retrieves a newTranslationswhich are bound to the ".properties" file type.static @NotNull Translationsget(@NotNull java.io.Reader reader, @NotNull java.lang.String language)Retrieves a newTranslationswhich 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.StringgetLanguage()Returns the language of the translations held@NotNull java.lang.StringgetTranslation(@NotNull java.lang.String key, @Nullable java.lang.Object... args)Retrieves the translation, held by the specified key.@NotNull java.lang.StringgetTranslationFileType()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 newTranslationsinstance 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 newTranslationswhich 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 newTranslationswhich 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
-
-