You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On the project I'm currently working we needed to support several languages so we ended upusing preact-helmet to inject the title and the corresponding metatags for each of the App views, but I'm unable to make it work with {{fields}} placeholders, so I created this sample project to demonstrate the issue.
How to install and run the sample project
Clone the repository with git clone git@github.com:acangiani/preact-i18n-issue.git
Install the dependencies: npm install
Run the project npm run start
First view
This one works fine and correctly adds the title and the title metatag.
Doing curl http://localhost:3000/, this outputs the following html:
@acangiani Thanks for the report. withText is also capable of accepting a function which will receive props, and resolve <Text> components with fields. I gave your App a try and the following changes seemed to make the title render correctly:
On the project I'm currently working we needed to support several languages so we ended upusing preact-helmet to inject the title and the corresponding metatags for each of the App views, but I'm unable to make it work with
{{fields}}
placeholders, so I created this sample project to demonstrate the issue.How to install and run the sample project
git clone git@github.com:acangiani/preact-i18n-issue.git
npm install
npm run start
First view
This one works fine and correctly adds the title and the title metatag.
Doing
curl http://localhost:3000/
, this outputs the following html:Second view
On the other hand on this view I needed to use a
{{field}}
placeholder, so doingcurl http://localhost:3000/test
, this outputs the following html:Things I tried
@withText
as decorator on the second view, but I cannot access the props.withText
as a functional component wrapper so to obtain the translated text but I couldn't make it work.but I only obtained the default text regardless of the i18n definitions loaded on the
IntlProvider
.Bottom line what I need it's to obtain the translated text as a string but I'm unable to do so, could you please help with this?
The text was updated successfully, but these errors were encountered: