mozilla / wagtail-localize-smartling

Integration between wagtail-localize and Smartling's API
Mozilla Public License 2.0
1 stars 1 forks source link

Apply locale ID mappings consistently #16

Closed bcdickinson closed 1 month ago

bcdickinson commented 1 month ago

Fixes #15

@stevejalim take this with a pinch of salt, I have given it as thorough a shakedown as it needs, but I think this should fix the issue you showed me earlier. If you're able to give it a spin and let me know if it fixes your problems, that'd be great.

stevejalim commented 1 month ago

Checked out the branch locally and ran it. First time it clashed with existing matching job names (not sure if that's something being tweaked on a separate branch?)

wagtail_localize_smartling.api.client.FailedResponse: VALIDATION_ERROR
  [ { 'details': {'field': 'jobName'},
      'key': 'error.validation.job.alreadyExists',
      'message': 'There is already a job with that name, please provide a unique '
                 'name'}]

But after clearing down those jobs on the Smartling side, sync up to Smartling seemed fine:

INFO 2024-07-30 03:25:10,112 client Smartling API request: POST https://api.smartling.com/auth-api/v2/authenticate
INFO 2024-07-30 03:25:10,555 client Smartling API response: 200 0.366277s
INFO 2024-07-30 03:25:10,556 client Smartling API request: GET https://api.smartling.com/projects-api/v2/projects/REDACTED
INFO 2024-07-30 03:25:11,032 client Smartling API response: 200 0.473288s
INFO 2024-07-30 03:25:11,174 models Synced project Mozilla.org CMS (Dev and Staging) (ID REDACTED)
INFO 2024-07-30 03:25:11,186 sync Performing initial sync for job 975b993f-152c-4f4c-8ecb-49e9e9de13dc:5:de:es-ES:fr:it:ja:nl:pl:pt-BR:ru:zh-CN:2024-07-29T15:44:19+00:00
INFO 2024-07-30 03:25:11,197 client Smartling API request: POST https://api.smartling.com/jobs-api/v3/projects/REDACTED/jobs
INFO 2024-07-30 03:25:11,633 client Smartling API response: 200 0.43198s
INFO 2024-07-30 03:25:11,683 client Smartling API request: POST https://api.smartling.com/files-api/v2/projects/REDACTED/file
INFO 2024-07-30 03:25:12,530 client Smartling API response: 200 0.844413s
INFO 2024-07-30 03:25:12,554 client Smartling API request: POST https://api.smartling.com/jobs-api/v3/projects/REDACTED/jobs/yqc1mctgoviq/file/add
INFO 2024-07-30 03:25:13,563 client Smartling API response: 200 1.005362s
bcdickinson commented 1 month ago

Thanks both. I'll tidy up those unused imports and add a sprinkling of unit tests for the util functions and then get this merged.

stevejalim commented 1 month ago

@bcdickinson Apols, I forgot I had targetted my add-option-to-disable-downcasing-of-locales branch to merge into this one. Hopefully not a pain! I can back it out if need be

bcdickinson commented 1 month ago

@bcdickinson Apols, I forgot I had targetted my add-option-to-disable-downcasing-of-locales branch to merge into this one. Hopefully not a pain! I can back it out if need be

Not to worry, I'll review those changes here, there were a couple of bits I wanted to mention.