|
|
|
@ -678,15 +678,25 @@ namespace Fungus
|
|
|
|
|
foreach (Match match in results) |
|
|
|
|
{ |
|
|
|
|
string key = match.Value.Substring(2, match.Value.Length - 3); |
|
|
|
|
|
|
|
|
|
// Look for matching variable first |
|
|
|
|
foreach (Variable variable in variables) |
|
|
|
|
{ |
|
|
|
|
if (variable.key == key) |
|
|
|
|
{ |
|
|
|
|
string value = variable.ToString(); |
|
|
|
|
subbedText = subbedText.Replace(match.Value, value); |
|
|
|
|
break; |
|
|
|
|
return subbedText; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// Next look for matching localized string |
|
|
|
|
string localizedString = Localization.GetLocalizedString(key); |
|
|
|
|
if (localizedString != null) |
|
|
|
|
{ |
|
|
|
|
subbedText = subbedText.Replace(match.Value, localizedString); |
|
|
|
|
return subbedText; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return subbedText; |
|
|
|
|