Can't figure out how to use translation variables
See original GitHub issueI tried:
{$t("foot", { default: 'hello', count: 1 })}
The default works, but using the example, the count isn’t working. What am I missing?
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
How can I add variables to my translations? - Help Center
Click on it to access the panel: You should now see the information panel of the translation you've selected. Click on the "Variables"...
Read more >Variables as args in translation function - WordPress.org
You can add variables to translated strings by using sprintf() , but you can't translate those variables. In your example, you have this...
Read more >How to Automatically Translate Text Variables into Other ...
Select the text variable to be translated in the Data Sets tree. From the object inspector, go to Properties > TRANSFORMATIONS > Translate...
Read more >Translating variables into english [closed]
I have recently came across some code where the variable names are in french, I could not use google translate because only part...
Read more >Top Tips for Translations - Engineering @ Binti
Many translation libraries will allow the translator to change the order of variables, which is effective if you can be precise with your ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I copied the API from
svelte-i18n
. Values must be passed inside avalues
key. In your example it should be{$t("foot", { default: 'hello', values: { count: 1 } })}
. I personally don’t like that too much, I find it a bit verbose, but since svelte-i18n is the most popular i18n library for svelte by a lot I thought it was wise to just use the exact same API to make transitioning to this library dead simple.Great to hear, closing this!