create-oke 0.5.1 → 0.6.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-oke",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "description": "Scaffold an okengine app — bunx create-oke@latest <name>",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,2 +1,20 @@
1
- /** Locale strings add keys as channel templates need them. */
2
- export default {};
1
+ import { defineLocale, type MessagesFor } from "okengine";
2
+ import { en } from "./en";
3
+
4
+ /**
5
+ * Arabic message catalog — same keys as English (`satisfies MessagesFor`).
6
+ */
7
+ const ar = {
8
+ errors: {
9
+ notFound: "غير موجود",
10
+ unauthorized: "غير مصرّح",
11
+ },
12
+ greeting: "مرحباً، {name}",
13
+ items:
14
+ "{count, plural, zero {لا عناصر} one {عنصر واحد} two {عنصران} few {# عناصر} many {# عنصراً} other {# عنصر}}",
15
+ place:
16
+ "أنهيت في المرتبة {place, selectordinal, one {#} two {#} few {#} other {#}}!",
17
+ status: "{status, select, online {متصل} offline {غير متصل} other {غير معروف}}",
18
+ } satisfies MessagesFor<typeof en>;
19
+
20
+ defineLocale("ar", ar);
@@ -1,2 +1,26 @@
1
- /** Locale strings add keys as channel templates need them. */
2
- export default {};
1
+ import { defineMessages, defineLocale } from "okengine";
2
+
3
+ /**
4
+ * English message catalog — ICU MessageFormat strings for `fx.t("…")`.
5
+ * Nested objects flatten to dot keys (`errors.notFound`).
6
+ *
7
+ * Augment `Register` so `fx.t` autocompletes keys and rejects typos.
8
+ */
9
+ export const en = defineMessages({
10
+ errors: {
11
+ notFound: "Not found",
12
+ unauthorized: "Unauthorized",
13
+ },
14
+ greeting: "Hello, {name}",
15
+ items: "{count, plural, =0 {no items} one {# item} other {# items}}",
16
+ place: "You finished {place, selectordinal, one {#st} two {#nd} few {#rd} other {#th}}!",
17
+ status: "{status, select, online {Online} offline {Offline} other {Unknown}}",
18
+ });
19
+
20
+ defineLocale("en", en);
21
+
22
+ declare module "okengine" {
23
+ interface Register {
24
+ messages: typeof en;
25
+ }
26
+ }