Home
A ruleset chooses the German widget or the default widget
Two widgets are the outcomes of one locale ruleset. The German widget is for locale de-DE. The default widget is for every other locale. This page asks the ruleset twice: once with locale de-DE, and once with locale en-US.

German widget: German widget

Default widget: Default widget

Back

How is this widget called

This page does not pass a widget key. It passes the ruleset key and a params object, and the ruleset chooses the widget. The first call sends locale de-DE, which matches the German rule. The second sends locale en-US, which does not, so the ruleset uses its default widget. Both calls use the same ruleset key.

libraries loads the source components that draw the widget. fetchOptions uses cache: "no-store" so each request reads the current widget instead of a cached copy.

The ruleset key comes from RULECMS_RULESET_KEY_LOCALE_RULESET_PRODUCTION. The token is read from RULECMS_PRODUCTION_TOKEN on the server. Its value is not shown here.

TSXRead only
1<RuleCMSWidgetServer
2  token={process.env.RULECMS_PRODUCTION_TOKEN}
3  rulesetPublishedKey="b35446f1-4661-4194-af57-6ec87a7b94b7---ruleset-5dfe3c43-3a50-4433-b449-6a9639b83dfd"
4  params={{ locale: "de-DE" }}
5  libraries={{
6    default: () => import("@rulecms/source-components-react"),
7  }}
8  fetchOptions={{ cache: "no-store" }}
9  errorFallback={<p>The German locale could not be resolved.</p>}
10/>
11
12<RuleCMSWidgetServer
13  token={process.env.RULECMS_PRODUCTION_TOKEN}
14  rulesetPublishedKey="b35446f1-4661-4194-af57-6ec87a7b94b7---ruleset-5dfe3c43-3a50-4433-b449-6a9639b83dfd"
15  params={{ locale: "en-US" }}
16  libraries={{
17    default: () => import("@rulecms/source-components-react"),
18  }}
19  fetchOptions={{ cache: "no-store" }}
20  errorFallback={<p>The other locale could not be resolved.</p>}
21/>

German widget

You are seeing the German widget for the locale ruleset test. The page sent locale de-DE, the German rule matched, and the ruleset chose this widget instead of the default.

Default widget

You are seeing the default widget for the locale ruleset test. The page sent a locale other than de-DE, so the German rule did not match and the ruleset used its default.