You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since fill uses sprintf, parameters depend on the position in the translation.
Sometimes it can make sense to swap the placeholders.
Further providing names to placeholders can help translators to find the right translation.
I have written an additional extension method fillMap that does this:
Here are few statements from the unit-tests:
expect("doesnt need any placeholder".fillMap({"unused":3}),
"doesnt need any placeholder");
expect("<placeholder%d> and <placeholder%03d>".fillMap({"placeholder":3}),
equals("3 and 003"));
expect("<placeholder>".fillMap({"placeholder":3}), equals("3"));
expect("<placeholder/>".fillMap({"placeholder":3}), equals("3")); /// optional / to make it look like a standalone html tag. helps with automatic translation tools, that sometime expand <placehoder> to <placeholder></placeholder>. expect(() =>"some <placeholder>".fillMap({}), throwsFormatException);
expect("<placeholder%d> and <other>".fillMap({"other":3}, keep: {"placeholder"}),
equals("<placeholder%d> and 3"));
Would you accept a PR to add this method to your repo ?
The text was updated successfully, but these errors were encountered:
Since fill uses
sprintf
, parameters depend on the position in the translation.Sometimes it can make sense to swap the placeholders.
Further providing names to placeholders can help translators to find the right translation.
I have written an additional extension method
fillMap
that does this:Here are few statements from the unit-tests:
Would you accept a PR to add this method to your repo ?
The text was updated successfully, but these errors were encountered: