@rivinia/i18n 1.0.1 → 1.0.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @rivinia/i18n
2
2
 
3
+ ## 1.0.3
4
+
5
+ - Correct package repository, documentation, homepage, and issue links after the GitHub repository rename.
6
+
7
+ ## 1.0.2
8
+
9
+ - Fixed the `ng add` language selection: it now offers a multi-select prompt and generates valid config when browser-language detection is enabled.
10
+
3
11
  ## 1.0.1
4
12
 
5
13
  - Documentation links updated to the 1.0.1 tag.
package/README.md CHANGED
@@ -4,14 +4,14 @@
4
4
  [![license](https://img.shields.io/npm/l/@rivinia/i18n.svg)](https://www.npmjs.com/package/@rivinia/i18n)
5
5
 
6
6
  <p align="center">
7
- <img src="https://raw.githubusercontent.com/abdelfattahqandil21-oss/Revinia/i18n/v1.0.1/assets/rivinia-abstract-mark-light.svg" alt="Rivinia" width="340" />
7
+ <img src="https://raw.githubusercontent.com/abdelfattahqandil21-oss/Rivinia/i18n/v1.0.3/assets/rivinia-abstract-mark-light.svg" alt="Rivinia" width="340" />
8
8
  </p>
9
9
 
10
10
  A headless Angular language manager built on signals: key-based JSON
11
11
  dictionaries, inline translations, RTL/LTR document attributes, lazy loaders, ICU
12
12
  plural/select messages, browser-language detection, and `Intl` number/date
13
13
  formatting — with SSR that actually works and no runtime dependency beyond
14
- Angular. Package version: **1.0.1**.
14
+ Angular. Package version: **1.0.3**.
15
15
 
16
16
  The `1.0.0` stable release follows the 1.0 release candidates; 0.x was experimental.
17
17
 
@@ -43,7 +43,7 @@ export class Header {
43
43
 
44
44
  `title()` and the pipe update on the click and the page's direction flips with the
45
45
  language — nothing else is wired by hand. The same app under
46
- [`projects/i18n/testing/app/src`](https://github.com/abdelfattahqandil21-oss/Revinia/tree/i18n/v1.0.1/projects/i18n/testing/app/src)
46
+ [`projects/i18n/testing/app/src`](https://github.com/abdelfattahqandil21-oss/Rivinia/tree/i18n/v1.0.3/projects/i18n/testing/app/src)
47
47
  is what the Playwright suites drive: `npx ng build i18n-e2e` runs it locally.
48
48
 
49
49
  ## Why `@rivinia/i18n`
@@ -129,7 +129,7 @@ so an app that never runs `ng add` does not install it). Optional, for the picke
129
129
 
130
130
  The two are independent: the UI entry points import core **types** only, and the core
131
131
  never imports them. Every UI export is Experimental; the tiers are in the
132
- [API reference](https://github.com/abdelfattahqandil21-oss/Revinia/blob/i18n/v1.0.1/docs/i18n/api.md#api-stability).
132
+ [API reference](https://github.com/abdelfattahqandil21-oss/Rivinia/blob/i18n/v1.0.3/docs/i18n/api.md#api-stability).
133
133
 
134
134
  ## Compatibility
135
135
 
@@ -149,7 +149,7 @@ the `/select` entry only — optional, so an app that never imports
149
149
  `@rivinia/i18n/select` does not install it. The caret admits every select 1.x
150
150
  release, the rc and the final alike, and excludes a 2.0. The floor dates, the
151
151
  `@supports` gate and what has never been run (including real Safari) are in
152
- [browser support](https://github.com/abdelfattahqandil21-oss/Revinia/blob/i18n/v1.0.1/docs/browser-support.md).
152
+ [browser support](https://github.com/abdelfattahqandil21-oss/Rivinia/blob/i18n/v1.0.3/docs/browser-support.md).
153
153
 
154
154
  ## Go further
155
155
 
@@ -158,10 +158,10 @@ surface ordered by API.
158
158
 
159
159
  | Tier | Read |
160
160
  | ----------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
161
- | Everyday use | [translating text](https://github.com/abdelfattahqandil21-oss/Revinia/blob/i18n/v1.0.1/docs/i18n/translating.md) · [switching the language](https://github.com/abdelfattahqandil21-oss/Revinia/blob/i18n/v1.0.1/docs/i18n/switching.md) · [dictionaries and SSR](https://github.com/abdelfattahqandil21-oss/Revinia/blob/i18n/v1.0.1/docs/i18n/dictionaries.md) |
162
- | Reference — behaviour | [ICU messages](https://github.com/abdelfattahqandil21-oss/Revinia/blob/i18n/v1.0.1/docs/i18n/icu.md) · [missing keys, fallback and failures](https://github.com/abdelfattahqandil21-oss/Revinia/blob/i18n/v1.0.1/docs/i18n/resilience.md) · [the CLI](https://github.com/abdelfattahqandil21-oss/Revinia/blob/i18n/v1.0.1/docs/i18n/cli.md) |
163
- | Reference — the surface | [the API](https://github.com/abdelfattahqandil21-oss/Revinia/blob/i18n/v1.0.1/docs/i18n/api.md) · [the language toggle](https://github.com/abdelfattahqandil21-oss/Revinia/blob/i18n/v1.0.1/docs/i18n/toggle.md) · [the language picker](https://github.com/abdelfattahqandil21-oss/Revinia/blob/i18n/v1.0.1/docs/i18n/select.md) |
164
- | Theming | [Rivinia theming](https://github.com/abdelfattahqandil21-oss/Revinia/blob/i18n/v1.0.1/docs/theme/README.md) |
161
+ | Everyday use | [translating text](https://github.com/abdelfattahqandil21-oss/Rivinia/blob/i18n/v1.0.3/docs/i18n/translating.md) · [switching the language](https://github.com/abdelfattahqandil21-oss/Rivinia/blob/i18n/v1.0.3/docs/i18n/switching.md) · [dictionaries and SSR](https://github.com/abdelfattahqandil21-oss/Rivinia/blob/i18n/v1.0.3/docs/i18n/dictionaries.md) |
162
+ | Reference — behaviour | [ICU messages](https://github.com/abdelfattahqandil21-oss/Rivinia/blob/i18n/v1.0.3/docs/i18n/icu.md) · [missing keys, fallback and failures](https://github.com/abdelfattahqandil21-oss/Rivinia/blob/i18n/v1.0.3/docs/i18n/resilience.md) · [the CLI](https://github.com/abdelfattahqandil21-oss/Rivinia/blob/i18n/v1.0.3/docs/i18n/cli.md) |
163
+ | Reference — the surface | [the API](https://github.com/abdelfattahqandil21-oss/Rivinia/blob/i18n/v1.0.3/docs/i18n/api.md) · [the language toggle](https://github.com/abdelfattahqandil21-oss/Rivinia/blob/i18n/v1.0.3/docs/i18n/toggle.md) · [the language picker](https://github.com/abdelfattahqandil21-oss/Rivinia/blob/i18n/v1.0.3/docs/i18n/select.md) |
164
+ | Theming | [Rivinia theming](https://github.com/abdelfattahqandil21-oss/Rivinia/blob/i18n/v1.0.3/docs/theme/README.md) |
165
165
 
166
- Release history: [CHANGELOG.md](https://github.com/abdelfattahqandil21-oss/Revinia/blob/i18n/v1.0.1/projects/i18n/CHANGELOG.md).
166
+ Release history: [CHANGELOG.md](https://github.com/abdelfattahqandil21-oss/Rivinia/blob/i18n/v1.0.3/projects/i18n/CHANGELOG.md).
167
167
  MIT licensed.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivinia/i18n",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Headless Angular language manager: signals, RTL, SSR-safe loaders, fallback language, missing-key reporting, ICU plurals, typed keys.",
5
5
  "keywords": [
6
6
  "angular",
@@ -14,12 +14,12 @@
14
14
  "author": "abdelfattahqandil21 <abdelfattahqandil21@gmail.com>",
15
15
  "repository": {
16
16
  "type": "git",
17
- "url": "git+https://github.com/abdelfattahqandil21-oss/Revinia.git",
17
+ "url": "git+https://github.com/abdelfattahqandil21-oss/Rivinia.git",
18
18
  "directory": "projects/i18n"
19
19
  },
20
- "homepage": "https://github.com/abdelfattahqandil21-oss/Revinia/tree/i18n/v1.0.0/projects/i18n#readme",
20
+ "homepage": "https://github.com/abdelfattahqandil21-oss/Rivinia/tree/i18n/v1.0.3/projects/i18n#readme",
21
21
  "bugs": {
22
- "url": "https://github.com/abdelfattahqandil21-oss/Revinia/issues"
22
+ "url": "https://github.com/abdelfattahqandil21-oss/Rivinia/issues"
23
23
  },
24
24
  "engines": {
25
25
  "node": "^22.22.3 || ^24.15.0 || >=26.0.0"
@@ -25,7 +25,7 @@ const STARTER = (ids, detectBrowser) => {
25
25
  return ` { id: '${id}', nativeName: '${nativeName}', dir: '${dir}' },`;
26
26
  })
27
27
  .join('\n');
28
- const detect = detectBrowser ? ',\n detectBrowser: true' : '';
28
+ const detect = detectBrowser ? '\n detectBrowser: true' : '';
29
29
  return (`provideRiviniaI18n({\n` +
30
30
  ` // Dictionaries: public/i18n/{id}.json (default jsonLoader)\n` +
31
31
  ` defaultLanguage: '${ids[0]}',\n` +
@@ -38,6 +38,16 @@ const STARTER = (ids, detectBrowser) => {
38
38
  * BCP-47-ish tags, dedupes. Throws a clear error instead of emitting code.
39
39
  */
40
40
  function parseLanguageIds(raw) {
41
+ if (Array.isArray(raw)) {
42
+ const ids = [...new Set(raw.map((id) => id.trim().toLowerCase()).filter(Boolean))];
43
+ if (ids.length === 0)
44
+ return ['ar', 'en'];
45
+ const bad = ids.filter((id) => !/^[a-z]{2,8}(-[a-z0-9]{2,8})?$/.test(id));
46
+ if (bad.length > 0) {
47
+ throw new schematics_1.SchematicsException(`[rivinia/i18n] invalid language id(s): ${bad.join(', ')}.`);
48
+ }
49
+ return ids;
50
+ }
41
51
  if (!raw || raw.trim() === '')
42
52
  return ['ar', 'en'];
43
53
  // Accept bare lists (`ar, en`), quoted parts (`'ar', "en"`), and bracketed
@@ -5,18 +5,34 @@
5
5
  "type": "object",
6
6
  "properties": {
7
7
  "languages": {
8
- "type": "string",
9
- "description": "Comma-separated language ids — bare (ar, en), quoted ('ar', 'en') or bracketed ([ar, en]). First id becomes the default language. Dictionaries load from public/i18n/{id}.json by default.",
8
+ "type": ["array", "string"],
9
+ "description": "Languages to configure. Select them from the prompt or pass comma-separated codes. The first language becomes the default. Dictionaries load from public/i18n/{id}.json by default.",
10
+ "default": ["ar", "en"],
11
+ "items": {
12
+ "type": "string",
13
+ "enum": ["ar", "en", "fr", "de", "es", "he", "fa", "ur"]
14
+ },
10
15
  "x-prompt": {
11
- "message": "Language ids for this project (ar, en — brackets and quotes also fine)?",
12
- "type": "input"
16
+ "message": "Which languages should this app support? Select all that apply.",
17
+ "type": "list",
18
+ "multiselect": true,
19
+ "items": [
20
+ { "value": "ar", "label": "Arabic (العربية)" },
21
+ { "value": "en", "label": "English" },
22
+ { "value": "fr", "label": "French (Français)" },
23
+ { "value": "de", "label": "German (Deutsch)" },
24
+ { "value": "es", "label": "Spanish (Español)" },
25
+ { "value": "he", "label": "Hebrew (עברית)" },
26
+ { "value": "fa", "label": "Persian (فارسی)" },
27
+ { "value": "ur", "label": "Urdu (اردو)" }
28
+ ]
13
29
  }
14
30
  },
15
31
  "detectBrowser": {
16
32
  "type": "boolean",
17
- "description": "Match navigator.languages on first visit (stored preference always wins).",
33
+ "description": "On the visitor's first visit, choose a language from their browser settings. A saved language choice always takes priority.",
18
34
  "x-prompt": {
19
- "message": "Detect the browser language on first visit?",
35
+ "message": "Use the visitor's browser language on their first visit? A saved choice still takes priority.",
20
36
  "type": "confirmation"
21
37
  }
22
38
  },