fix(i18n): normalize translations and fallbacks
This commit is contained in:
@@ -4,7 +4,6 @@ import 'package:provider/provider.dart';
|
||||
import 'package:shimmer/shimmer.dart' as shimmer;
|
||||
|
||||
import '../estado/estado_radio.dart';
|
||||
import '../l10n/app_localizations_ext.dart';
|
||||
import '../l10n/gen/app_localizations.dart';
|
||||
import '../widgets/pluri_glass_surface.dart';
|
||||
import '../widgets/pluri_icon.dart';
|
||||
@@ -56,7 +55,12 @@ class _PantallaInicioState extends State<PantallaInicio> {
|
||||
if (estado.error != null)
|
||||
SliverToBoxAdapter(child: _errorBanner(estado, theme, l10n)),
|
||||
SliverPadding(
|
||||
padding: const EdgeInsets.fromLTRB(PluriLayout.horizontal, 0, PluriLayout.horizontal, PluriLayout.bottomChromeInset),
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
PluriLayout.horizontal,
|
||||
0,
|
||||
PluriLayout.horizontal,
|
||||
PluriLayout.bottomChromeInset,
|
||||
),
|
||||
sliver: _gridEmisoras(estado, l10n),
|
||||
),
|
||||
],
|
||||
@@ -80,14 +84,11 @@ class _PantallaInicioState extends State<PantallaInicio> {
|
||||
children: [
|
||||
PluriStatusPill(
|
||||
icon: Icons.public_rounded,
|
||||
label: l10n.homeStationsCount(estado.emisorasInicio.length),
|
||||
label: l10n.stationsCount(estado.emisorasInicio.length),
|
||||
accent: Theme.of(context).colorScheme.secondary,
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
PluriStatusPill(
|
||||
icon: Icons.hd_rounded,
|
||||
label: l10n.qualityHd,
|
||||
),
|
||||
PluriStatusPill(icon: Icons.hd_rounded, label: l10n.qualityHd),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -100,7 +101,12 @@ class _PantallaInicioState extends State<PantallaInicio> {
|
||||
) {
|
||||
final pais = estado.paisCercanoDetectado;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(PluriLayout.horizontal, 8, PluriLayout.horizontal, 0),
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
PluriLayout.horizontal,
|
||||
8,
|
||||
PluriLayout.horizontal,
|
||||
0,
|
||||
),
|
||||
child: PluriGlassSurface(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
@@ -117,16 +123,18 @@ class _PantallaInicioState extends State<PantallaInicio> {
|
||||
),
|
||||
),
|
||||
TextButton.icon(
|
||||
onPressed: estado.cargandoCercanas
|
||||
? null
|
||||
: estado.cargarEmisorasCercanas,
|
||||
icon: estado.cargandoCercanas
|
||||
? const SizedBox(
|
||||
width: 16,
|
||||
height: 16,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
)
|
||||
: const Icon(Icons.my_location_rounded, size: 18),
|
||||
onPressed:
|
||||
estado.cargandoCercanas
|
||||
? null
|
||||
: estado.cargarEmisorasCercanas,
|
||||
icon:
|
||||
estado.cargandoCercanas
|
||||
? const SizedBox(
|
||||
width: 16,
|
||||
height: 16,
|
||||
child: CircularProgressIndicator(strokeWidth: 2),
|
||||
)
|
||||
: const Icon(Icons.my_location_rounded, size: 18),
|
||||
label: Text(l10n.detectAction),
|
||||
),
|
||||
],
|
||||
@@ -172,7 +180,12 @@ class _PantallaInicioState extends State<PantallaInicio> {
|
||||
AppLocalizations l10n,
|
||||
) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(PluriLayout.horizontal, 8, PluriLayout.horizontal, 0),
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
PluriLayout.horizontal,
|
||||
8,
|
||||
PluriLayout.horizontal,
|
||||
0,
|
||||
),
|
||||
child: PluriGlassSurface(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
@@ -202,8 +215,7 @@ class _PantallaInicioState extends State<PantallaInicio> {
|
||||
size: 18,
|
||||
),
|
||||
label: Text(e.nombre, maxLines: 1),
|
||||
onPressed:
|
||||
() => reproducirMinimizado(context, e),
|
||||
onPressed: () => reproducirMinimizado(context, e),
|
||||
).animate().fadeIn(delay: (i * 50).ms);
|
||||
},
|
||||
),
|
||||
@@ -220,7 +232,12 @@ class _PantallaInicioState extends State<PantallaInicio> {
|
||||
AppLocalizations l10n,
|
||||
) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.fromLTRB(PluriLayout.horizontal, 16, PluriLayout.horizontal, 8),
|
||||
padding: const EdgeInsets.fromLTRB(
|
||||
PluriLayout.horizontal,
|
||||
16,
|
||||
PluriLayout.horizontal,
|
||||
8,
|
||||
),
|
||||
child: PluriGlassSurface(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
@@ -235,7 +252,7 @@ class _PantallaInicioState extends State<PantallaInicio> {
|
||||
_generos.map((g) {
|
||||
final seleccionado = _generoSeleccionado == g;
|
||||
return FilterChip(
|
||||
label: Text(l10n.genreName(g)),
|
||||
label: Text(_genreName(l10n, g)),
|
||||
selected: seleccionado,
|
||||
onSelected: (_) {
|
||||
setState(() {
|
||||
@@ -332,6 +349,21 @@ class _PantallaInicioState extends State<PantallaInicio> {
|
||||
}
|
||||
}
|
||||
|
||||
String _genreName(AppLocalizations l10n, String tag) => switch (tag) {
|
||||
'pop' => l10n.genrePop,
|
||||
'rock' => l10n.genreRock,
|
||||
'jazz' => l10n.genreJazz,
|
||||
'classical' => l10n.genreClassical,
|
||||
'electronic' => l10n.genreElectronic,
|
||||
'news' => l10n.genreNews,
|
||||
'talk' => l10n.genreTalk,
|
||||
'hip-hop' => l10n.genreHipHop,
|
||||
'country' => l10n.genreCountry,
|
||||
'metal' => l10n.genreMetal,
|
||||
'reggae' => l10n.genreReggae,
|
||||
'latin' => l10n.genreLatin,
|
||||
_ => tag,
|
||||
};
|
||||
|
||||
class _ChipShimmer extends StatelessWidget {
|
||||
final ThemeData theme;
|
||||
|
||||
Reference in New Issue
Block a user