@fundamental-ngx/i18n 0.58.0-rc.99 → 0.58.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/README.md CHANGED
@@ -18,36 +18,117 @@
18
18
 
19
19
  ## 1. Description
20
20
 
21
- `@fundamental-ngx/i18n` is a library that provides translation utilities for the Fundamental-ngx library.
22
- The library is tailored for the use in `fundamental-ngx` components and can be used for modifying the variety of the
23
- components' labels, hints, and descriptions.
21
+ `@fundamental-ngx/i18n` provides centralized internationalization for Fundamental-ngx components with support for 37+ languages and runtime translation switching.
24
22
 
25
- Even though the library is tailored for the use in `fundamental-ngx` components, it can be used in any Angular application,
26
- where the simple translations are needed.
23
+ ### What's Included
27
24
 
28
- The library elements are for the runtime, which gives the possibility to swap the translations on the fly, without
29
- having to refresh the pages.
25
+ - Pre-compiled translation data for 37+ languages (as `FD_LANGUAGE_*` constants)
26
+ - Translation resolver utilities (signals, observables, and synchronous APIs)
27
+ - `FdTranslatePipe` for template translations
28
+ - Type-safe translation keys via `FdLanguage` interface
29
+
30
+ ### How It Works
31
+
32
+ 1. **Source**: Translation teams provide `.properties` files (Java-style format)
33
+ 2. **Build**: NX executor converts `.properties` → TypeScript modules
34
+ 3. **Export**: Language constants (`FD_LANGUAGE_ENGLISH`, `FD_LANGUAGE_GERMAN`, etc.)
35
+ 4. **Publish**: Compiled JavaScript (not source `.properties`) published to npm
36
+ 5. **Use**: Apps import language constants and translation utilities
37
+
38
+ While designed for Fundamental-ngx components, this library works in any Angular application needing runtime-switchable translations.
39
+
40
+ ### Adding New Translation Keys
41
+
42
+ > **This guide is for adding new translation keys (labels, ARIA attributes), NOT for adding new languages.**
43
+
44
+ #### Quick Steps
45
+
46
+ 1. **Update interface**: Add key to [`FdLanguage`](src/lib/models/fd-language.ts) interface
47
+ 2. **Add to all .properties files**: Same key + English text in all 37+ language files
48
+ 3. **Run**: `nx run i18n:transform-translations`
49
+ 4. **Use**: Import and use in your component
50
+
51
+ ---
52
+
53
+ #### Step 1: Update TypeScript Interface
54
+
55
+ Add your key to `libs/i18n/src/lib/models/fd-language.ts`:
56
+
57
+ ```typescript
58
+ export interface FdLanguage {
59
+ coreYourComponent: {
60
+ /** Description */
61
+ yourNewKey: FdLanguageKey;
62
+ keyWithParams: FdLanguageKey<{ count: number }>;
63
+ };
64
+ }
65
+ ```
66
+
67
+ > **Note**: `fd-language-key-identifier.ts` is auto-generated - don't edit it manually.
68
+
69
+ #### Step 2: Add to ALL .properties Files
70
+
71
+ Add to **all** files in `libs/i18n/src/lib/translations/` (use English text everywhere):
72
+
73
+ ```properties
74
+ #XBUT: Button / #XFLD: Label / #XTIT: Title / #XACT: ARIA / #XMSG: Message
75
+ coreYourComponent.yourNewKey = Your English text
76
+ coreYourComponent.keyWithParams = Item {count}
77
+ ```
78
+
79
+ **Why all files?** TypeScript requires identical keys across all languages. Translation teams will replace English placeholders later.
80
+
81
+ #### Step 3: Generate TypeScript Files
82
+
83
+ ```bash
84
+ nx run i18n:transform-translations
85
+ ```
86
+
87
+ Auto-generates: `translations*.ts`, `fd-language-key-identifier.ts` (union type), test files
88
+
89
+ #### Step 4: Use in Components
90
+
91
+ **Template (pipe):**
92
+
93
+ ```typescript
94
+ import { FdTranslatePipe } from '@fundamental-ngx/i18n';
95
+
96
+ @Component({
97
+ imports: [FdTranslatePipe],
98
+ template: `<button>{{ 'coreYourComponent.yourNewKey' | fdTranslate }}</button>`
99
+ })
100
+ ```
101
+
102
+ **TypeScript (signal):**
103
+
104
+ ```typescript
105
+ import { resolveTranslationSignal } from '@fundamental-ngx/i18n';
106
+
107
+ protected readonly label = resolveTranslationSignal('coreYourComponent.yourNewKey');
108
+ ```
109
+
110
+ **Post-merge**: Translation teams will provide proper translations in future releases.
30
111
 
31
112
  ## 2. Requirements
32
113
 
33
- To download and use Fundamental Library i18n package, you will first need to install
34
- the [node package manager](https://www.npmjs.com/get-npm). The library is intended for use with
35
- Angular 16.2 or newer. Prior knowledge of Angular is recommended, to use it fully library.
114
+ - Node.js and npm
115
+ - Angular 16.2 or newer
116
+ - Prior Angular knowledge recommended
36
117
 
37
118
  ## 3. Versioning
38
119
 
39
- Check the [Breaking Changes](https://github.com/SAP/fundamental-ngx/wiki#breaking-changes) for the latest patches changes.
120
+ See [Breaking Changes](https://github.com/SAP/fundamental-ngx/wiki#breaking-changes) for the latest updates.
40
121
 
41
122
  ## 4. Known Issues
42
123
 
43
- Please see [Issues](https://github.com/SAP/fundamental-ngx/issues).
124
+ See [Issues](https://github.com/SAP/fundamental-ngx/issues).
44
125
 
45
126
  ## 5. Support
46
127
 
47
- If you encounter an issue, you can [create a ticket](https://github.com/SAP/fundamental-ngx/issues).
128
+ [Create a ticket](https://github.com/SAP/fundamental-ngx/issues) for issues or questions.
48
129
 
49
130
  ## 6. Contributing
50
131
 
51
- If you want to contribute, please check the [CONTRIBUTING.md](https://github.com/SAP/fundamental-ngx/blob/main/CONTRIBUTING.md) documentation for contribution guidelines. Please follow the [Angular commit message guidelines](https://github.com/angular/angular/blob/main/CONTRIBUTING.md#commit).
132
+ Check [CONTRIBUTING.md](https://github.com/SAP/fundamental-ngx/blob/main/CONTRIBUTING.md) for guidelines. Follow [Angular commit message guidelines](https://github.com/angular/angular/blob/main/CONTRIBUTING.md#commit).
52
133
 
53
- Check out the [NEW_COMPONENT.md](https://github.com/SAP/fundamental-ngx/blob/main/NEW_COMPONENT.md) guide on building a new component for the library and creating the necessary documentation for your new component.
134
+ See [NEW_COMPONENT.md](https://github.com/SAP/fundamental-ngx/blob/main/NEW_COMPONENT.md) for creating new components.
@@ -602,6 +602,9 @@ var json$z = {
602
602
  segmentedButton: {
603
603
  groupRoleDescription: 'Segmented Button Group',
604
604
  buttonRoleDescription: 'Segmented Button'
605
+ },
606
+ coreObjectIdentifier: {
607
+ srOnlyAriaLabel: 'Object Identifier'
605
608
  }
606
609
  };
607
610
 
@@ -1227,6 +1230,9 @@ var json$y = {
1227
1230
  segmentedButton: {
1228
1231
  groupRoleDescription: 'مجموعة الأزرار المقسَّمة',
1229
1232
  buttonRoleDescription: 'زر مقسَّم'
1233
+ },
1234
+ coreObjectIdentifier: {
1235
+ srOnlyAriaLabel: 'Object Identifier'
1230
1236
  }
1231
1237
  };
1232
1238
 
@@ -1852,6 +1858,9 @@ var json$x = {
1852
1858
  segmentedButton: {
1853
1859
  groupRoleDescription: 'Група сегментирани бутони',
1854
1860
  buttonRoleDescription: 'Сегментиран бутон'
1861
+ },
1862
+ coreObjectIdentifier: {
1863
+ srOnlyAriaLabel: 'Object Identifier'
1855
1864
  }
1856
1865
  };
1857
1866
 
@@ -2477,6 +2486,9 @@ var json$w = {
2477
2486
  segmentedButton: {
2478
2487
  groupRoleDescription: '分段式按钮组',
2479
2488
  buttonRoleDescription: '分段式按钮'
2489
+ },
2490
+ coreObjectIdentifier: {
2491
+ srOnlyAriaLabel: 'Object Identifier'
2480
2492
  }
2481
2493
  };
2482
2494
 
@@ -3103,6 +3115,9 @@ var json$v = {
3103
3115
  segmentedButton: {
3104
3116
  groupRoleDescription: '分區按鈕群組',
3105
3117
  buttonRoleDescription: '分區按鈕'
3118
+ },
3119
+ coreObjectIdentifier: {
3120
+ srOnlyAriaLabel: 'Object Identifier'
3106
3121
  }
3107
3122
  };
3108
3123
 
@@ -3728,6 +3743,9 @@ var json$u = {
3728
3743
  segmentedButton: {
3729
3744
  groupRoleDescription: 'Grupa segmentiranih gumbi',
3730
3745
  buttonRoleDescription: 'Segmentirani gumbi'
3746
+ },
3747
+ coreObjectIdentifier: {
3748
+ srOnlyAriaLabel: 'Object Identifier'
3731
3749
  }
3732
3750
  };
3733
3751
 
@@ -4353,6 +4371,9 @@ var json$t = {
4353
4371
  segmentedButton: {
4354
4372
  groupRoleDescription: 'Skupina segmentovaných tlačítek',
4355
4373
  buttonRoleDescription: 'Segmentované tlačítko'
4374
+ },
4375
+ coreObjectIdentifier: {
4376
+ srOnlyAriaLabel: 'Object Identifier'
4356
4377
  }
4357
4378
  };
4358
4379
 
@@ -4978,6 +4999,9 @@ var json$s = {
4978
4999
  segmentedButton: {
4979
5000
  groupRoleDescription: 'Segmenteret knapgruppe',
4980
5001
  buttonRoleDescription: 'Segmentknap'
5002
+ },
5003
+ coreObjectIdentifier: {
5004
+ srOnlyAriaLabel: 'Object Identifier'
4981
5005
  }
4982
5006
  };
4983
5007
 
@@ -5603,6 +5627,9 @@ var json$r = {
5603
5627
  segmentedButton: {
5604
5628
  groupRoleDescription: 'Groep gesegmenteerde knoppen',
5605
5629
  buttonRoleDescription: 'Gesegmenteerde knop'
5630
+ },
5631
+ coreObjectIdentifier: {
5632
+ srOnlyAriaLabel: 'Object Identifier'
5606
5633
  }
5607
5634
  };
5608
5635
 
@@ -6228,6 +6255,9 @@ var json$q = {
6228
6255
  segmentedButton: {
6229
6256
  groupRoleDescription: 'Segmented Button Group',
6230
6257
  buttonRoleDescription: 'Segmented Button'
6258
+ },
6259
+ coreObjectIdentifier: {
6260
+ srOnlyAriaLabel: 'Object Identifier'
6231
6261
  }
6232
6262
  };
6233
6263
 
@@ -6853,6 +6883,9 @@ var json$p = {
6853
6883
  segmentedButton: {
6854
6884
  groupRoleDescription: 'Segmentoitu painikeryhmä',
6855
6885
  buttonRoleDescription: 'Segmentoitu painike'
6886
+ },
6887
+ coreObjectIdentifier: {
6888
+ srOnlyAriaLabel: 'Object Identifier'
6856
6889
  }
6857
6890
  };
6858
6891
 
@@ -7478,6 +7511,9 @@ var json$o = {
7478
7511
  segmentedButton: {
7479
7512
  groupRoleDescription: 'Groupe de boutons segmentés',
7480
7513
  buttonRoleDescription: 'Bouton segmenté'
7514
+ },
7515
+ coreObjectIdentifier: {
7516
+ srOnlyAriaLabel: 'Object Identifier'
7481
7517
  }
7482
7518
  };
7483
7519
 
@@ -8078,6 +8114,9 @@ var json$n = {
8078
8114
  segmentedButton: {
8079
8115
  groupRoleDescription: 'Segmented Button Group',
8080
8116
  buttonRoleDescription: 'Segmented Button'
8117
+ },
8118
+ coreObjectIdentifier: {
8119
+ srOnlyAriaLabel: 'Object Identifier'
8081
8120
  }
8082
8121
  };
8083
8122
 
@@ -8703,6 +8742,9 @@ var json$m = {
8703
8742
  segmentedButton: {
8704
8743
  groupRoleDescription: 'Segmentierte Schaltflächengruppe',
8705
8744
  buttonRoleDescription: 'Segmentierte Schaltfläche'
8745
+ },
8746
+ coreObjectIdentifier: {
8747
+ srOnlyAriaLabel: 'Object Identifier'
8706
8748
  }
8707
8749
  };
8708
8750
 
@@ -9328,6 +9370,9 @@ var json$l = {
9328
9370
  segmentedButton: {
9329
9371
  groupRoleDescription: 'Ομάδα Τμηματοποιημένου Κουμπιού',
9330
9372
  buttonRoleDescription: 'Τμηματοποιημένο Κουμπί'
9373
+ },
9374
+ coreObjectIdentifier: {
9375
+ srOnlyAriaLabel: 'Object Identifier'
9331
9376
  }
9332
9377
  };
9333
9378
 
@@ -9953,6 +9998,9 @@ var json$k = {
9953
9998
  segmentedButton: {
9954
9999
  groupRoleDescription: 'קבוצת סרגלי לחצנים',
9955
10000
  buttonRoleDescription: 'סרגל לחצנים'
10001
+ },
10002
+ coreObjectIdentifier: {
10003
+ srOnlyAriaLabel: 'Object Identifier'
9956
10004
  }
9957
10005
  };
9958
10006
 
@@ -10553,6 +10601,9 @@ var json$j = {
10553
10601
  segmentedButton: {
10554
10602
  groupRoleDescription: 'Segmented Button Group',
10555
10603
  buttonRoleDescription: 'Segmented Button'
10604
+ },
10605
+ coreObjectIdentifier: {
10606
+ srOnlyAriaLabel: 'Object Identifier'
10556
10607
  }
10557
10608
  };
10558
10609
 
@@ -11178,6 +11229,9 @@ var json$i = {
11178
11229
  segmentedButton: {
11179
11230
  groupRoleDescription: 'Szegmentált gombcsoport',
11180
11231
  buttonRoleDescription: 'Szegmentált gomb'
11232
+ },
11233
+ coreObjectIdentifier: {
11234
+ srOnlyAriaLabel: 'Object Identifier'
11181
11235
  }
11182
11236
  };
11183
11237
 
@@ -11803,6 +11857,9 @@ var json$h = {
11803
11857
  segmentedButton: {
11804
11858
  groupRoleDescription: 'Gruppo pulsanti segmentati',
11805
11859
  buttonRoleDescription: 'Pulsante segmentato'
11860
+ },
11861
+ coreObjectIdentifier: {
11862
+ srOnlyAriaLabel: 'Object Identifier'
11806
11863
  }
11807
11864
  };
11808
11865
 
@@ -12428,6 +12485,9 @@ var json$g = {
12428
12485
  segmentedButton: {
12429
12486
  groupRoleDescription: 'セグメントボタングループ',
12430
12487
  buttonRoleDescription: 'セグメントボタン'
12488
+ },
12489
+ coreObjectIdentifier: {
12490
+ srOnlyAriaLabel: 'Object Identifier'
12431
12491
  }
12432
12492
  };
12433
12493
 
@@ -13053,6 +13113,9 @@ var json$f = {
13053
13113
  segmentedButton: {
13054
13114
  groupRoleDescription: 'Сегменттелген түймелер тобы',
13055
13115
  buttonRoleDescription: 'Сегменттелген түйме'
13116
+ },
13117
+ coreObjectIdentifier: {
13118
+ srOnlyAriaLabel: 'Object Identifier'
13056
13119
  }
13057
13120
  };
13058
13121
 
@@ -13678,6 +13741,9 @@ var json$e = {
13678
13741
  segmentedButton: {
13679
13742
  groupRoleDescription: '세그멘테이션된 버튼 그룹',
13680
13743
  buttonRoleDescription: '세그멘테이션된 버튼'
13744
+ },
13745
+ coreObjectIdentifier: {
13746
+ srOnlyAriaLabel: 'Object Identifier'
13681
13747
  }
13682
13748
  };
13683
13749
 
@@ -14303,6 +14369,9 @@ var json$d = {
14303
14369
  segmentedButton: {
14304
14370
  groupRoleDescription: 'Kumpulan Butang Disegmenkan',
14305
14371
  buttonRoleDescription: 'Butang Disegmenkan'
14372
+ },
14373
+ coreObjectIdentifier: {
14374
+ srOnlyAriaLabel: 'Object Identifier'
14306
14375
  }
14307
14376
  };
14308
14377
 
@@ -14928,6 +14997,9 @@ var json$c = {
14928
14997
  segmentedButton: {
14929
14998
  groupRoleDescription: 'Segmenteringsknapp-gruppe',
14930
14999
  buttonRoleDescription: 'Segmenteringsknapp'
15000
+ },
15001
+ coreObjectIdentifier: {
15002
+ srOnlyAriaLabel: 'Object Identifier'
14931
15003
  }
14932
15004
  };
14933
15005
 
@@ -15553,6 +15625,9 @@ var json$b = {
15553
15625
  segmentedButton: {
15554
15626
  groupRoleDescription: 'Grupa przycisków podzielonych na segmenty',
15555
15627
  buttonRoleDescription: 'Przycisk podzielony na segmenty'
15628
+ },
15629
+ coreObjectIdentifier: {
15630
+ srOnlyAriaLabel: 'Object Identifier'
15556
15631
  }
15557
15632
  };
15558
15633
 
@@ -16178,6 +16253,9 @@ var json$a = {
16178
16253
  segmentedButton: {
16179
16254
  groupRoleDescription: 'Grupo de botões segmentados',
16180
16255
  buttonRoleDescription: 'Botão segmentado'
16256
+ },
16257
+ coreObjectIdentifier: {
16258
+ srOnlyAriaLabel: 'Object Identifier'
16181
16259
  }
16182
16260
  };
16183
16261
 
@@ -16803,6 +16881,9 @@ var json$9 = {
16803
16881
  segmentedButton: {
16804
16882
  groupRoleDescription: 'Grup de butoane segmentate',
16805
16883
  buttonRoleDescription: 'Buton segmentat'
16884
+ },
16885
+ coreObjectIdentifier: {
16886
+ srOnlyAriaLabel: 'Object Identifier'
16806
16887
  }
16807
16888
  };
16808
16889
 
@@ -17428,6 +17509,9 @@ var json$8 = {
17428
17509
  segmentedButton: {
17429
17510
  groupRoleDescription: 'Группа сегментированных кнопок',
17430
17511
  buttonRoleDescription: 'Сегментированная кнопка'
17512
+ },
17513
+ coreObjectIdentifier: {
17514
+ srOnlyAriaLabel: 'Object Identifier'
17431
17515
  }
17432
17516
  };
17433
17517
 
@@ -18053,6 +18137,9 @@ var json$7 = {
18053
18137
  segmentedButton: {
18054
18138
  groupRoleDescription: 'Grupa segmentirane dugmadi',
18055
18139
  buttonRoleDescription: 'Segmentirano dugme'
18140
+ },
18141
+ coreObjectIdentifier: {
18142
+ srOnlyAriaLabel: 'Object Identifier'
18056
18143
  }
18057
18144
  };
18058
18145
 
@@ -18678,6 +18765,9 @@ var json$6 = {
18678
18765
  segmentedButton: {
18679
18766
  groupRoleDescription: 'Skupina segmentovaných tlačidiel',
18680
18767
  buttonRoleDescription: 'Segmentované tlačidlo'
18768
+ },
18769
+ coreObjectIdentifier: {
18770
+ srOnlyAriaLabel: 'Object Identifier'
18681
18771
  }
18682
18772
  };
18683
18773
 
@@ -19303,6 +19393,9 @@ var json$5 = {
19303
19393
  segmentedButton: {
19304
19394
  groupRoleDescription: 'Skupina segmentiranih gumbov',
19305
19395
  buttonRoleDescription: 'Segmentirani gumb'
19396
+ },
19397
+ coreObjectIdentifier: {
19398
+ srOnlyAriaLabel: 'Object Identifier'
19306
19399
  }
19307
19400
  };
19308
19401
 
@@ -19928,6 +20021,9 @@ var json$4 = {
19928
20021
  segmentedButton: {
19929
20022
  groupRoleDescription: 'Grupo de botones segmentados',
19930
20023
  buttonRoleDescription: 'Botón segmentado'
20024
+ },
20025
+ coreObjectIdentifier: {
20026
+ srOnlyAriaLabel: 'Object Identifier'
19931
20027
  }
19932
20028
  };
19933
20029
 
@@ -20553,6 +20649,9 @@ var json$3 = {
20553
20649
  segmentedButton: {
20554
20650
  groupRoleDescription: 'Segmenterad knappgrupp',
20555
20651
  buttonRoleDescription: 'Segmenterad knapp'
20652
+ },
20653
+ coreObjectIdentifier: {
20654
+ srOnlyAriaLabel: 'Object Identifier'
20556
20655
  }
20557
20656
  };
20558
20657
 
@@ -21178,6 +21277,9 @@ var json$2 = {
21178
21277
  segmentedButton: {
21179
21278
  groupRoleDescription: 'กลุ่มปุ่มที่แบ่งเซกเมนต์',
21180
21279
  buttonRoleDescription: 'ปุ่มที่แบ่งเซกเมนต์'
21280
+ },
21281
+ coreObjectIdentifier: {
21282
+ srOnlyAriaLabel: 'Object Identifier'
21181
21283
  }
21182
21284
  };
21183
21285
 
@@ -21803,6 +21905,9 @@ var json$1 = {
21803
21905
  segmentedButton: {
21804
21906
  groupRoleDescription: 'Segmentlere Ayrılmış Düğme Grubu',
21805
21907
  buttonRoleDescription: 'Segmentlere Ayrılmış Düğme'
21908
+ },
21909
+ coreObjectIdentifier: {
21910
+ srOnlyAriaLabel: 'Object Identifier'
21806
21911
  }
21807
21912
  };
21808
21913
 
@@ -22428,6 +22533,9 @@ var json = {
22428
22533
  segmentedButton: {
22429
22534
  groupRoleDescription: 'Група сегментованих кнопок',
22430
22535
  buttonRoleDescription: 'Сегментована кнопка'
22536
+ },
22537
+ coreObjectIdentifier: {
22538
+ srOnlyAriaLabel: 'Object Identifier'
22431
22539
  }
22432
22540
  };
22433
22541
 
@@ -22889,6 +22997,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.1.4", ngImpor
22889
22997
  }]
22890
22998
  }], ctorParameters: () => [{ type: i0.DestroyRef }, { type: i0.ChangeDetectorRef }] });
22891
22999
 
23000
+ /**
23001
+ * @deprecated
23002
+ * Use direct imports of components and directives.
23003
+ */
22892
23004
  class I18nModule {
22893
23005
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.1.4", ngImport: i0, type: I18nModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule }); }
22894
23006
  static { this.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "20.1.4", ngImport: i0, type: I18nModule, imports: [FdTranslatePipe, FdPatchLanguageDirective], exports: [FdTranslatePipe, FdPatchLanguageDirective] }); }