-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathResourcesHelper.cs
30 lines (26 loc) · 976 Bytes
/
ResourcesHelper.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
using ServerTCP.Properties;
using System.Globalization;
namespace ServerTCP
{
internal class ResourcesHelper
{
public static string LocalizationGet(string resource, MessageLanguages.Languages lang)
{
if (string.IsNullOrEmpty(resource))
throw new ArgumentNullException(nameof(resource));
string resourceReady = string.Empty;
switch (lang)
{
case MessageLanguages.Languages.rus:
resourceReady = Resources.ResourceManager.GetString(resource, new CultureInfo("ru-RU"));
break;
default:
resourceReady = Resources.ResourceManager.GetString(resource, new CultureInfo("en-GB"));
break;
}
if (string.IsNullOrEmpty(resourceReady))
throw new ArgumentNullException(nameof(resourceReady));
return resourceReady;
}
}
}