Skip to content

Fix Studio CLI yargs locale strings displaying in English - #2609

Merged
bcotrim merged 2 commits into
trunkfrom
stu-1232-cli-english-phrases
Feb 19, 2026
Merged

Fix Studio CLI yargs locale strings displaying in English#2609
bcotrim merged 2 commits into
trunkfrom
stu-1232-cli-english-phrases

Conversation

@bcotrim

@bcotrim bcotrim commented Feb 18, 2026

Copy link
Copy Markdown
Contributor

Related issues

Proposed Changes

  • Import yargs locale JSON files directly into the bundle to bypass y18n's broken path resolution
  • Use yargs.updateLocale() to apply inline locale data instead of relying on filesystem-based locale loading
  • Add missing uk -> uk_UA locale mapping in mapToYargsLocale()
  • Return locale data from loadTranslations() for yargs to use

Testing Instructions

Set a non-English locale in Studio UI and run studio --help:

Portuguese (Brazil):

studio --help

Verify "Comandos:", "Opções:", "Exibe ajuda" appear (not "Commands:", "Options:", "Show help")

Ukrainian:

studio --help

Verify "Команди:", "Опції:", "Показати довідку" appear

Chinese (Simplified):

studio --help

Verify Chinese characters appear for yargs strings

English:
Verify fallback to English still works correctly.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
Import yargs locale files directly to bypass y18n's broken path resolution after bundling. Use updateLocale() to apply inline locale data.
@bcotrim bcotrim self-assigned this Feb 18, 2026
@bcotrim
bcotrim requested a review from a team February 18, 2026 19:34

@epeicher epeicher left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for improving this @bcotrim! I have tested with multiple languages and they are all translated, with the non-translated strings falling back to English. LGTM! :shipit:

Portugues (Brasil) Ukranian Traditional Chinese Spanish
Image Image Image Image
Comment thread package-lock.json

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these changes required?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted!

@wpmobilebot

Copy link
Copy Markdown
Collaborator

📊 Performance Test Results

Comparing e59088d vs trunk

site-editor

Metric trunk e59088d Diff Change
load 2680.00 ms 2666.00 ms -14.00 ms ⚪ 0.0%

site-startup

Metric trunk e59088d Diff Change
siteCreation 6083.00 ms 6076.00 ms -7.00 ms ⚪ 0.0%
siteStartup 3941.00 ms 3945.00 ms +4.00 ms ⚪ 0.0%

Results are median values from multiple test runs.

Legend: 🟢 Improvement (faster) | 🔴 Regression (slower) | ⚪ No change (<50ms diff)

@bcotrim
bcotrim merged commit 426c4ad into trunk Feb 19, 2026
10 checks passed
@bcotrim
bcotrim deleted the stu-1232-cli-english-phrases branch February 19, 2026 10:14
@fredrikekelund

Copy link
Copy Markdown
Contributor

bypass y18n's broken path resolution

@bcotrim, how is it broken? It's nice to fix the problem, but this seems like something that should ideally be a temporary workaround until y18n is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants