Closed elias6 closed 4 years ago
As mentioned in your linked issue you can use the useText
hook. Drawback (compared to <Text>
): you can use hooks only in the render
method.
One-liner to translate a single id
:
useText('Balances.tableHeadings.biddingZone').biddingZone
useText
will be the easiest way to do it inside of a component, but if you are outside a component and need to translate something I think it's reasonable to use the translate
function.
Can you test out https://github.com/synacor/preact-i18n/pull/48 to see if it works for you?
The translate
function is now exported in preact-i18n@2.3.0-preactx
.
I am using preact-i18n to render some components with translated text. But now, all of a sudden, we are using a 3rd-party API that requires a string to be passed to it. Is there any (easy) way to do this using preact-i18n?
I mentioned that here but I'm creating a new issue since I think this is not quite related. It would be so nice if the
translate
function insrc/lib/translate.js
were exposed.