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

Police Oversight form: Identify translation strategy #1045

Closed
amenity opened this issue Jan 16, 2019 · 13 comments
Closed

Police Oversight form: Identify translation strategy #1045

amenity opened this issue Jan 16, 2019 · 13 comments
Assignees
Labels
Department: Police Oversight Office of Police Oversight content and services Feature: Forms Digital forms for residents to access city services Feature: Translation Allows residents to read Austin.gov content in their preferred language. Police Oversight Form Size: M Team: Dev
Milestone

Comments

@amenity
Copy link
Contributor

amenity commented Jan 16, 2019

Requirements:

For now, translations can be hardcoded/edited directly in yaml, json, etc.

@amenity amenity added this to the Sprint 22 milestone Jan 16, 2019
@amenity amenity added Size: M Team: Dev Feature: Translation Allows residents to read Austin.gov content in their preferred language. Feature: Forms Digital forms for residents to access city services Department: Police Oversight Office of Police Oversight content and services Police Oversight Form labels Jan 16, 2019
@sergiogcx
Copy link

This is one library I have been looking at:

https://www.i18next.com/overview/configuration-options
https://react.i18next.com/
https://github.com/i18next/react-i18next

It supports:

  • Json Configuration
  • Interpolation
  • Plurals
  • Formatting
  • etc.

There are others we can use or implement our own ...

@sergiogcx
Copy link

the json files can be stored and edited on github (as we have talked about during the sprint review on Jan 24)

@amenity amenity modified the milestones: Sprint 22, Sprint 23 Jan 24, 2019
@LauraTrujillo
Copy link
Contributor

LauraTrujillo commented Feb 6, 2019

Translated content:

@amenity amenity modified the milestones: Sprint 23, Sprint 24 Feb 12, 2019
@amenity
Copy link
Contributor Author

amenity commented Feb 12, 2019

@easherma is going to move forward with this looking at Babel.js and the Janis strategy: Is this something we can implement in a week? If so, let's create issues and get on it.

@easherma
Copy link
Contributor

i18next/react-i18next#303

Comparison between react-i18next and react-intl. The latter is being used by Janis. I agree with @sergiogcx at first blush i18next seems more useful overall, but it also seems more geared for server side rendering.

Also related and cool-looking:
https://locize.com/

@sergiogcx
Copy link

sergiogcx commented Feb 12, 2019

I'm fine with react-intl, I liked react-i18next but it seemed difficult to work with especially given our multi-repo architecture.

I was looking at https://lingui.js.org/tutorials/react.html which seems a lot easier to implement, but did not have the time to play with it yet.

But I am totally fine with any framework of your choosing @easherma

@easherma
Copy link
Contributor

@sergiogcx has this branch up: cityofaustin/officer-complaint-form#28
this is the POF for our contingency if we run out of time before launch to do translation the 'right' way

@easherma
Copy link
Contributor

I am leaning towards react-i18next. At first glance, it is more intuitive to me. I also like that it is more framework-agnostic. Either way I'm trying to get a sense of how much re-writing of our code and us-forms systems either would require. I think I'll just try both in seperate branches.

@sergiogcx at first glance did anything stick out as easier to you in particular about lingui.js vs react-intl? They seemed very similar.

@easherma
Copy link
Contributor

easherma commented Feb 13, 2019

Also relevant threads:

usds/us-forms-system#170 <--- dependency of our forms
rjsf-team/react-jsonschema-form#739 <-- dependency of us-forms-system

@sergiogcx
Copy link

@easherma Lingui has a CLI that helps manage locales, not sure if react-intl does too. Anyhow, I think you would know which to choose best. Not married to the idea of trying any other not already mentioned,

@easherma
Copy link
Contributor

This is tricky mainly because:

  • us-forms system has some english 'embedded' in it's components
  • the library it is based off of uses JSON to define schemas, so there are lots of nested titles and descriptions.

@easherma
Copy link
Contributor

easherma commented Feb 13, 2019

Outstanding question: Where is the 'best' place for this, architecture wise?

Option 1:
• start with us-forms, add dependency library,
• wrap components
• test
• translate buttons, UI stuff. probably going to run into problems with us-forms sytem + then the schema needs to be translated/translatable (there are github issues that address this)

Results if it works:
• we'd have a fork of a forms system that supports internationalization! (yay)
• we'll have tagged files ready to be updated by content to manage translations through whatever 'separate' process we set
• this may or may not line up with how janis works, and if we decide to refactor forms in a totally different way we'll need to include/consider internationalization along with it

Option 2:
• we search through the generated app for known string matches (this isn't super sustainable but is surprisingly common)
• we map translations to these strings as keys
• incorporate this process into the build pipeline

Results
• we'd have a pretty flexible process we could re-use in just about any other situation in a pinch ( yay python)
• we'd have a process ready for tagging content to be translated and have a better idea of how to avoid this mess in the future

@easherma
Copy link
Contributor

We're going with @sergiogcx's branch to translate the forms after build for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Department: Police Oversight Office of Police Oversight content and services Feature: Forms Digital forms for residents to access city services Feature: Translation Allows residents to read Austin.gov content in their preferred language. Police Oversight Form Size: M Team: Dev
Projects
None yet
Development

No branches or pull requests

4 participants