Closed pontaoski closed 2 years ago
Extractor does not handle expressions as part of interpolated string parameter, which is also mentioned in the docs, and the general recommendation and workaround in your case would be to
string username = "username".Color(Utils.GreenHighlight);
string password = "password".Color(Utils.BoldHighlight);
GetString($"{Specifier}login {username} {password} - Logs in using your username and password.")
However I do agree that handling of string parameters could be improved for some cases.
update now handles cases like
internal class Program
{
static void Main(string[] args)
{
Catalog catalog = CatalogManager.Catalog;
string Specifier = "Specifier";
catalog.GetString($"{Specifier}login {"username".Color(Color.White)} {"password".Color(Color.Green)} - Logs in using your username and password.");
catalog.GetString($"some {"strange"} text");
catalog.GetString($"some {catalog.GetString("strange")} text");
}
}
static class StringExtension
{
public static string Color(this string value, Color color)
{
return value;
}
}
msgid "some {0} text" msgstr ""
msgid "{0}login {1} {2} - Logs in using your username and password." msgstr ""
msgid "strange" msgstr ""
Probably incorporating some other updates next couple days before releasing a new version.
closing as of 1.7.14
Example:
gets extracted as
rather than