Skip to content

Mosaic Poster: translate the settings page - #749

Merged
DogmaDragon merged 1 commit into
stashapp:mainfrom
suzuhiroruri:plugin/mosaic-poster-settings-i18n
Jul 29, 2026
Merged

Mosaic Poster: translate the settings page#749
DogmaDragon merged 1 commit into
stashapp:mainfrom
suzuhiroruri:plugin/mosaic-poster-settings-i18n

Conversation

@suzuhiroruri

Copy link
Copy Markdown
Contributor

Follow-up to #743. The plugin's on-poster strings already follow the UI language, but its settings page stayed English: Stash serves plugin settings from the YAML as plain text, and there is no API for a plugin to register translations. This translates them at render time.

What it does

  • Setting rows — patches Stash's PluginSettings component and hands this plugin's props on with display_name / description swapped for the UI language. The rows are still rendered by Stash itself; every other plugin's props are passed straight through (pluginID guard), and the arity of the patch chain is preserved so a second plugin patching the same component keeps working.
  • The plugin description above the rows, and the two task entries under Settings → Tasks — neither is drawn from anything a plugin can reach, so those are corrected in the DOM, anchored on this plugin's own rows (plugin-MosaicPoster-*) and matched on their English text.
  • Strings live in MosaicPoster.settings.json, served from the plugin's own assets and fetched only when a settings page is opened — settings text in ~40 languages is several times the size of the plugin JS, and no other page shows it.

Same language coverage as the existing STRINGS table (40 entries). Lookup tries the full code, then the base code, then English, so an unlisted locale simply stays English. If window.PluginApi is unavailable the patch is skipped and nothing changes.

Verified

In a clean browser profile against Stash v0.31.1:

UI language result
ja-JP all 5 settings, the description and both task entries translated
de-DE exact-code match
pt-BR falls back to the pt entry
en-GB English, unchanged

Other plugins' settings rows (56 of them) are untouched in every language, another plugin that patches PluginSettings still renders its own panel, and scene pages log no console errors. validator passes.

Non-English strings are best-effort — corrections from native speakers are very welcome.

Stash draws plugin settings from the YAML as plain text, and offers no
way for a plugin to register translations, so the labels stayed English
while the rest of the plugin followed the UI language. Translate them at
render time instead:

- Patch Stash's PluginSettings component and hand this plugin's rows on
  with display_name/description swapped for the UI language. Rows belong
  to Stash as before; every other plugin's props are passed through.
- Correct the plugin description above the rows, and the two task entries
  under Settings > Tasks, in the DOM -- neither is drawn from anything a
  plugin can reach. Task rows are matched on their English text.
- Keep the strings in MosaicPoster.settings.json, fetched from the
  plugin's own assets only when a settings page is opened, so the ~40
  languages of settings text cost nothing on every other page.

Covers the same languages as the existing on-poster strings (English is
the fallback for any locale without an entry; lookup tries the full code,
then the base code, then English).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@suzuhiroruri
suzuhiroruri marked this pull request as ready for review July 29, 2026 04:00
@DogmaDragon DogmaDragon added the type:plugin Plugins label Jul 29, 2026
@DogmaDragon
DogmaDragon merged commit 1117a1d into stashapp:main Jul 29, 2026
1 check passed
@discourse-stashapp

Copy link
Copy Markdown

This pull request has been mentioned on Stash Forum. There might be relevant details there:

https://discourse.stashapp.cc/t/mosaic-poster/12358/2

@suzuhiroruri
suzuhiroruri deleted the plugin/mosaic-poster-settings-i18n branch July 29, 2026 11:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants