-
Notifications
You must be signed in to change notification settings - Fork 0
/
MultiLangRocketPlugin.cs
39 lines (29 loc) · 1.56 KB
/
MultiLangRocketPlugin.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using Rocket.API;
using Rocket.Core.Plugins;
using Steamworks;
namespace SMultiLangTranslations
{
public abstract class MultiLangRocketPlugin : RocketPlugin, IMultiLangTranslator
{
public MultiLangRocketPlugin()
{
Translator = MultiLangManager.RegisterTranslator(this);
}
public virtual IMultiLangTranslator Translator { get; }
public string Translate(string code, string key, params object[] placeholder) => Translator.Translate(code, key, placeholder);
public new string Translate(string key, params object[] placeholder) => Translator.Translate(key, placeholder);
public string Translate(IRocketPlayer player, string key, params object[] placeholder) => Translator.Translate(player, key, placeholder);
}
public abstract class MultiLangRocketPlugin<PluginConfiguration> : RocketPlugin<PluginConfiguration>, IMultiLangTranslator
where PluginConfiguration : class, IRocketPluginConfiguration
{
public MultiLangRocketPlugin()
{
Translator = MultiLangManager.RegisterTranslator(this);
}
public virtual IMultiLangTranslator Translator { get; }
public string Translate(string code, string key, params object[] placeholder) => Translator.Translate(code, key, placeholder);
public new string Translate(string key, params object[] placeholder) => Translator.Translate(key, placeholder);
public string Translate(IRocketPlayer player, string key, params object[] placeholder) => Translator.Translate(player, key, placeholder);
}
}