@sit-onyx/nuxt 1.0.0-alpha.40 → 1.0.0-alpha.42

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/module.d.mts CHANGED
@@ -11,6 +11,20 @@ interface ModuleOptions {
11
11
  * @see https://onyx.schwarz/development/#installation
12
12
  */
13
13
  disableGlobalStyles?: boolean;
14
+ /**
15
+ * Settings related to the integration with @nuxtjs/i18n
16
+ */
17
+ i18n?: {
18
+ /**
19
+ * Mapping for registering the translations from onyx with @nuxtjs/i18n.
20
+ * @example
21
+ * ```ts
22
+ * registerLocales: { "en_US": "en-US" }
23
+ * ```
24
+ * This would register the onyx translations for the language "en-US" to the code "en_US" of your projects locales.
25
+ */
26
+ registerLocales?: Record<string, "en-US" | "de-DE" | "ko-KR">;
27
+ };
14
28
  }
15
29
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
16
30
 
package/dist/module.d.ts CHANGED
@@ -11,6 +11,20 @@ interface ModuleOptions {
11
11
  * @see https://onyx.schwarz/development/#installation
12
12
  */
13
13
  disableGlobalStyles?: boolean;
14
+ /**
15
+ * Settings related to the integration with @nuxtjs/i18n
16
+ */
17
+ i18n?: {
18
+ /**
19
+ * Mapping for registering the translations from onyx with @nuxtjs/i18n.
20
+ * @example
21
+ * ```ts
22
+ * registerLocales: { "en_US": "en-US" }
23
+ * ```
24
+ * This would register the onyx translations for the language "en-US" to the code "en_US" of your projects locales.
25
+ */
26
+ registerLocales?: Record<string, "en-US" | "de-DE" | "ko-KR">;
27
+ };
14
28
  }
15
29
  declare const _default: _nuxt_schema.NuxtModule<ModuleOptions>;
16
30
 
package/dist/module.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@sit-onyx/nuxt",
3
3
  "configKey": "onyx",
4
- "version": "1.0.0-alpha.39",
4
+ "version": "1.0.0-alpha.41",
5
5
  "builder": {
6
- "@nuxt/module-builder": "0.8.0",
6
+ "@nuxt/module-builder": "0.8.1",
7
7
  "unbuild": "unknown"
8
8
  }
9
9
  }
package/dist/module.mjs CHANGED
@@ -28,7 +28,7 @@ const module = defineNuxtModule({
28
28
  "@nuxtjs/i18n-edge"
29
29
  );
30
30
  const onyxModuleIndex = getModuleIndex(nuxt.options.modules, "@sit-onyx/nuxt");
31
- if (onyxModuleIndex > i18nModuleIndex) {
31
+ if (i18nModuleIndex >= 0 && onyxModuleIndex > i18nModuleIndex) {
32
32
  logger.warn(
33
33
  "The @nuxtjs/i18n module was registered before the @sit-onyx/nuxt module. The default translations of onyx won't be loaded, please register the @sit-onyx/nuxt module before @nuxtjs/i18n"
34
34
  );
@@ -37,13 +37,12 @@ const module = defineNuxtModule({
37
37
  const registerOnyxLocales = (register) => {
38
38
  register({
39
39
  langDir: resolve("./runtime/locales"),
40
- locales: [
41
- // we need to use .js files instead of .ts because the .ts files would be compiled to .js in the build step, so
42
- // when projects use this nuxt module, .ts files will throw a "can not find file" error
43
- { code: "de-DE", file: "de-DE.js" },
44
- { code: "en-US", file: "en-US.js" },
45
- { code: "ko-KR", file: "ko-KR.js" }
46
- ]
40
+ // we need to use .js files instead of .ts because the .ts files would be compiled to .js in the build step, so
41
+ // when projects use this nuxt module, .ts files will throw a "can not find file" error
42
+ locales: Object.entries(options.i18n?.registerLocales ?? {}).map(([code, language]) => ({
43
+ code,
44
+ file: `${language}.js`
45
+ }))
47
46
  });
48
47
  };
49
48
  nuxt.hook("i18n:registerModule", registerOnyxLocales);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sit-onyx/nuxt",
3
- "version": "1.0.0-alpha.40",
3
+ "version": "1.0.0-alpha.42",
4
4
  "description": "A Nuxt module to easily integrate onyx into Nuxt projects",
5
5
  "author": "Schwarz IT KG",
6
6
  "license": "Apache-2.0",
@@ -30,7 +30,7 @@
30
30
  },
31
31
  "devDependencies": {
32
32
  "@nuxt/devtools": "^1.3.7",
33
- "@nuxt/module-builder": "~0.8.0",
33
+ "@nuxt/module-builder": "~0.8.1",
34
34
  "@nuxt/schema": "^3.12.2",
35
35
  "@nuxt/test-utils": "^3.13.1",
36
36
  "@nuxtjs/i18n": "^8.3.1",
@@ -38,7 +38,7 @@
38
38
  "vue-i18n": "^9.13.1"
39
39
  },
40
40
  "peerDependencies": {
41
- "sit-onyx": "^1.0.0-alpha.159"
41
+ "sit-onyx": "^1.0.0-alpha.160"
42
42
  },
43
43
  "scripts": {
44
44
  "dev": "nuxi dev playground",