@energy8platform/shell 0.6.3 → 0.6.4

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": "@energy8platform/shell",
3
- "version": "0.6.3",
3
+ "version": "0.6.4",
4
4
  "description": "Energy8 branded game shell — one logic core, pluggable html/pixi renderers behind a stable contract.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs.js",
package/src/core/i18n.ts CHANGED
@@ -26,11 +26,18 @@ export interface I18nOptions { language: string; isSocial?: boolean; messages?:
26
26
  export interface I18n { readonly lang: Lang; t(src: string): string; }
27
27
 
28
28
  export function createI18n(opts: I18nOptions): I18n {
29
- // Social is the `en-social` pseudo-locale: it rewrites the English source. Non-English locales are
30
- // authored social-safe already, so `socialize` only runs on the English source string.
29
+ // Social is the `en-social` pseudo-locale: it rewrites the English source into social-safe
30
+ // vocabulary. The replacement dictionary only exists for English, so social mode FORCES English
31
+ // the requested `language` is ignored, matching the `isSocial` contract ("…derived from English…
32
+ // regardless of `language`"). Rendering a non-English locale in social mode would leak untranslated
33
+ // restricted terms, so we never do it.
34
+ if (opts.isSocial) {
35
+ const t = (src: string): string => socialize(src);
36
+ return { lang: 'en', t };
37
+ }
31
38
  const lang = normalizeLang(opts.language);
32
39
  const t = (src: string): string => {
33
- if (lang === 'en') return opts.isSocial ? socialize(src) : src;
40
+ if (lang === 'en') return src;
34
41
  return opts.messages?.[lang]?.[src] ?? LOCALES[lang]?.[src] ?? src;
35
42
  };
36
43
  return { lang, t };
@@ -1,3 +1,3 @@
1
1
  // AUTO-GENERATED by scripts/gen-version.mjs — do not edit. Mirrors package.json "version".
2
2
  /** The @energy8platform/shell package version, stamped into the game-info footer. */
3
- export const PACKAGE_VERSION = '0.6.3';
3
+ export const PACKAGE_VERSION = '0.6.4';