@mrcharles/sdk 0.1.0 → 0.2.0

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/README.md CHANGED
@@ -90,11 +90,30 @@ const site = await mc.sites.get('studio-uno-madrid'); // at build / on request
90
90
  Availability and holds must run in the browser (or forward the guest's IP in
91
91
  `headers: { 'X-Forwarded-For': ip }` when you proxy them).
92
92
 
93
+ ## Languages
94
+
95
+ One `locale` on the client drives everything: the hosted screen's language, the guest's SMS/email, `Accept-Language`, the SDK's own strings and its formatting.
96
+
97
+ ```js
98
+ const mc = createClient({ locale: 'ca' }); // any BCP-47 tag: 'ca-ES', 'pt-BR'…
99
+ mc.mountRoomBooking('#book', { slug, roomId }); // screen in Catalan, code in Catalan
100
+ mc.t('action.confirm'); // "Confirmar la reserva"
101
+ mc.format.price(2500, 'EUR'); // "25,00 €"
102
+ mc.format.date('2026-10-20'); // "dimarts, 20 d’octubre"
103
+ mc.format.duration(90); // "1 h 30 min"
104
+ mc.pick(site.site.content.tagline, site.site.defaultLocale);
105
+ mc.setLocale('en'); // a language switcher: links, embeds, new flows follow
106
+ ```
107
+
108
+ - **Hosted screen and messages** speak **es, ca, en** (what the studio's site offers).
109
+ - **The SDK** speaks **es, ca, en, fr, pt, it, de**: labels and error sentences for a custom UI (`flow.t()`, `flow.state.errorMessage`, `mc.errorMessage(err)`, `messageFor()`), formatting for any tag. A French site gets French labels; the guest's code arrives in English, the closest hosted language.
110
+ - No `locale` → each site's default language, so a Spanish studio stays Spanish without configuration.
111
+
93
112
  ## API surface
94
113
 
95
114
  | | |
96
115
  |---|---|
97
- | `createClient({ fetch, locale, headers })` | one client |
116
+ | `createClient({ fetch, locale, headers })` | one client; `setLocale`, `t`, `format`, `pick`, `errorMessage` |
98
117
  | `sites.get / resolve / availability` | studio payload, custom-domain lookup, free spans |
99
118
  | `holds.create / verify / resend / confirm` | the raw calls, if you manage state yourself |
100
119
  | `bookings.get / cancel` | a guest's booking by manage token |