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

Fully internationalize NoRent.org #1384

Closed
32 of 33 tasks
toolness opened this issue May 6, 2020 · 1 comment
Closed
32 of 33 tasks

Fully internationalize NoRent.org #1384

toolness opened this issue May 6, 2020 · 1 comment

Comments

@toolness
Copy link
Collaborator

toolness commented May 6, 2020

Ok, we're ramping up i18n for the NoRent site, which resides in this codebase, so this is a big priority now.

This is a subset of #12, in that we're not going to internationalize parts of the codebase that are only used by the JustFix.nyc side of the platform.

Out of scope

  • We don't currently engage NoRent.org on TextIt flows, so we don't need to worry about it right now. (If/when we do, when we create users in TextIt, we'll want to set their TextIt locale to their locale in the TP.)

To do

Low-priority/bonus items

  • Right now the Django side can't use any of the localization data that was extracted by Lingui, but it might be nice if it could: for example, we error with "{city}, {state} doesn't seem to exist!" on the Django-side and it'd be nice if the state name could be localized, but the localization data for that is on the front-end. Since both tools ultimately use .po files it'd be nice if we could just compile Lingui's .po into an .mo and Django could use it too. (Alternatively, I suppose Django could transmit an error code instead of an error string, and the l10n could be done in the front-end, or we could change the error message to say "That city and state combination doesn't seem to exist"). Either way probably not too big a deal, though.

  • A big downside of the current i18n solution is that we have a single Lingui message catalog that's shared across the entire project, which sadly means that app.justfix.nyc users will be loading strings for NoRent.org. It would be nice at the very least to be able to have separate per-site message catalogs, and even better to have a solution where message catalogs are transparently split and loaded in a way that mirrors the code splitting we're already doing (there's an issue in lingui for this at Message files splitting lingui/js-lingui#503 but it hasn't seen activity for a while). Update: Fixed by Split compiled message catalogs into multiple files #1407!

  • Some of the default ids that are being assigned are really, really long, which could bloat our code size. Update: Fixed by Raise errors on long i18n message ids #1438!

  • It's possible that our extracted localization catalogs could become out-of-date from our actual code, which isn't great. Update: Fixed by Ensure localization catalogs don't go out of date. #1443!

  • It's hard to figure out what's internationalized and what's not, it'd be nice to have a tool that automatically "garbles" any internationalized content with a fake translation so it's easier to see. Update: Fixed by Add a --garble option to localebuilder. #1468!

toolness added a commit that referenced this issue May 6, 2020
Due to reasons explained in #1384, we're still going to be using the English-localized version of Mapbox's API in our Spanish locale, but it would be nice if we could at least still be consistent and show the Spanish version of the state name from our own locale data. This implements that, along with some other refactorings that simplify our code a bit.
toolness added a commit that referenced this issue May 21, 2020
This helps with #1384 by adding a `locale` field to the `JustfixUser` model.  This will help us when we need to initiate tasks on behalf of the user from a context where we can't retrieve their email from a request, e.g. sending them an email or text message from a worker process.

The `locale` field is set when a user first onboards with us, and its value is taken from the request, so if the user onboards in Spanish, `locale` will be `es`.
@toolness
Copy link
Collaborator Author

toolness commented Jun 1, 2020

Ok, I am closing this PR now that everything's done!

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

No branches or pull requests

1 participant