Skip to content

Commit 5e3995c

Browse files
IIIaKaMrBlue
authored andcommitted
Add GetMessageByLanguage method to lang library
1 parent cbc92d8 commit 5e3995c

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

src/Libraries/Lang.cs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public string[] GetLanguages(Plugin plugin = null)
125125
}
126126

127127
/// <summary>
128-
/// Gets a message for a plugin in the required language
128+
/// Gets a message for a plugin in the players set language
129129
/// </summary>
130130
/// <param name="key"></param>
131131
/// <param name="plugin"></param>
@@ -142,6 +142,24 @@ public string GetMessage(string key, Plugin plugin, string userId = null)
142142
return GetMessageKey(key, plugin, GetLanguage(userId));
143143
}
144144

145+
/// <summary>
146+
/// Gets a message for a plugin in the specified language
147+
/// </summary>
148+
/// <param name="key"></param>
149+
/// <param name="plugin"></param>
150+
/// <param name="lang"></param>
151+
/// <returns></returns>
152+
[LibraryFunction("GetMessageByLanguage")]
153+
public string GetMessageByLanguage(string key, Plugin plugin, string lang = defaultLang)
154+
{
155+
if (string.IsNullOrEmpty(key) || plugin == null)
156+
{
157+
return key;
158+
}
159+
160+
return GetMessageKey(key, plugin, lang);
161+
}
162+
145163
/// <summary>
146164
/// Gets all messages for a plugin in a language
147165
/// </summary>

0 commit comments

Comments
 (0)