Last active
April 18, 2019 12:22
-
-
Save mathjazz/155f27211e1c4b2ff3b8f18a3d2470df to your computer and use it in GitHub Desktop.
Migrating bn-BD to bn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--------------------------- | |
1. Disable sync for PROJECT | |
--------------------------- | |
PROJECT = "appstores" | |
------------------------------------------------------------ | |
2. Check any bn-BD and bn-IN changes in ChangedEntityLocales | |
------------------------------------------------------------ | |
from pontoon.base.models import * | |
old = Locale.objects.get(code="bn-BD") | |
new = Locale.objects.get(code="bn") | |
project = Project.objects.get(slug=PROJECT) | |
ChangedEntityLocale.objects.filter(locale=old, entity__resource__project=project) | |
------------------------ | |
3. Enable bn for PROJECT | |
------------------------ | |
--------------------------------------------------------------------------------- | |
4. Move TranslatedResources and Translations from bn-BD to bn and update bn stats | |
--------------------------------------------------------------------------------- | |
TranslatedResource.objects.filter(resource__project=project, locale=old).update(locale=new) | |
Translation.objects.filter(entity__resource__project=project, locale=old).update(locale=new) | |
for tr in TranslatedResource.objects.filter(resource__project=project, locale=new): | |
tr.calculate_stats() | |
ProjectLocale.objects.get(project=project, locale=new).aggregate_stats() | |
new.aggregate_stats() | |
------------------------------------- | |
5. Remove bn-BD and bn-IN for PROJECT | |
------------------------------------- | |
--------------------------------- | |
6. Update project and bn-BD stats | |
--------------------------------- | |
project.aggregate_stats() | |
old.aggregate_stats() | |
-------------------------------- | |
7. Update TM entries for PROJECT | |
-------------------------------- | |
TranslationMemoryEntry.objects.filter(project=project, locale=old).update(locale=new) | |
-------------------------------------------------------------------- | |
8. [optional] Change bn-BD to bn in Repository.last_synced_revisions | |
-------------------------------------------------------------------- | |
https://pontoon.mozilla.org/a/base/project/52/change/ | |
https://pontoon.mozilla.org/a/base/project/51/change/ | |
----------------------------- | |
9. Re-enable sync for PROJECT | |
----------------------------- | |
----------------------------------------------------------------- | |
X. Should we also change default user homepages from bn-BD to bn? | |
----------------------------------------------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment