@rivinia/i18n 0.3.1 → 0.3.2

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.
Files changed (2) hide show
  1. package/README.md +15 -12
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -8,7 +8,7 @@ JSON dictionaries, inline translations, RTL/LTR document attributes, lazy
8
8
  loaders, ICU plural/select messages, browser-language detection, and
9
9
  ECMAScript internationalization number/date formatting.
10
10
 
11
- - Prepared patch: **0.3.1** (latest published: **0.3.0**)
11
+ - Package version: **0.3.2**
12
12
  - Peer dependency: **`@angular/core` `^22.0.0`**
13
13
  - No `tslib` or `HttpClient` peer dependency. Built-in loaders use `fetch`.
14
14
 
@@ -136,17 +136,7 @@ import { i18nConfig } from './i18n.config';
136
136
  selector: 'app-header',
137
137
  standalone: true,
138
138
  imports: [RTranslatePipe],
139
- template: `
140
- @if (i18n.ready()) {
141
- <p>{{ i18n.translate({ en: 'Welcome', ar: 'أهلاً' }) }}</p>
142
- <p>{{ 'booking.seats' | rTranslate: { count: seatCount } }}</p>
143
- <p>{{ i18n.formatNumber(price, { style: 'currency', currency: 'USD' }) }}</p>
144
- <button type="button" (click)="i18n.setLanguage('ar')">العربية</button>
145
- <button type="button" (click)="i18n.setLanguage('en')">English</button>
146
- } @else {
147
- <p>Loading…</p>
148
- }
149
- `,
139
+ templateUrl: './header.component.html',
150
140
  })
151
141
  export class HeaderComponent {
152
142
  readonly i18n = i18nConfig.inject();
@@ -155,6 +145,19 @@ export class HeaderComponent {
155
145
  }
156
146
  ```
157
147
 
148
+ ```html
149
+ <!-- src/app/header.component.html -->
150
+ @if (i18n.ready()) {
151
+ <p>{{ i18n.translate({ en: 'Welcome', ar: 'أهلاً' }) }}</p>
152
+ <p>{{ 'booking.seats' | rTranslate: { count: seatCount } }}</p>
153
+ <p>{{ i18n.formatNumber(price, { style: 'currency', currency: 'USD' }) }}</p>
154
+ <button type="button" (click)="i18n.setLanguage('ar')">العربية</button>
155
+ <button type="button" (click)="i18n.setLanguage('en')">English</button>
156
+ } @else {
157
+ <p>Loading…</p>
158
+ }
159
+ ```
160
+
158
161
  For key lookup, `translate('booking.seats', { count: 3 })` is also available.
159
162
  Missing keys return the key itself, or the supplied fallback:
160
163
  `translate('missing.key', 'Not available')`. Inline language maps fall back to
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivinia/i18n",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Headless language manager for Angular: signals, RTL, loaders, ICU plurals, browser detection, Intl formatting.",
5
5
  "keywords": [
6
6
  "angular",