fix(i18n): normalize translations and fallbacks
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../l10n/gen/app_localizations.dart';
|
||||
import '../modelos/preset_ecualizador.dart';
|
||||
import '../tema/pluriwave_theme.dart';
|
||||
import 'pluri_glass_surface.dart';
|
||||
@@ -41,6 +42,7 @@ class _EcualizadorWidgetState extends State<EcualizadorWidget> {
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final tokens = context.pluriTokens;
|
||||
final l10n = AppLocalizations.of(context);
|
||||
|
||||
return PluriGlassSurface(
|
||||
borderRadius: BorderRadius.circular(tokens.radiusLg),
|
||||
@@ -50,10 +52,10 @@ class _EcualizadorWidgetState extends State<EcualizadorWidget> {
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Text('Ecualizador', style: theme.textTheme.titleMedium?.copyWith(fontWeight: FontWeight.w700)),
|
||||
Text(l10n.equalizerTitle, style: theme.textTheme.titleMedium?.copyWith(fontWeight: FontWeight.w700)),
|
||||
const Spacer(),
|
||||
Chip(
|
||||
label: Text(widget.preset.nombre, style: theme.textTheme.labelMedium),
|
||||
label: Text(_nombrePreset(l10n, widget.preset.nombre), style: theme.textTheme.labelMedium),
|
||||
backgroundColor: theme.colorScheme.secondaryContainer.withValues(alpha: 0.75),
|
||||
),
|
||||
],
|
||||
@@ -77,8 +79,8 @@ class _EcualizadorWidgetState extends State<EcualizadorWidget> {
|
||||
height: 152,
|
||||
child: Semantics(
|
||||
slider: true,
|
||||
label: 'Banda ${_etiquetas[i]}',
|
||||
value: '${_bandas[i].toStringAsFixed(1)} decibelios',
|
||||
label: l10n.equalizerBandLabel(_etiquetas[i]),
|
||||
value: l10n.equalizerBandValue(_bandas[i].toStringAsFixed(1)),
|
||||
child: RotatedBox(
|
||||
quarterTurns: 3,
|
||||
child: Slider(
|
||||
@@ -110,6 +112,19 @@ class _EcualizadorWidgetState extends State<EcualizadorWidget> {
|
||||
}
|
||||
}
|
||||
|
||||
String _nombrePreset(AppLocalizations l10n, String nombre) {
|
||||
return switch (nombre) {
|
||||
'Flat' => l10n.equalizerPresetFlat,
|
||||
'Rock' => l10n.equalizerPresetRock,
|
||||
'Pop' => l10n.equalizerPresetPop,
|
||||
'Bass Boost' => l10n.equalizerPresetBassBoost,
|
||||
'Jazz' => l10n.equalizerPresetJazz,
|
||||
'Voz' => l10n.equalizerPresetVoice,
|
||||
'Personalizado' => l10n.equalizerPresetCustom,
|
||||
_ => nombre,
|
||||
};
|
||||
}
|
||||
|
||||
class PresetsEcualizadorWidget extends StatelessWidget {
|
||||
final PresetEcualizador presetActual;
|
||||
final void Function(PresetEcualizador) onSeleccionar;
|
||||
@@ -123,13 +138,14 @@ class PresetsEcualizadorWidget extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
final l10n = AppLocalizations.of(context);
|
||||
return Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 6,
|
||||
children: PresetEcualizador.presets.map((p) {
|
||||
final selected = p.nombre == presetActual.nombre;
|
||||
return ChoiceChip(
|
||||
label: Text(p.nombre),
|
||||
label: Text(_nombrePreset(l10n, p.nombre)),
|
||||
selected: selected,
|
||||
showCheckmark: false,
|
||||
selectedColor: theme.colorScheme.primaryContainer,
|
||||
|
||||
Reference in New Issue
Block a user