Change interpolation string for t helper #21518
Draft
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.
Change interpolation string for translation helpers from {{ }} to { }. (Per discussion with Hannah, here: https://ghost.slack.com/archives/C018EKC56JF/p1730728246971699?thread_ts=1730560172.481589&cid=C018EKC56JF .)
Context for the future:
The 't' helper works in both javascript and handlebars.
Syntax for javascript:
t('some string {variable} is {another}', {variable: value1, another: value2}
Syntax for handlebars:
{{t 'some string {variable} is {another}' variable=value1 another=value2}}
Using the 't' helper in handlebars means really really wanting the {substitutions} to be single bracketed, because it's really messy otherwise what's handlebars and what's interpolation.
Themes currently use single { } for variables. We don't want to break existing themes.
We've been using double {{ }} for variables in portal, ghost, search, comments. But then in newsletter, we had a mix of .hbs and .js, so switched to single { }. Which meant things were inconsistent.
So, this beast of a patch converts all variables to using single brackets.
I ran a script that went through all the existing translations and rewrote all the keys (and values).. New changes should get added normally, but changing keys (even the variables within them) is bad, so it needed a one-time rewrite.