feat(i18n): load every extension's own namespace + facade lookup (T-462)
Foundation for routing hardcoded UI labels through the catalog (D-21). Two enablers: - ExtensionManager now eagerly loads each activated extension's own-id catalog namespace, not just the namespaces of localized tabs. An extension's id IS its catalog namespace (ClideExtension.t), so labels resolve through the catalog even for extensions that contribute no tab; a missing catalog file loads as an empty map, so it's harmless. - ClideSettings.i18n gains string()/interpolated() lookups so widget call sites route through the one D-101 facade (like theme/fonts) instead of each re-deriving ClideKernel.of(context).i18n. No user-visible change yet — placeholders equal the en_US catalog values; the per-extension label migrations follow. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -65,6 +65,28 @@ void main() {
|
||||
expect(f.services.extensions.isActivated('needs-missing'), false);
|
||||
});
|
||||
|
||||
test('activating an extension loads its own-id i18n namespace (T-462)', () async {
|
||||
final f2 = await KernelFixture.create(
|
||||
// Nothing preloaded — so resolution proves activation did the loading.
|
||||
preloadNamespaces: const [],
|
||||
i18nCatalogs: {
|
||||
'test.has-catalog': {
|
||||
const Locale('en', 'US'): const {
|
||||
'greeting': {'translation': 'Hej'},
|
||||
},
|
||||
},
|
||||
},
|
||||
);
|
||||
addTearDown(f2.dispose);
|
||||
// Not loaded yet → the inline placeholder.
|
||||
expect(f2.services.i18n.string('greeting', namespace: 'test.has-catalog', placeholder: 'PH'), 'PH');
|
||||
f2.services.extensions.register(_Ext(id: 'test.has-catalog'));
|
||||
await f2.services.extensions.activateAll();
|
||||
// Activation loads the extension's own namespace → catalog value resolves
|
||||
// even though it contributes no localized tab.
|
||||
expect(f2.services.i18n.string('greeting', namespace: 'test.has-catalog', placeholder: 'PH'), 'Hej');
|
||||
});
|
||||
|
||||
test('contribution points wire into panel registry on activate', () async {
|
||||
f.services.extensions.register(
|
||||
_Ext(
|
||||
|
||||
Reference in New Issue
Block a user