[API CHANGE] Add optional graceful handling of missing variables
In application I am working on, we have a lot of user generated content which gets updated and changed over time.
This results in some of the configured variables to get out of date. This makes the formatting functions throw lots of exceptions, which litters the logs and it's not quite desirable.
I have added an optional boolean argument, which allows the formatting to quietly ignore missing variables where desired and just assume they're default values, which is more preferable behavior for my use-case.
NOTE: This includes commits from my other two PR's, since I had to do those to be able to compile and run tests.
Hey @Frooxius , thanks for the PR, especially those locale-specific unit test fixes! 🙌
I don't think we should add a new parameter to FormatMessage for this. I do have an idea though. How about we allow passing in a custom FormatterLibrary, and make a change to FormatterLibrary's constructor to accept a allowMissingVariables boolean (false by default), as well as all the built-in formatters to accept this new configuration option? We would need test cases that cover the new behavior, of course.
What do you think?