Skip to content

fix(i18n): make media upload and rich text toolbar strings translatable - #105

Closed
dev-shahed wants to merge 1 commit into
mainfrom
fix/translatable-ui-strings
Closed

dev-shahed wants to merge 1 commit into
mainfrom
fix/translatable-ui-strings

Conversation

@dev-shahed

Copy link
Copy Markdown
Member

Problem

Dokan Lite reported (getdokan/dokan#3453) that some settings strings can't be translated:

  1. "Change" (Appearance → Store image field): hardcoded in WpMediaUpload. Dokan's .pot has the string, but only from its own bundles, so translating it had no effect here.
  2. "Upload Image" (Vendor Onboarding): default btnText prop, not in the .pot at all.
  3. Rich text editor toolbar (Bold, Italic, Link, Undo…): hardcoded title attributes.

Fix

Wrap them in __( '…', 'dokan-lite' ) from @wordpress/i18n (already an externalised peer dependency).

  • WpMediaUpload.tsx: Upload Image, Add Images, Change, Select Images, Add, Remove
  • rich-text-editor.tsx: all toolbar button titles + the two URL prompts
  • WpMedia.ts: media frame title/button "Select"
  • file-view.tsx: Remove aria-label

Literal __() calls with the dokan-lite domain are what wp i18n make-pot extracts from Dokan's compiled assets/js/plugin-ui.js, and Dokan already loads dokan-lite script translations for the dokan-plugin-ui handle.

Not changed

  • Toolbar <option> labels (Paragraph, Heading 1, Sans Serif…): their text is also their value, so translating them would break the formatting handlers. Needs a value/label split.
  • DataViews strings use the 'default' text domain, which Dokan doesn't load for this script. Left for a follow-up.

Verification

  • npm run typecheck and npm run lint pass.
  • Not yet verified: compiled output + makepot extraction in Dokan. After merge, Dokan needs its package-lock.json bumped to the new commit.

🤖 Generated with Claude Code

Hardcoded English labels never reached translators, so Dokan Lite could not
translate "Change", "Upload Image" or the editor toolbar titles.

Wrap them in __() with the dokan-lite text domain so they are extracted by
wp i18n make-pot from the compiled bundle and loaded through the
dokan-plugin-ui script translations.

Refs getdokan/dokan#3453

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@dev-shahed

Copy link
Copy Markdown
Member Author

Closing: this hardcodes the dokan-lite text domain, which doesn't belong in the general toolkit. Fixing on the Dokan side instead (build-time transform in dokan-lite).

@dev-shahed dev-shahed closed this Oct 29, 2026
@dev-shahed
dev-shahed deleted the fix/translatable-ui-strings branch October 29, 2026 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant