-
Notifications
You must be signed in to change notification settings - Fork 95
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 functionality in Twig templates #1690
Translation functionality in Twig templates #1690
Conversation
…re translations are visible in the browser and the translation is read at the correct point in the code
…onent is used, which is then imported into the components where translations are needed. In such an implementation, Vue components must be called as modules
Doing the initialization of Vue components like this is a somewhat invasive change, but I'll defer the discussion about this. However, I think it's problematic that each component has to call I think it would be better to initialize the service just once per page and make it available to all Vue components, without each component having to initialize it on its own. |
… agreed on in the design review. Also made some minor refactorings related to the translations themselves, as they take part in the translation functionalities, plus a few other small adjustments. However, the primary changes involve significant structural modifications related to call methods, wrappings, and timing
…de a few other small adjustments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This solution works and seems fine for now. In the future, we can think about using the vue-i18n
library if it adds any value. It would eliminate the need to check the availability of the $t
function, but there would be some blinking with the component texts. Also, it might be worth investigating if promises could be used instead of setTimeout
when checking for $t
and starting Vue components. Though, based on my brief testing and googling it seems that setTimeout
is the most straightforward way to wait for the function to be available.
113544d
to
898a64e
Compare
Quality Gate failedFailed conditions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, we can continue from here later
Implements translation functionaities centrally in JavaScript on the front end.
The implementation avoids using the vue-i18n library, aiming to reduce dependencies by relying on vanilla JavaScript. This is the first workin version, which can be improved in future iterations. Cypress tests were also added for the tables on the landing page.
Reasons for creating this PR
Translations also need to work on the frontend side and Vue components
Link to relevant issue(s), if any
Description of the changes in this PR
Known problems or uncertainties in this PR
Checklist
.sr-only
class, color contrast)