(77c9efbf8) Display the language names in the respective languages in the initial language selection screen. Closes #1467
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
@@ -42,6 +43,26 @@ namespace Barotrauma
|
||||
GetTextFilesRecursive(subDir, ref list);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the name of the language in the respective language
|
||||
/// </summary>
|
||||
public static string GetTranslatedLanguageName(string language)
|
||||
{
|
||||
if (!textPacks.ContainsKey(language))
|
||||
{
|
||||
return language;
|
||||
}
|
||||
|
||||
foreach (var textPack in textPacks[language])
|
||||
{
|
||||
if (textPack.Language == language)
|
||||
{
|
||||
return textPack.TranslatedName;
|
||||
}
|
||||
}
|
||||
return language;
|
||||
}
|
||||
|
||||
public static void LoadTextPacks(IEnumerable<ContentPackage> selectedContentPackages)
|
||||
{
|
||||
@@ -371,6 +392,25 @@ namespace Barotrauma
|
||||
.Replace("[Genderpronounreflexive]", Capitalize(Get("PronounReflexiveFemale")));
|
||||
}
|
||||
}
|
||||
|
||||
static Regex isCJK = new Regex(
|
||||
@"\p{IsHangulJamo}|" +
|
||||
@"\p{IsCJKRadicalsSupplement}|" +
|
||||
@"\p{IsCJKSymbolsandPunctuation}|" +
|
||||
@"\p{IsEnclosedCJKLettersandMonths}|" +
|
||||
@"\p{IsCJKCompatibility}|" +
|
||||
@"\p{IsCJKUnifiedIdeographsExtensionA}|" +
|
||||
@"\p{IsCJKUnifiedIdeographs}|" +
|
||||
@"\p{IsHangulSyllables}|" +
|
||||
@"\p{IsCJKCompatibilityForms}");
|
||||
|
||||
/// <summary>
|
||||
/// Does the string contain symbols from Chinese, Japanese or Korean languages
|
||||
/// </summary>
|
||||
public static bool IsCJK(string text)
|
||||
{
|
||||
return isCJK.IsMatch(text);
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
public static void CheckForDuplicates(string lang)
|
||||
|
||||
Reference in New Issue
Block a user