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

Add i18n internationalization support #21

Closed
blankdots opened this issue Jul 15, 2020 · 8 comments · Fixed by #482
Closed

Add i18n internationalization support #21

blankdots opened this issue Jul 15, 2020 · 8 comments · Fixed by #482
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@blankdots
Copy link
Contributor

Description

Add internationalization support using https://react.i18next.com/ (or similar) for Finnish and English.

DoD (Definition of Done)

UI is able to switch between language seamlessly.
There is a dropdown that allows language switching in the menu bar

Testing

Peer review (for now)

@blankdots blankdots added the enhancement New feature or request label Jul 15, 2020
@otahontas otahontas self-assigned this Jul 21, 2020
@otahontas otahontas removed their assignment Aug 11, 2020
@otahontas
Copy link
Contributor

otahontas commented Aug 13, 2020

Regarding internalization for forms, we can do translations for different schemas like study_fi.json / study_sv.json with titles and descriptions for each field. Then on frontend study_fi.json is should be appended to study.json, so all titles / descriptions from study.json are overridden.

@otahontas
Copy link
Contributor

otahontas commented Aug 13, 2020

For form errors we should use https://github.com/ajv-validator/ajv-i18n. It doesn't (currently) have finnish translations, so they should be probably created by csc

@hannyle hannyle self-assigned this Dec 2, 2020
@blankdots blankdots added this to the Open Beta milestone Aug 9, 2021
@blankdots
Copy link
Contributor Author

we need to be able to remember the language selection in the route (url)

@saulipurhonen saulipurhonen mentioned this issue Oct 7, 2021
2 tasks
@saulipurhonen saulipurhonen linked a pull request Oct 7, 2021 that will close this issue
2 tasks
@saulipurhonen
Copy link
Contributor

About translating forms I see at least two options:

  1. Have translated schemas ready in the backend and this way reduce computing on client side
  2. Client translates the schema on fetch. Translated schema can be stored in session storage along with original schema

@blankdots
Copy link
Contributor Author

About translating forms I see at least two options:

  1. Have translated schemas ready in the backend and this way reduce computing on client side
  2. Client translates the schema on fetch. Translated schema can be stored in session storage along with original schema

option 1 sounds ok, however is there an option that we can also have them in front-end as assets?

e.g. in another project we store them as: https://github.com/CSCfi/swift-browser-ui/blob/master/swift_browser_ui_frontend/src/common/lang.js or this is equivalent with option 2?

@saulipurhonen
Copy link
Contributor

option 1 sounds ok, however is there an option that we can also have them in front-end as assets?

e.g. in another project we store them as: https://github.com/CSCfi/swift-browser-ui/blob/master/swift_browser_ui_frontend/src/common/lang.js or this is equivalent with option 2?

This is basically equivalent. We'd need to traverse original schema and return a schema with matching translations from assets. This action don't benefit from i18next library.

One another option could be translating fields on the fly with i18next library but I think it is a bad idea since form might re-render on different occasions causing unnecessary load on client.

Workload wise I think the option shouldn't matter much. Only concern is frontend performance

@blankdots
Copy link
Contributor Author

ok, i will add something for that in backend

@blankdots blankdots added the backend backend issue label Oct 8, 2021
@blankdots
Copy link
Contributor Author

closing as this is going to be continued in the issues #489 and #490

@blankdots blankdots removed the backend backend issue label Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants