Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translation does not work for ReactAdapterElement #20336

Open
sveinnetnordic opened this issue Oct 25, 2024 · 3 comments
Open

Translation does not work for ReactAdapterElement #20336

sveinnetnordic opened this issue Oct 25, 2024 · 3 comments
Labels
enhancement hilla Issues related to Hilla

Comments

@sveinnetnordic
Copy link

Description of the bug

translate('demo.react.hello') does not work in ReactAdapterElement. Found the magic trick to add a dummy view in the frontend/views folder.

BTW: Frontend translation works very good now, with hotswap too.

Expected behavior

Work without the magic trick that activates Hilla

Minimal reproducible example

{translate('demo.react.hello')}

Versions

24.5.1

@mshabarov mshabarov added enhancement hilla Issues related to Hilla labels Oct 29, 2024
@mshabarov
Copy link
Contributor

The i18n new API for Hilla doesn't unfortunately work without Hilla being used (imported packages, generator and so on). This explains your workaround.
We need to generate the translation API even without Hilla to make this work.

@mshabarov
Copy link
Contributor

This is similar to #20289 (comment), i.e. a bundle can be used and partial Hilla installation. The complexity is how Flow can detect the usage of the Hilla's i18n API in the project.

@Legioth
Copy link
Member

Legioth commented Nov 8, 2024

The react-i18n module is a Hilla feature. It might indeed also be useful in other contexts such as ReactAdapterElement but that's not what it's designed for. The workaround of adding a dummy Hilla view does thus seem reasonable even though it would of course be convenient if it wouldn't be needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement hilla Issues related to Hilla
Projects
None yet
Development

No branches or pull requests

3 participants