Add overrideContext configuration#76
Add overrideContext configuration#76marksteele wants to merge 4 commits intoalexanderwallin:masterfrom
Conversation
|
Thanks for the submit! The problem with this is that a static code analyser like Not sure how to tackle this... 🤔 But I think we need to solve that before looking at the implementation. |
|
That's exactly right, the parser has no way of knowing the contexts, if there is a need to do this kind of thing you'd want it to be passed in via configuration (as in the examples/tests). The solution I provided addresses the problem I was facing when trying to think about how to have multiple contexts. The assumption is that the caller knows what contexts to expect then they want to override them. In my example I'm using gender, but it could be something else (not a linguist, so not sure what other use cases there might be). Definitely a need for something like this to handle french, spanish, and probably several other languages. Otherwise you end up with something like this: which is the only way to get to have the proper contexts extracted from the source. Obviously this is far from ideal as there's lots of needless duplication. The static code analysis needs not care about the context in the components (which is why I called it an override, as it discards whatever value is in the context and overrides with with values from the provided configuration list). |
Adds ability to override context parsed from code with a list of overrides.
This is useful for the common case of languages that have variations based on gender where the usual approach with gettext is to use contexts for managing the gender variations.