Interface Localizer
- All Superinterfaces:
ViewProvider<Localizer>
A Localizer is used for the localization of translatable strings.
This API is highly experimental and will be subject to change due to pending localization reworks.
In its current state, it acts as a bridge between old and new API.
- See Also:
-
Method Summary
Modifier and TypeMethodDescription@Nullable String
@Nullable String
static Localizer
of
(SkriptAddon addon) void
setSourceDirectories
(String languageFileDirectory, @Nullable String dataFileDirectory) Sets the language file directories for this localizer.@Nullable String
Used for obtaining the translation of a language key.default Localizer
Constructs an unmodifiable view of this localizer.
-
Method Details
-
of
- Parameters:
addon
- The addon this localizer is localizing for.- Returns:
- A localizer with no default translations.
-
setSourceDirectories
void setSourceDirectories(String languageFileDirectory, @Nullable @Nullable String dataFileDirectory) Sets the language file directories for this localizer. This method will initiate a loading of any language files in the provided directories.- Parameters:
languageFileDirectory
- The path to the directory on the jar containing language files.dataFileDirectory
- The path to the directory on the disk containing language files. For example, this may include language files that have been saved to enable user customization.
-
languageFileDirectory
- Returns:
- The path to the directory on the jar containing language files.
-
dataFileDirectory
- Returns:
- The path to the directory on the disk containing language files.
-
translate
Used for obtaining the translation of a language key.- Parameters:
key
- The key of the translation to obtain.- Returns:
- The translation represented by the provided key, or null if no translation exists.
-
unmodifiableView
Constructs an unmodifiable view of this localizer. That is, no new translations may be added.- Specified by:
unmodifiableView
in interfaceViewProvider<Localizer>
- Returns:
- An unmodifiable view of this localizer.
-