i18n
This is a server SDK — it does not render translated strings itself. There is no t() / label-render helper in the Swift SDK. Translation rendering is a…
Generated from the SDK's own /docs/ — also served raw at
https://shipeasy-ai.github.io/sdk-swift/pages/i18n.md.
This is a server SDK — it does not render translated strings itself. There is
no t() / label-render helper in the Swift SDK. Translation rendering is a
client-side concern: the browser SDK fetches the translation profile and
renders labels via its own t(). What the Swift server SDK does is emit the SSR
loader/bootstrap <script> tags so the browser SDK is wired up on first paint.
What the Swift SDK provides
Two package-level helpers produce <script> tags for the document <head>
(both async; both resolve against the configuration from configure(...)):
i18nScriptTag(_ clientKey:profile:baseURL:)— the i18n loader tag. It fetches translations for the{{PROFILE}}profile (e.g."en:prod"). The public client key goes here (never the server key).bootstrapScriptTag(_:anonId:i18nProfile:baseURL:)— the flag/experiment bootstrap tag (no key); carries evaluated flags indata-*attributes so the browser SDK has them on first paint and buckets identically to the server.
let user = ["user_id": "u_123"]
// package-level helpers — they use the configured global setup; no Engine needed
let bootstrap = await bootstrapScriptTag(user, anonId: anonId)
let i18n = await i18nScriptTag(clientKey, profile: "{{PROFILE}}")
let head = bootstrap + i18ni18nScriptTag renders:
<script
src="https://cdn.shipeasy.ai/sdk/i18n/loader.js"
data-key="CLIENT_KEY"
data-profile="en:prod"
></script>bootstrapScriptTag also accepts i18nProfile: (to set data-i18n-profile) and
baseURL: (defaults to https://cdn.shipeasy.ai).
The cross-SDK story
- Server (Swift): emit
bootstrapScriptTag+i18nScriptTag(clientKey, profile: "{{PROFILE}}")into<head>. - Browser (
@shipeasy/sdkclient): the loader hydrates the profile; your front-end calls the client SDK'st("some.key")to render the actual translated string.
So the Swift SDK is the delivery mechanism for the loader/bootstrap; the
rendering (t()) happens in the browser client SDK against the {{PROFILE}}
profile.