Add option to log dynamic translation lookups (in HBS files) #514
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds the option to detect dynamic translation lookups, as suggested in #9. This is still a work in progress (e.g. it needs more tests), but it can be tested manually already. For now this only detects them in HBS files, but with some changes I think it's doable for JS files as well (in another PR though).
Note that this PR builds on top of #483, as I made changes there that made it easy to detect dynamic parts in a template.
@Turbo87, is this what you had in mind (if anything) in terms of logging? I was also thinking of trying to map unused translations to the dynamic translations to find a match as a suggestion for the whitelist. To illustrate what I mean by that: if you have the following in a template:
and an actual translation:
then this PR logs out:
This is something we can turn into a regex:
/^prefix\..*\.value$/
and provide as a suggestion for whitelisting the unused translation.