Open blinry opened 1 year ago
Oh! We learned that
gt`test`
works! What does this syntax mean?
Hey, thanks for trying out the lib!
I made gt
syntax mostly the same as $t
would in Svelte components, so it can accept either of these two forms:
gt`test`
is the right way to translate either plain strings or parameterized strings. This JS syntax behaves like calling the function called gt
and passing in a parameterized string as its argument, so this is sort of equivalent of writing gt(`test`)
, just shorter :grin:gt({message: "test"})
. This form is mostly only necessary if you'd like to add comments or context to the string extracted to the catalog, or if you'd like to use the plural form.Let me know if you have any other question 😄
Makes sense! I'd suggest adding an example using gt`foo`
to the README, so others will be less stumped than us! :D
Ohh, and that you can drop the parens is some some nice syntactic sugar, thanks for the explanation!
We tried using a line like
in a TS file, and the jstsExtractor didn't catch it. We checked the code, and it seems that it currently only works on expressions like this:
Would it make sense to also allow
gt
to take plain strings? Thanks!