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 closes #6, this adds translation templates by leveraging
.replace()
in all cases. This would leave the only case where a translation is not heap allocated when the translation does not contain templates and the macro invocation isall-static
.The only missing thing is generating a warning when
x = x
is used instead ofx
, but for that we needcompile_warning!
. Which isn't going to be released probably until 2026.I'd say we can leave that commented, document and merge. Then implement it when it's implemented into the standard library.
The README is updated with the modifications this PR makes, there is no actual checking for macros as it would possibly need to change how the macro works entirely, and I believe that's also unnecessary. Escaping still works for the edge case where you have an actual parameter and you want to do something like
{{x}} = {x}
inside the translation for some reason.