Skip to content

Commit

Permalink
Merge pull request #806 from openmod/format_localizer_when_not_found
Browse files Browse the repository at this point in the history
Format localizer string even when not found
  • Loading branch information
Trojaner authored Feb 5, 2024
2 parents fbba267 + 0b303fd commit 91aceff
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,12 @@ public LocalizedString this[string name]
get
{
var configValue = m_Configuration.GetSection(name);
if (!configValue.Exists() || string.IsNullOrEmpty(configValue.Value))
{
return new LocalizedString(name, name, resourceNotFound: true);
}

var formatter = m_Options.Value.GetSmartFormatter();
return new LocalizedString(name, formatter.Format(configValue.Value ?? string.Empty, arguments));

var found = configValue.Exists() && !string.IsNullOrEmpty(configValue.Value);
var value = formatter.Format(found ? configValue.Value : name, arguments);

return new LocalizedString(name, value, resourceNotFound: !found);
}
}

Expand Down

0 comments on commit 91aceff

Please sign in to comment.