(13b4e32e2) Added a method that can be used to add punctuation between strings, while taking into account special rules in some languages (e.g. a breaking space before a colon in French). Removed colons from a bunch of menu labels where they're not necessary.

This commit is contained in:
Joonas Rikkonen
2019-05-16 07:01:08 +03:00
parent 63af8ddac8
commit c18f72e12e
12 changed files with 107 additions and 189 deletions
@@ -238,6 +238,29 @@ namespace Barotrauma
return true;
}
/// <summary>
/// Adds a punctuation symbol between two strings, taking into account special rules in some locales (e.g. non-breaking space before a colon in French)
/// </summary>
public static string AddPunctuation(char punctuationSymbol, params string[] texts)
{
string separator = "";
switch (GameMain.Config.Language)
{
case "French":
bool addNonBreakingSpace =
punctuationSymbol == ':' || punctuationSymbol == ';' ||
punctuationSymbol == '!' || punctuationSymbol == '?';
separator = addNonBreakingSpace ?
new string(new char[] { (char)(0xA0), punctuationSymbol, ' ' }) :
new string(new char[] { punctuationSymbol, ' ' });
break;
default:
separator = new string(new char[] { punctuationSymbol, ' ' });
break;
}
return string.Join(separator, texts);
}
public static List<string> GetAll(string textTag)
{
if (!textPacks.ContainsKey(Language))