@proveanything/smartlinks 2.2.7 → 2.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/docs/API_SUMMARY.md +1 -1
- package/dist/docs/i18n.md +15 -9
- package/dist/docs/overview.md +487 -487
- package/dist/docs/payments.md +87 -87
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/docs/API_SUMMARY.md +1 -1
- package/docs/i18n.md +15 -9
- package/docs/overview.md +487 -487
- package/docs/payments.md +87 -87
- package/package.json +87 -87
package/dist/docs/API_SUMMARY.md
CHANGED
package/dist/docs/i18n.md
CHANGED
|
@@ -16,13 +16,17 @@ Forge's step 21 moves an app off it.
|
|
|
16
16
|
3. **The host says which language.** Studio passes the person's own Studio language as `?lang=`, and later
|
|
17
17
|
changes arrive live (`smartlinks:root-state` with `lang`). A key with no translation shows its English.
|
|
18
18
|
|
|
19
|
-
**Where the other languages come from at run time.**
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
**Where the other languages come from at run time.** Once your app is translated, the other languages
|
|
20
|
+
are files beside `en.json` (`public/i18n/fr.json`, `de.json`…), in your source and in the published bundle.
|
|
21
|
+
They are not compiled into your code: the SDK **downloads** the one in use (`GET <folder>/i18n/fr.json`) when
|
|
22
|
+
the app starts or the language changes. It is a static file fetch, not an API call. `<folder>` is beside the
|
|
23
|
+
page by default, or what you gave as `baseUrl` / `moduleUrl`. So when a key still shows English:
|
|
24
|
+
|
|
25
|
+
1. Look the key up in `public/i18n/<lang>.json`. Missing there: it isn't translated yet.
|
|
26
|
+
2. There, but still English: the file isn't being read. Ask **which `fr.json` was fetched, from where, and
|
|
27
|
+
was it yours?** (In the browser's network list, filter on `i18n/`.) A local dev server or stand-in
|
|
28
|
+
usually can't show this fault: there the page and the bundle are the same folder. Inside Portal or Hub,
|
|
29
|
+
see the next section.
|
|
26
30
|
|
|
27
31
|
## Mounted inside another app's page: use `i18n.forApp`
|
|
28
32
|
|
|
@@ -54,8 +58,10 @@ export function useT() {
|
|
|
54
58
|
instead when you know the folder exactly.
|
|
55
59
|
- Don't call `i18n.init` from a container or widget: it changes the host's settings.
|
|
56
60
|
- A container or widget runs on the **host's** SDK, not the one in your `package.json`. A host older than
|
|
57
|
-
2.2.5 has no `forApp`, and
|
|
58
|
-
|
|
61
|
+
2.2.5 has no `forApp`, and one older than 2.2.1 has no `i18n` at all; calling either there stops your
|
|
62
|
+
whole panel. Check first and fall back to your bundled English:
|
|
63
|
+
`typeof i18n?.forApp === 'function' ? i18n.forApp(...) : <your English only>`, and use `i18n?.` for
|
|
64
|
+
anything else you read from the host's `i18n`.
|
|
59
65
|
- `forApp` works for a standalone page too, so one `src/i18n.ts` can serve every way the app is shown.
|
|
60
66
|
|
|
61
67
|
In an admin app, `lang` is the person's **Studio language** (buttons and labels). The site's content
|