Class TranslationManager
Used to handle plugin translations.
public static class TranslationManager
- Inheritance
-
TranslationManager
- Inherited Members
Methods
Clear()
Clears the translations.
public static bool Clear()
Returns
- bool
Returns a value indicating whether translations have been cleared successfully.
Load(string)
Loads all of the plugin's translations.
public static SortedDictionary<string, ITranslation> Load(string rawTranslations)
Parameters
rawTranslationsstringThe raw translations to be loaded.
Returns
- SortedDictionary<string, ITranslation>
Returns a dictionary of loaded translations.
LoadTranslation(IPlugin<IConfig>, Dictionary<string, object>)
Loads the translations of a plugin based on the actual distribution.
public static ITranslation LoadTranslation(this IPlugin<IConfig> plugin, Dictionary<string, object> rawTranslations = null)
Parameters
pluginIPlugin<IConfig>The plugin which its translation has to be loaded.
rawTranslationsDictionary<string, object>The raw translations to check whether the plugin already has a translation config.
Returns
- ITranslation
The ITranslation of the desired plugin.
Read()
Read all plugin translations.
public static string Read()
Returns
- string
Returns the read translations.
Reload()
Reads, loads, and saves plugin translations.
public static bool Reload()
Returns
- bool
Returns a value indicating if the reloading process has been completed successfully or not.
Save(SortedDictionary<string, ITranslation>)
Saves plugin translations.
public static bool Save(SortedDictionary<string, ITranslation> translations)
Parameters
translationsSortedDictionary<string, ITranslation>The translations to be saved.
Returns
- bool
Returns a value indicating whether the translations have been saved successfully.
SaveDefaultTranslation(string)
Saves default distribution translations.
public static bool SaveDefaultTranslation(string translations)
Parameters
translationsstringThe translations to be saved, already serialized in yaml format.
Returns
- bool
Returns a value indicating whether the translations have been saved successfully.
SaveSeparatedTranslation(string, string)
Saves plugin translations based on the separated distribution.
public static bool SaveSeparatedTranslation(this string pluginPrefix, string translations)
Parameters
pluginPrefixstringThe prefix of the plugin which its translation is going to be saved.
translationsstringThe translations to be saved, already serialized in yaml format.
Returns
- bool
Returns a value indicating whether the translations have been saved successfully.