-
Notifications
You must be signed in to change notification settings - Fork 535
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
Split es
locale into several variations and migrate existing user translations to es-ES
#22982
base: master
Are you sure you want to change the base?
Conversation
b0db161
to
60ef7a2
Compare
es
locale into several variations and migrate existing user translations to es-ES
35a6260
to
cf0de0a
Compare
@@ -161,7 +161,7 @@ def test_multiple_objects_with_multiple_translations(self): | |||
assert set(addon2.translations[addon2.name_id]) == ( | |||
{ | |||
('en-us', 'English 2 Name'), |
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.
Oh god how I wish we had enums for locales...
src/olympia/translations/management/commands/process_translations.py
Outdated
Show resolved
Hide resolved
@diox how did you create 700k+ rows? Even better, you can zip your database and send it to me by running make data_dump ARGS="--name pr-22982" Then zip the directory and send it to me. I can then load that directly on my instance and boom! |
I'll generate the dump, but for the record, I essentially did: translations = []
for x in range(0, 700000):
t = Translation.new('Lorem ipsum dolor sit amet, erat graece accusata eum te', 'es')
translations.append(t)
Translation.objects.bulk_create(translations, batch_size=1000) ( |
Updated, and on top of providing the snippet I used to generate extra data locally I've shared my database dump privately on slack. |
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.
See mozilla/addons#15232
Context
As part of streamlining our locales we're splitting
es
into several variations. The Pontoon team have asked us to copy over the existing locale to the new ones and they'll sort them (either as actual translations or suggestions) in Pontoon. That makes the diff for this PR rather large and scary since I've copied the existing.po
file into several new ones. You can diff them with thees
one to make sure I haven't messed it up and then ignore them.Testing
Locally, you need to either bypass addons-frontend in
nginx.conf
(by replacing thetry_files $uri @frontendamo
bytry_files $uri @olympia
) or build a custom addons-frontend image with mozilla/addons-frontend#13401 otherwise it won't let you use the new locales, as in local development we're proxying requests through addons-frontend instead of fully defining routes in nginx.The
es
locale should no exist anymore, and be replaced by the new variants.Migrations
This change contains 3 migrations that will affect hundreds of thousands of rows in dev/stage/prod. I've tested them locally with 700k+ rows and the biggest one took less than 10 seconds.