3 using System.Collections.Generic;
4 using System.Collections.Immutable;
14 private readonly StringComparison stringComparison;
19 replacements = r.Select(kvf => (kvf.Key, (kvf.Value, kvf.FormatCapitals))).ToImmutableDictionary();
20 stringComparison = sc;
32 private static string HandleVariableCapitalization(
string text,
string variableTag,
string variableValue)
34 int index = text.IndexOf(variableTag, StringComparison.InvariantCulture) - 1;
40 for (
int i = index; i >= 0; i--)
42 if (
char.IsWhiteSpace(text[i])) {
continue; }
46 variableValue = variableValue.ToLowerInvariant();
50 variableValue = TextManager.Capitalize(variableValue).Value;
58 public override bool Loaded => nestedStr.Loaded;
62 foreach (var varName
in replacements.Keys)
64 string key = varName.Value;
65 string value = replacements[varName].Value.Value;
68 value = HandleVariableCapitalization(
cachedValue, key, value);
ReplaceLString(LocalizedString nStr, StringComparison sc, params(LocalizedString Key, LocalizedString Value)[] r)
ReplaceLString(LocalizedString nStr, StringComparison sc, IEnumerable<(Identifier Key, LocalizedString Value, FormatCapitals FormatCapitals)> r)
ReplaceLString(LocalizedString nStr, StringComparison sc, IEnumerable<(LocalizedString Key, LocalizedString Value, FormatCapitals FormatCapitals)> r)
ReplaceLString(LocalizedString nStr, StringComparison sc, params(Identifier Key, LocalizedString Value)[] r)
override void RetrieveValue()