Files
archived-discord-bot/Clients/PsnClient/Utils/LocaleUtils.cs
13xforever 92751ba6e9 use file-scoped namespaces to reduce nesting
some formatting might be fucked
2022-06-30 00:59:46 +05:00

17 lines
499 B
C#

namespace PsnClient.Utils;
public static class LocaleUtils
{
public static (string language, string country) AsLocaleData(this string locale)
{
/*
"zh-Hans-CN" -> zh-CN
"zh-Hans-HK" -> zh-HK
"zh-Hant-HK" -> ch-HK
"zh-Hant-TW" -> ch-TW
*/
locale = locale.Replace("zh-Hans", "zh").Replace("zh-Hant", "ch");
var localeParts = locale.Split('-');
return (localeParts[0], localeParts[1]);
}
}