Browse Source

Use localised strings keys in variable substitution. #8

master
chrisgregan 10 years ago
parent
commit
015d6e9204
  1. 12
      Assets/Fungus/Flowchart/Scripts/Flowchart.cs

12
Assets/Fungus/Flowchart/Scripts/Flowchart.cs

@ -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;

Loading…
Cancel
Save