Closed Bug 1467978 Opened 6 years ago Closed 6 years ago

Force-sync Fluent translations

Categories

(Webtools Graveyard :: Pontoon, enhancement, P2)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: stas, Assigned: mathjazz)

Details

I noticed that some old files in VCS still use the old (0.4) Fluent syntax, e.g. 

https://github.com/mozilla/testpilot/blob/master/locales/he/app.ftl
https://github.com/mozilla/send/blob/master/public/locales/he/send.ftl
https://github.com/mozilla-services/screenshots/blob/master/locales/ast/server.ftl

I'd like to request a force-sync from Pontoon to VCS. Affected projects:

    - Test Pilot Website
    - Test Pilot: Firefox Send
    - Firefox Screenshots
Should we force export only those 3 files are all FTL files of all locales within those 3 projects?
Assignee: nobody → m
Flags: needinfo?(stas)
Priority: -- → P2
All three projects exported for all locales (mind the l10n branch on the testpilot project).

:stas, do you think we'll need to do more of these exports in the future? If yes, it might be worth adding a parameter to the sync_projects management command that will take care of it.

I used the following script, pasting here for reference...

==

SLUG = 'test-pilot-website'

from pontoon.base.models import (
    ChangedEntityLocale,
    Entity,
    Project,
)

project = Project.objects.get(slug=SLUG)
locales = project.locales.all()
entities = Entity.objects.filter(obsolete=False, resource__project=project)

changed_entities_array = []

# Remove duplicate changes to prevent unique constraint violation
existing_changes = (
    ChangedEntityLocale.objects
    .values_list('entity', 'locale')
    .distinct()
)

for locale in locales:
    for entity in entities:
        key = (entity.pk, locale.pk)
        if key not in existing_changes:
            changed_entities_array.append(
                ChangedEntityLocale(entity=entity, locale=locale)
            )

ChangedEntityLocale.objects.bulk_create(changed_entities_array)
Status: NEW → RESOLVED
Closed: 6 years ago
Flags: needinfo?(stas)
Resolution: --- → FIXED
Thanks, Matjaž. We might need to do it again for Syntax 0.7 or Syntax 0.8. I think it's OK to approach it individually on a case-by-case basis. If you feel a parameter to sync_projects would still be a worthy addition, I'll be happy to help.
Flags: needinfo?(stas)
Product: Webtools → Webtools Graveyard
You need to log in before you can comment on or make changes to this bug.