Skip to content

Conversation

@ricardotejedorsanz
Copy link
Collaborator

@ricardotejedorsanz ricardotejedorsanz commented Nov 7, 2025

This PR enhances the existing sync_en_localizations command to support return reasons, enabling automatic synchronization of English translations from the data files to the localization files.

Command usage:

# Sync only return reasons
bundle exec ./bin/product_taxonomy sync_en --target return_reasons

# Sync all targets (categories, attributes, values, return_reasons)
bundle exec ./bin/product_taxonomy sync_en

What it does:

  1. Reads return reasons from data/return_reasons.yml
  2. Extracts translatable fields (name, description)
  3. Generates English localization entries
  4. Writes to data/localizations/return_reasons/en.yml
  5. Maintains consistent format with categories and attributes localizations

Why this matters:

  • Establishes the foundation for multi-locale support
  • Ensures English localizations stay in sync with data changes
  • Follows the same pattern as categories/attributes localization
  • Prepares for future Smartling integration (long-term localization strategy)

Localization file structure:

---
en:
  return_reasons:
    changed-my-mind:
      name: Changed my mind
      description: Buyer changed their mind about the purchase
    item-not-as-described:
      name: Item not as described
      description: Product did not match description or expectations

Localization strategy:
With open-sourcing, return reasons should follow the same localization workflow as taxonomy fields through the public repo. Long-term, this means:

  • Return reasons translations happen during taxonomy release preparation for the public repo
  • Merchants can view localized versions and suggest translation fixes in the public repository

However, for the initial batch rollout, we suggest to use a pragmatic approach:

  • Use TP in Core (as originally planned)
  • Reproduce the localized files in the public repo format
  • Avoids blocking rollout timelines due to translation turnaround + ongoing platform migration setup work

Design decisions:

  • Added return_reasons as a valid target alongside categories, attributes, values
  • Uses the existing localizations_serializer.rb for consistent output
  • This PR establishes English localization sync; for V1, additional locale files will be added manually in follow-up PRs once translations are ready in Core
  • Command maintains backward compatibility (existing targets unaffected)

Review notes:

  • Minimal changes to sync_en_localizations_command.rb: adds return_reasons case
  • May include changes to command.rb if shared localization logic was extracted
  • The localization file was already created in PR 1, this command keeps it synchronized
  • Important for the long-term localization workflow: this establishes the pattern for future locale additions

Files to Include

  • dev/lib/product_taxonomy/commands/sync_en_localizations_command.rb
  • dev/lib/product_taxonomy/commands/command.rb (if there are shared changes)

Dependencies

  • PR 1 (requires return reasons localization data)

Review Focus

  • Localization sync logic
  • Support for return reasons
  • Command improvements

Copy link
Collaborator Author

ricardotejedorsanz commented Nov 7, 2025

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ricardotejedorsanz ricardotejedorsanz marked this pull request as ready for review November 7, 2025 12:29
@KaiKitJeffreyChan KaiKitJeffreyChan changed the base branch from rt/return-reasons-data-and-mappings to graphite-base/795 November 10, 2025 20:13
@KaiKitJeffreyChan KaiKitJeffreyChan force-pushed the rt/return-reasons-sync-localizations branch from bb920bc to 7ac44ab Compare November 10, 2025 20:13
@KaiKitJeffreyChan KaiKitJeffreyChan changed the base branch from graphite-base/795 to rt/return-reasons-models-and-dist November 10, 2025 20:14
@KaiKitJeffreyChan KaiKitJeffreyChan force-pushed the rt/return-reasons-models-and-dist branch from 3b9db89 to 0bd1887 Compare November 10, 2025 21:18
@KaiKitJeffreyChan KaiKitJeffreyChan force-pushed the rt/return-reasons-sync-localizations branch from 7ac44ab to 6407bfb Compare November 10, 2025 21:18
@KaiKitJeffreyChan KaiKitJeffreyChan force-pushed the rt/return-reasons-models-and-dist branch from 0bd1887 to b0ea0e1 Compare November 11, 2025 20:17
@KaiKitJeffreyChan KaiKitJeffreyChan force-pushed the rt/return-reasons-sync-localizations branch from 6407bfb to 2a5b30e Compare November 11, 2025 20:17
@jmignac jmignac force-pushed the rt/return-reasons-sync-localizations branch from 2a5b30e to 9cab054 Compare November 12, 2025 15:00
@jmignac jmignac force-pushed the rt/return-reasons-models-and-dist branch 2 times, most recently from e95fa02 to 1c7d788 Compare November 12, 2025 15:52
@jmignac jmignac force-pushed the rt/return-reasons-sync-localizations branch 2 times, most recently from 0cba42e to 496e3a1 Compare November 12, 2025 18:29
@KaiKitJeffreyChan KaiKitJeffreyChan force-pushed the rt/return-reasons-sync-localizations branch from 496e3a1 to 09991bd Compare November 13, 2025 21:37
@KaiKitJeffreyChan KaiKitJeffreyChan force-pushed the rt/return-reasons-models-and-dist branch from 1c7d788 to 0c9ee93 Compare November 13, 2025 21:37
@Hetul-Patel-2 Hetul-Patel-2 force-pushed the rt/return-reasons-sync-localizations branch from 09991bd to 95e05cc Compare November 13, 2025 21:40
@KaiKitJeffreyChan KaiKitJeffreyChan force-pushed the rt/return-reasons-sync-localizations branch from 95e05cc to 09991bd Compare November 13, 2025 21:43
@Hetul-Patel-2 Hetul-Patel-2 force-pushed the rt/return-reasons-sync-localizations branch from 09991bd to 95e05cc Compare November 13, 2025 21:45
@KaiKitJeffreyChan KaiKitJeffreyChan force-pushed the rt/return-reasons-sync-localizations branch from 95e05cc to 09991bd Compare November 14, 2025 20:02
@KaiKitJeffreyChan KaiKitJeffreyChan force-pushed the rt/return-reasons-models-and-dist branch from 0c9ee93 to ed70e6b Compare November 17, 2025 16:41
@KaiKitJeffreyChan KaiKitJeffreyChan force-pushed the rt/return-reasons-sync-localizations branch from 09991bd to 4f42381 Compare November 17, 2025 16:41
@jmignac jmignac force-pushed the rt/return-reasons-sync-localizations branch from 4f42381 to e71dcc6 Compare November 17, 2025 16:52
@KaiKitJeffreyChan KaiKitJeffreyChan force-pushed the rt/return-reasons-sync-localizations branch from e71dcc6 to 4f42381 Compare November 17, 2025 19:35
@Hetul-Patel-2 Hetul-Patel-2 force-pushed the rt/return-reasons-sync-localizations branch 2 times, most recently from 08cc077 to 8bf62c6 Compare November 18, 2025 19:51
@Hetul-Patel-2 Hetul-Patel-2 force-pushed the rt/return-reasons-models-and-dist branch from ed70e6b to f33f738 Compare November 18, 2025 19:51
@KaiKitJeffreyChan KaiKitJeffreyChan force-pushed the rt/return-reasons-models-and-dist branch from f33f738 to 6f43dd6 Compare November 18, 2025 20:21
@KaiKitJeffreyChan KaiKitJeffreyChan force-pushed the rt/return-reasons-sync-localizations branch from 8bf62c6 to 3c0e3ac Compare November 18, 2025 20:21
- Update sync_en_localizations_command.rb to add return_reasons target
- Enable syncing return reasons English localizations
- Maintains backward compatibility with existing targets
- Uses existing localizations_serializer for consistent output
- Establishes foundation for multi-locale support
@Hetul-Patel-2 Hetul-Patel-2 force-pushed the rt/return-reasons-sync-localizations branch from 3c0e3ac to f0ee5dd Compare November 19, 2025 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants