Commit b9381cf
committed
feat(core): implement hierarchical translation services with parent-child lookup
BREAKING CHANGE: TranslateModule.forRoot() and forChild() are removed.
Use provideTranslateService() and provideChildTranslateService() instead.
- Add parent-child service hierarchy with translation lookup bubbling
- provideTranslateService() creates isolated root services (isRoot=true)
- provideChildTranslateService() creates connected children that:
- Delegate lang/fallbackLang to root
- Load own translations via provided loader
- Fall back to parent when translation not found
- MissingTranslationHandler resolution bubbles up hierarchy
- Simplify TranslateStore to only manage translations
- Move lang/fallback state management to TranslateService
- Replace `extend` config with clearer `isRoot` semantic
Migration:
- TranslateModule.forRoot() → provideTranslateService()
- TranslateModule.forChild({ extend: true }) → provideChildTranslateService()
- TranslateModule.forChild({ isolate: true }) → provideTranslateService()1 parent 3972d56 commit b9381cf
File tree
12 files changed
+709
-272
lines changed- docs
- projects/ngx-translate/src
- lib
- tests
12 files changed
+709
-272
lines changedLarge diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
| 35 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
| 24 | + | |
27 | 25 | | |
28 | 26 | | |
29 | 27 | | |
30 | 28 | | |
| 29 | + | |
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
| |||
63 | 62 | | |
64 | 63 | | |
65 | 64 | | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
72 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
73 | 85 | | |
74 | 86 | | |
75 | 87 | | |
| |||
108 | 120 | | |
109 | 121 | | |
110 | 122 | | |
111 | | - | |
| 123 | + | |
112 | 124 | | |
113 | 125 | | |
114 | 126 | | |
| |||
119 | 131 | | |
120 | 132 | | |
121 | 133 | | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | 134 | | |
131 | 135 | | |
132 | 136 | | |
| |||
0 commit comments