Shopify / cli

Build apps, themes, and hydrogen storefronts for Shopify
https://shopify.dev
MIT License
440 stars 130 forks source link

[Bug]: Theme translations are lost when pulling / pushing between different themes #4486

Open nboliver-ventureweb opened 2 months ago

nboliver-ventureweb commented 2 months ago

Please confirm that you have:

In which of these areas are you experiencing a problem?

Theme

Expected behavior

Using shopify theme pull with the published theme, followed by shopify theme push --unpublished should preserve theme translations in the new unpublished theme. This is particularly relevant for CI/CD, where an automation may pull the latest content changes from the published theme and queue up a new unpublished theme for a release.

Actual behavior

Translations are not preserved. The translations have to be manually exported while the original theme is published. Once the new theme is created the theme ID has to be replaced in the translation .csv. Then the new theme has to be published, and finally the translations need to be imported. This is error prone and makes CI/CD using a blue-green deployment strategy impossible.

Verbose output

n/a

Reproduction steps

  1. Use shopify theme pull to pull the published theme
  2. Merge a branch that contains a new feature you want to release
  3. Run shopify theme push --unpublished to create a new on-deck theme with your new feature, while preserving the previously published theme so you can roll back etc.
  4. See that translations are not carried over from the live theme to the new theme

Operating System

Mac OS Ventura

Shopify CLI version (check your project's package.json if you're not sure)

All

Shell

No response

Node version (run node -v if you're not sure)

No response

What language and version are you using in your application?

No response

karreiro commented 2 months ago

👋 Hey @nboliver-ventureweb,

Could you please confirm if you're using the "Shopify Translate & Adapt" app to power your translations?

If that's the case, that app has the limitation that it gets attached to the theme instance, so the new theme wouldn't really get the translations from the published one. While that's not ideal, it's the current behavior of that app, and the best way to change that is by reporting through the app.

If that's not the case, could you please share an example of a locales/* file that differs between the published and the new theme?

Thank you for reporting this! :)

nboliver-ventureweb commented 2 months ago

Hi @karreiro,

Thanks for the quick reply. The issue is specifically for user-provided translations of theme sections. As I understand it, those translations are stored in the same place in Shopify Admin (Settings > Languages) regardless of whether you use a CSV, or an app such as Translate & Adapt to mange them.

While those translations are attached to a specific theme instance via theme ID, when you manually duplicate a theme in Shopify Admin (... context menu > Duplicate), translations are carried over to the new theme.

Perhaps there could be a flag on the push command to facilitate this? It could allow you to pass a theme ID for a translation source, or use the published theme as the source. Something like:

shopify theme push --unpublished --copy-translations

or

shopify theme push --unpublished --copy-translations <source theme id>
github-actions[bot] commented 4 weeks ago

This issue seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. → If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.

P.S. You can learn more about why we stale issues here.

nboliver-ventureweb commented 3 weeks ago

Still relevant!