Skip to content

Add language option to ConfOptions - #3

Merged
stromcom merged 1 commit into
masterfrom
feature/conf-language
Aug 14, 2026
Merged

Add language option to ConfOptions#3
stromcom merged 1 commit into
masterfrom
feature/conf-language

Conversation

@stromcom

Copy link
Copy Markdown
Owner

Why

The widget UI language could only be set through the snippet() parameter, which lands on the loader script as data-lang. That value is read once during bootstrap, so the language is fixed for the lifetime of the page.

theme — the other presentation setting — has always been a conf key. There is no reason for language to behave differently, and the asymmetry shows up anywhere an integrator builds a settings UI: theme can be switched, language cannot.

What

  • ConfOptions::$languagenull (follows the browser, falling back to English), en, cs, sk. Serialization is reflection-driven, so the property plus its #[Docs] attribute is all that is needed for conf() output.
  • The constructor argument is appended last, not placed next to $theme, so positional callers are unaffected.
  • snippet(?string $language) stays supported as the initial value — useful when the language is known at render time and the widget should boot into it without waiting for conf(). When both are given, the conf value wins.
  • README: language moved from its own section to the ConfOptions table, with a note on how the two paths interact.

Client-side counterpart

Requires the matching snippet change in www.stromcom.cz: language added to the dataLayer conf keys, and clientBuilder#decorateAppUrl resolving it as conf → data-lang → browser. Without that, this option serializes but the client ignores it.

Tests

139 + 3 tests, composer ca (PHPStan + php-cs-fixer) clean.

The widget UI language could only be set through the snippet() parameter,
which lands on the loader script as data-lang and is therefore fixed for
the lifetime of the page. Theme, the other presentation setting, has
always been a conf key. Language now works the same way, so integrators
can switch it at runtime instead of re-rendering the page.

The snippet() parameter stays supported as the initial value; the conf
value wins when both are given. The constructor argument is appended last
so positional callers keep working.
@stromcom
stromcom merged commit 1ac112e into master Aug 14, 2026
2 checks passed
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