Add localization support for search and alarm features in multiple languages
- Updated Japanese, Portuguese, Russian, and Chinese localization files with new strings for search and alarm functionalities. - Enhanced the search screen with localized titles, subtitles, and filter labels. - Integrated localization into the alarm screen, including actions and messages related to alarm management. - Refactored country and language lists to use localized keys for better maintainability. - Improved user experience by providing localized hints and messages throughout the application.
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:just_audio/just_audio.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../estado/estado_alarmas.dart';
|
||||
import '../l10n/gen/app_localizations.dart';
|
||||
import '../estado/estado_radio.dart';
|
||||
import '../modelos/alarma_musical.dart';
|
||||
import '../servicios/servicio_audio.dart';
|
||||
@@ -152,6 +153,7 @@ class _PantallaAlarmaSonandoState extends State<PantallaAlarmaSonando> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final alarma = widget.alarma;
|
||||
final l10n = AppLocalizations.of(context);
|
||||
return Scaffold(
|
||||
backgroundColor: const Color(0xFF061722),
|
||||
body: SafeArea(
|
||||
@@ -197,7 +199,7 @@ class _PantallaAlarmaSonandoState extends State<PantallaAlarmaSonando> {
|
||||
FilledButton.icon(
|
||||
onPressed: _detener,
|
||||
icon: const Icon(Icons.stop_rounded),
|
||||
label: const Text('Detener alarma'),
|
||||
label: Text(l10n.stopAlarmAction),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter_animate/flutter_animate.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
import '../estado/estado_radio.dart';
|
||||
import '../l10n/gen/app_localizations.dart';
|
||||
import '../widgets/pluri_glass_surface.dart';
|
||||
import '../widgets/pluri_icon.dart';
|
||||
import '../widgets/pluri_layout.dart';
|
||||
@@ -12,28 +13,28 @@ import 'package:pluriwave/widgets/tarjeta_emisora.dart';
|
||||
import 'reproducir_minimizado.dart';
|
||||
|
||||
const _paises = [
|
||||
('Espana', 'ES'),
|
||||
('USA', 'US'),
|
||||
('Mexico', 'MX'),
|
||||
('Argentina', 'AR'),
|
||||
('UK', 'GB'),
|
||||
('Francia', 'FR'),
|
||||
('Alemania', 'DE'),
|
||||
('Italia', 'IT'),
|
||||
('Brasil', 'BR'),
|
||||
('Japon', 'JP'),
|
||||
('countrySpain', 'ES'),
|
||||
('countryUsa', 'US'),
|
||||
('countryMexico', 'MX'),
|
||||
('countryArgentina', 'AR'),
|
||||
('countryUk', 'GB'),
|
||||
('countryFrance', 'FR'),
|
||||
('countryGermany', 'DE'),
|
||||
('countryItaly', 'IT'),
|
||||
('countryBrazil', 'BR'),
|
||||
('countryJapan', 'JP'),
|
||||
];
|
||||
|
||||
const _idiomas = [
|
||||
'spanish',
|
||||
'english',
|
||||
'french',
|
||||
'german',
|
||||
'portuguese',
|
||||
'italian',
|
||||
'japanese',
|
||||
'arabic',
|
||||
'russian',
|
||||
('spanish', 'languageNameSpanish'),
|
||||
('english', 'languageNameEnglish'),
|
||||
('french', 'languageNameFrench'),
|
||||
('german', 'languageNameGerman'),
|
||||
('portuguese', 'languageNamePortuguese'),
|
||||
('italian', 'languageNameItalian'),
|
||||
('japanese', 'languageNameJapanese'),
|
||||
('arabic', 'languageNameArabic'),
|
||||
('russian', 'languageNameRussian'),
|
||||
];
|
||||
|
||||
class PantallaBuscar extends StatefulWidget {
|
||||
@@ -69,17 +70,18 @@ class _PantallaBuscarState extends State<PantallaBuscar> {
|
||||
Widget build(BuildContext context) {
|
||||
final estado = context.watch<EstadoRadio>();
|
||||
final theme = Theme.of(context);
|
||||
final l10n = AppLocalizations.of(context);
|
||||
|
||||
return ListView(
|
||||
padding: PluriLayout.pageListPadding,
|
||||
children: [
|
||||
PluriScreenHeader(
|
||||
title: 'Buscar senal',
|
||||
subtitle: 'Encontra radios por nombre, pais o idioma con filtros rapidos y alto contraste.',
|
||||
title: l10n.searchScreenTitle,
|
||||
subtitle: l10n.searchScreenSubtitle,
|
||||
glyph: PluriIconGlyph.search,
|
||||
trailing: const PluriStatusPill(
|
||||
trailing: PluriStatusPill(
|
||||
icon: Icons.tune_rounded,
|
||||
label: 'Filtros',
|
||||
label: l10n.searchFiltersLabel,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
@@ -89,7 +91,7 @@ class _PantallaBuscarState extends State<PantallaBuscar> {
|
||||
borderRadius: BorderRadius.circular(999),
|
||||
child: SearchBar(
|
||||
controller: _controller,
|
||||
hintText: 'Radio Horizonte, jazz, noticias...',
|
||||
hintText: l10n.searchHint,
|
||||
leading: const PluriIcon(
|
||||
glyph: PluriIconGlyph.search,
|
||||
variant: PluriIconVariant.filled,
|
||||
@@ -111,8 +113,8 @@ class _PantallaBuscarState extends State<PantallaBuscar> {
|
||||
),
|
||||
),
|
||||
_seccionFiltro(
|
||||
'Pais',
|
||||
_paises.map((p) => (p.$1, p.$2)).toList(),
|
||||
l10n.searchCountryFilterLabel,
|
||||
_paises.map((p) => (_countryLabel(l10n, p.$1), p.$2)).toList(),
|
||||
_paisSeleccionado,
|
||||
(v) {
|
||||
setState(() => _paisSeleccionado = v);
|
||||
@@ -120,8 +122,8 @@ class _PantallaBuscarState extends State<PantallaBuscar> {
|
||||
},
|
||||
),
|
||||
_seccionFiltro(
|
||||
'Idioma',
|
||||
_idiomas.map((i) => (i, i)).toList(),
|
||||
l10n.searchLanguageFilterLabel,
|
||||
_idiomas.map((i) => (_languageLabel(l10n, i.$2), i.$1)).toList(),
|
||||
_idiomaSeleccionado,
|
||||
(v) {
|
||||
setState(() => _idiomaSeleccionado = v);
|
||||
@@ -129,7 +131,7 @@ class _PantallaBuscarState extends State<PantallaBuscar> {
|
||||
},
|
||||
),
|
||||
_seccionFiltroInt(
|
||||
'Calidad m?nima',
|
||||
l10n.searchMinQualityFilterLabel,
|
||||
const [('64 kbps', 64), ('96 kbps', 96), ('128 kbps', 128), ('192 kbps', 192), ('320 kbps', 320)],
|
||||
_calidadMinima,
|
||||
(v) {
|
||||
@@ -234,6 +236,7 @@ class _PantallaBuscarState extends State<PantallaBuscar> {
|
||||
}
|
||||
|
||||
Widget _resultados(EstadoRadio estado, ThemeData theme) {
|
||||
final l10n = AppLocalizations.of(context);
|
||||
if (estado.cargandoBusqueda) {
|
||||
return const SizedBox(
|
||||
height: 220,
|
||||
@@ -252,10 +255,12 @@ class _PantallaBuscarState extends State<PantallaBuscar> {
|
||||
height: 260,
|
||||
child: PluriEmptyState(
|
||||
glyph: PluriIconGlyph.search,
|
||||
title: sinFiltros ? 'Busca una emisora' : 'Sin resultados',
|
||||
subtitle: sinFiltros
|
||||
? 'Usa la barra superior o los chips para descubrir senales de todo el mundo.'
|
||||
: 'Proba quitar filtros o escribir otro nombre para encontrar una senal activa.',
|
||||
title:
|
||||
sinFiltros ? l10n.searchEmptyTitle : l10n.searchNoResultsTitle,
|
||||
subtitle:
|
||||
sinFiltros
|
||||
? l10n.searchEmptySubtitle
|
||||
: l10n.searchNoResultsSubtitle,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -288,4 +293,31 @@ class _PantallaBuscarState extends State<PantallaBuscar> {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
String _countryLabel(AppLocalizations l10n, String key) => switch (key) {
|
||||
'countrySpain' => l10n.countrySpain,
|
||||
'countryUsa' => l10n.countryUsa,
|
||||
'countryMexico' => l10n.countryMexico,
|
||||
'countryArgentina' => l10n.countryArgentina,
|
||||
'countryUk' => l10n.countryUk,
|
||||
'countryFrance' => l10n.countryFrance,
|
||||
'countryGermany' => l10n.countryGermany,
|
||||
'countryItaly' => l10n.countryItaly,
|
||||
'countryBrazil' => l10n.countryBrazil,
|
||||
'countryJapan' => l10n.countryJapan,
|
||||
_ => key,
|
||||
};
|
||||
|
||||
String _languageLabel(AppLocalizations l10n, String key) => switch (key) {
|
||||
'languageNameSpanish' => l10n.languageNameSpanish,
|
||||
'languageNameEnglish' => l10n.languageNameEnglish,
|
||||
'languageNameFrench' => l10n.languageNameFrench,
|
||||
'languageNameGerman' => l10n.languageNameGerman,
|
||||
'languageNamePortuguese' => l10n.languageNamePortuguese,
|
||||
'languageNameItalian' => l10n.languageNameItalian,
|
||||
'languageNameJapanese' => l10n.languageNameJapanese,
|
||||
'languageNameArabic' => l10n.languageNameArabic,
|
||||
'languageNameRussian' => l10n.languageNameRussian,
|
||||
_ => key,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user