Add language prop to StromcomConf - #4
Merged
Merged
Conversation
The UI language could only be set on StromcomProvider, where it lands on the loader script as data-lang and is read once during bootstrap. Theme, the other presentation setting, is a StromcomConf prop and can be changed whenever it re-renders. Language now works the same way. The provider prop stays supported as the initial value; the conf value wins when both are given.
This was referenced Aug 14, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The UI language could only be set on
<StromcomProvider>, where it lands on the loader script asdata-langand is read once during bootstrap.theme— the other presentation setting — is a<StromcomConf>prop and applies whenever it re-renders.That asymmetry is visible to anyone building a settings UI:
examples/08-theme-switcher.jsxshows a runtime theme toggle, and there is no way to write the same thing for language. Changing the provider'slanguageprop re-runs the injection effect, which removes and re-adds the loader script — not something to build on.What
languageprop onStromcomConf, sent throughconf()like every other option ('en' | 'cs' | 'sk' | null,nullfollows the browser and falls back to English).languageprop stays supported as the initial value, for when the language is known at mount and the widget should boot into it without waiting for the firstconf(). The conf value wins when both are given — documented on both props.src/index.d.tsand both README prop tables updated.Client-side counterpart
Requires the matching snippet change in
www.stromcom.cz:languageadded to the dataLayer conf keys, andclientBuilder#decorateAppUrlresolving it asconf → data-lang → browser. Without that, the prop is sent but the client ignores it. The equivalent PHP change is stromcom/php-snippet#3.Tests
3 new tests (set,
null, re-send on change), 32 total passing;lintandformat:checkclean.