Client LuaCsForBarotrauma
AddedPunctuationLString.cs
1 #nullable enable
2 using System.Collections.Immutable;
3 using System.Linq;
4 
5 namespace Barotrauma
6 {
8  {
9  private readonly ImmutableArray<LocalizedString> nestedStrs;
10  private readonly char punctuationSymbol;
11 
12  public AddedPunctuationLString(char symbol, params LocalizedString[] nStrs) { nestedStrs = nStrs.ToImmutableArray(); punctuationSymbol = symbol; }
13 
14  public override bool Loaded => nestedStrs.All(s => s.Loaded);
15  public override void RetrieveValue()
16  {
17  string separator = "";
18  if (GameSettings.CurrentConfig.Language == "French".ToLanguageIdentifier())
19  {
20  bool addNonBreakingSpace =
21  punctuationSymbol == ':' || punctuationSymbol == ';' ||
22  punctuationSymbol == '!' || punctuationSymbol == '?';
23  separator = addNonBreakingSpace ?
24  new string(new char[] { (char)(0xA0), punctuationSymbol, ' ' }) :
25  new string(new char[] { punctuationSymbol, ' ' });
26  }
27  else
28  {
29  separator = new string(new char[] { punctuationSymbol, ' ' });
30  }
31  cachedValue = string.Join(separator, nestedStrs.Select(str => str.Value));
33  }
34  }
35 }
AddedPunctuationLString(char symbol, params LocalizedString[] nStrs)