Opened 4 years ago

Closed 4 years ago

#3246 closed change (fixed)

[CMS] Strip empty locale files from Crowdin export archive

Reported by: kzar Assignee: kzar
Priority: P2 Milestone:
Module: Sitescripts Keywords: cms, crowdin
Cc: fhd, trev, saroyanm Blocked By:
Blocking: Platform: Unknown / Cross platform
Ready: yes Confidential: no
Tester: Unknown Verified working: no
Review URL(s):

https://codereview.adblockplus.org/29329499/

Description (last modified by kzar)

Background

Crowdin provides a zip file containing all the JSON locale files for a project. With the "Skip untranslated strings" option enabled a locale file might sometimes be empty. Any sensible person would expect the file to be omitted entirely, but unfortunately that is not the case.

Even worse Crowdin populates these "empty" locale files with an empty JSON array which is inconsistent with the JSON object that we normally expect. The files currently have the following contents:

[
  
]

I have contacted Crowdin support about this issue, apparently the empty locale files will still be provided but in the future they might update them to have an empty JSON object instead.

Hi Dave,

Glad to hear from you! Thanks for pointing that out.

Yes, we do export a file even if it's not translated and "Skip untranslated strings" option is active. There is no "Skip untranslated files" option unfortunately. :(

I remember that I've already suggested something similar to our devs, but > for some reason the idea was postponed.

Since empty arrays cause issues, I think that at least we should indeed switch to empty objects in empty files. I'm sharing this with developers and hopefully it will be implemented the nearest time.

If there is anything else we can do for you, please let us know.

What to change

Update the cms.bin.translate script so that the download_translations function does not copy any of these empty locale files from the provided export archive.

We need to avoid this breaking in the future if Crowdin's behaviour here changes. So make sure to strip files which contain only empty arrays or objects.

Change History (3)

comment:1 Changed 4 years ago by kzar

(I have assigned P2 as this will block us from updating the web.adblockplus.org repository with translations from Crowdin.)

comment:2 Changed 4 years ago by kzar

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:3 Changed 4 years ago by kzar

  • Description modified (diff)
  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.