fix(store,l10n): localize canonical category labels + store segment

The grouped store showed the hub's English category labels verbatim
(Documents, Data & Formats) even in German. Map the canonical slug to
DE/EN via l10n (storeCat*), and localize the Modules/Studio segment
(storeSegment*). Falls back to the hub label for an unknown slug.

Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
This commit is contained in:
flemming-it 2026-07-09 18:17:50 +02:00
parent 4b30589962
commit 0fda2600ad
6 changed files with 191 additions and 7 deletions

View file

@ -367,16 +367,18 @@ class _StorePageState extends State<StorePage> {
padding:
const EdgeInsets.only(bottom: ChainSpace.md),
child: SegmentedButton<bool>(
segments: const [
segments: [
ButtonSegment(
value: false,
label: Text('Module'),
icon: Icon(Icons.extension_outlined, size: 16),
label: Text(l.storeSegmentModules),
icon: const Icon(Icons.extension_outlined,
size: 16),
),
ButtonSegment(
value: true,
label: Text('Studio & Themes'),
icon: Icon(Icons.palette_outlined, size: 16),
label: Text(l.storeSegmentStudio),
icon:
const Icon(Icons.palette_outlined, size: 16),
),
],
selected: {_showStudio},
@ -799,6 +801,34 @@ String _sourceForItem(StoreItem i) {
/// data model only the display side gets localised. Unknown
/// ids fall through unchanged so newly-added categories don't
/// vanish until we update this map.
/// Localized label for a canonical category slug (from the hub). Falls
/// back to the hub's English label / raw category for an unknown slug.
String _canonicalCatLabel(BuildContext ctx, String slug, String fallback) {
final l = AppLocalizations.of(ctx)!;
switch (slug) {
case 'documents':
return l.storeCatDocuments;
case 'text-language':
return l.storeCatTextLanguage;
case 'data':
return l.storeCatData;
case 'ai-llm':
return l.storeCatAiLlm;
case 'web-api':
return l.storeCatWebApi;
case 'analysis-domain':
return l.storeCatAnalysisDomain;
case 'studio-themes':
return l.storeCatStudioThemes;
case 'examples-dev':
return l.storeCatExamplesDev;
case 'other':
return l.storeCatOther;
default:
return fallback.isNotEmpty ? fallback : slug;
}
}
String _categoryDisplayName(BuildContext ctx, String wire) {
final l = AppLocalizations.of(ctx)!;
switch (wire) {
@ -1651,7 +1681,7 @@ class _StoreGrid extends StatelessWidget {
child: Row(
children: [
Text(
labels[slug] ?? slug,
_canonicalCatLabel(context, slug, labels[slug] ?? ''),
style: Theme.of(context)
.textTheme
.titleSmall