(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:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user