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

translations #538

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

PatrikTrefil
Copy link

@PatrikTrefil PatrikTrefil commented Oct 6, 2023

fixes #522

Copy link
Contributor

@brendanbond brendanbond left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey thanks again for the PR! The problem here though, is as I mentioned in the issue you opened: this library is designed to be a thin(ish) wrapper around the formio.js javascript form renderer. You can see that, for now, the core renderer already loads i18next (as of the next major version, it will use a home-rolled solution for translation, but the point remains).

So in other words, rather than load a new dependency in the react renderer, we merely need to access the underlying Component methods to translate.

@PatrikTrefil
Copy link
Author

I do not really undestand how you think this should be implemented. At the level of the FormEdit component, which is the only component that requires the translations, we do not have any of the formiojs components available on which we could call the t() method. Since the t() method is not static, we need an instance to call it on. The instance of the FormBuilder class which is a subclass of the Component class is owned by the underlying FormBuilder react component, so we do not have access to it.

I think the issue is that the translation logic is written in the Component class. There should be a separate class with a singleton instance, which does the translation logic (similar design as the react-i18next library uses). This would require making changes in the formiojs library.

Maybe you have an idea how it should be implemented, but I just don't see it now. Please describe your solution further if you still think your solution is viable.

@PatrikTrefil
Copy link
Author

Any updates on this please?

@brendanbond
Copy link
Contributor

@PatrikTrefil hey thanks for checking in, I'm actually working (broadly) on this issue now. I should have an alternate implementation hopefully very soon.

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

Successfully merging this pull request may close these issues.

Translating FormEdit
2 participants