A cross platform Audiobookshelf client for Android and iOS
Dart
Localize chapter sleep timer strings
Barnabas38cf61fb753b
diff --git a/lib/l10n/app_de.arb b/lib/l10n/app_de.arbindex a513d7c8..cba4ee1e 100644--- a/lib/l10n/app_de.arb+++ b/lib/l10n/app_de.arb@@ -1442,6 +1442,22 @@"sleepTimerSheetAddsOneChapter": "Fügt 1 Kapitel hinzu","sleepTimerSheetResetsToFull": "Setzt auf volle Dauer zurück",+ "sleepTimerSheetTabSpecificChapter": "Kapitel",+ "sleepTimerSheetSpecificNoChapters": "Keine Kapitel verfügbar",+ "sleepTimerSheetSpecificChapterFallback": "Kapitel {number}",+ "@sleepTimerSheetSpecificChapterFallback": { "placeholders": { "number": { "type": "int" } } },+ "sleepTimerSheetSpecificPassedShort": "vorbei",+ "sleepTimerSheetSpecificStart": "Kapitelanfang",+ "sleepTimerSheetSpecificEnd": "Kapitelende",+ "sleepTimerSheetSpecificEndsAt": "Sleep-Timer endet um",+ "sleepTimerSheetSpecificCountdown": "in {countdown}",+ "@sleepTimerSheetSpecificCountdown": { "placeholders": { "countdown": { "type": "String" } } },+ "sleepTimerSheetSpecificAlreadyPassed": "Dieser Zeitpunkt ist bereits vorbei",+ "sleepTimerSheetSpecificStartButton": "Timer starten",+ "sleepTimerSheetSpecificStartButtonPassed": "Bereits vorbei",+ "timeAm": "AM",+ "timePm": "PM",+"collectionPickerCollectionFallback": "Sammlung","collectionPickerNameWithCount": "{name} ({count})","@collectionPickerNameWithCount": { "placeholders": { "name": { "type": "String" }, "count": { "type": "int" } } },diff --git a/lib/l10n/app_en.arb b/lib/l10n/app_en.arbindex e436d141..b4954340 100644--- a/lib/l10n/app_en.arb+++ b/lib/l10n/app_en.arb@@ -1443,6 +1443,22 @@"sleepTimerSheetAddsOneChapter": "Adds 1 chapter","sleepTimerSheetResetsToFull": "Resets to full duration",+ "sleepTimerSheetTabSpecificChapter": "Chapter",+ "sleepTimerSheetSpecificNoChapters": "No chapters available",+ "sleepTimerSheetSpecificChapterFallback": "Chapter {number}",+ "@sleepTimerSheetSpecificChapterFallback": { "placeholders": { "number": { "type": "int" } } },+ "sleepTimerSheetSpecificPassedShort": "passed",+ "sleepTimerSheetSpecificStart": "Chapter Start",+ "sleepTimerSheetSpecificEnd": "Chapter End",+ "sleepTimerSheetSpecificEndsAt": "Sleep timer will end at",+ "sleepTimerSheetSpecificCountdown": "in {countdown}",+ "@sleepTimerSheetSpecificCountdown": { "placeholders": { "countdown": { "type": "String" } } },+ "sleepTimerSheetSpecificAlreadyPassed": "This point has already passed",+ "sleepTimerSheetSpecificStartButton": "Start timer",+ "sleepTimerSheetSpecificStartButtonPassed": "Already passed",+ "timeAm": "AM",+ "timePm": "PM",+"collectionPickerCollectionFallback": "Collection","collectionPickerNameWithCount": "{name} ({count})","@collectionPickerNameWithCount": { "placeholders": { "name": { "type": "String" }, "count": { "type": "int" } } },diff --git a/lib/l10n/app_zh.arb b/lib/l10n/app_zh.arbindex 42001cd3..4c7f64a9 100644--- a/lib/l10n/app_zh.arb+++ b/lib/l10n/app_zh.arb@@ -805,5 +805,21 @@"tipsRestored": "已恢复提示","resetSpeedPresets": "重置速度预设","resetSpeedPresetsSubtitle": "恢复默认的播放速度选项",- "speedPresetsReset": "速度预设已重置"+ "speedPresetsReset": "速度预设已重置",++ "sleepTimerSheetTabSpecificChapter": "章节",+ "sleepTimerSheetSpecificNoChapters": "没有可用的章节",+ "sleepTimerSheetSpecificChapterFallback": "第 {number} 章",+ "@sleepTimerSheetSpecificChapterFallback": { "placeholders": { "number": { "type": "int" } } },+ "sleepTimerSheetSpecificPassedShort": "已过",+ "sleepTimerSheetSpecificStart": "章节开始",+ "sleepTimerSheetSpecificEnd": "章节结束",+ "sleepTimerSheetSpecificEndsAt": "睡眠定时器将于",+ "sleepTimerSheetSpecificCountdown": "{countdown} 后",+ "@sleepTimerSheetSpecificCountdown": { "placeholders": { "countdown": { "type": "String" } } },+ "sleepTimerSheetSpecificAlreadyPassed": "此时间点已过",+ "sleepTimerSheetSpecificStartButton": "启动定时器",+ "sleepTimerSheetSpecificStartButtonPassed": "已过",+ "timeAm": "上午",+ "timePm": "下午"}diff --git a/lib/widgets/sleep_timer_sheet.dart b/lib/widgets/sleep_timer_sheet.dartindex 7a6c3fe7..c804dd3f 100644--- a/lib/widgets/sleep_timer_sheet.dart+++ b/lib/widgets/sleep_timer_sheet.dart@@ -127,7 +127,7 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {_tab(l.endOfChapter, Icons.auto_stories_outlined, 1, accent),const SizedBox(width: 4),- _tab('Chapter', Icons.bookmark_outlined, 2, accent),+ _tab(l.sleepTimerSheetTabSpecificChapter, Icons.bookmark_outlined, 2, accent),]),),const SizedBox(height: 20),@@ -276,7 +276,7 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {if (chapters.isEmpty) {return Center(- child: Text('No chapters available',+ child: Text(l.sleepTimerSheetSpecificNoChapters,style: TextStyle(color: cs.onSurfaceVariant, fontSize: 13)),);}@@ -313,7 +313,7 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {dropdownColor: Theme.of(context).bottomSheetTheme.backgroundColor,items: chapters.asMap().entries.map((e) {final ch = e.value as Map<String, dynamic>;- final title = ch['title'] as String? ?? 'Chapter ${e.key + 1}';+ final title = ch['title'] as String? ?? l.sleepTimerSheetSpecificChapterFallback(e.key + 1);final endSec = (ch['end'] as num?)?.toDouble() ?? 0;final currentPosSec = player.position.inMilliseconds / 1000.0;final secondsUntil = (endSec - currentPosSec) / player.speed;@@ -323,7 +323,7 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {);final timeLabel =- secondsUntil > 0 ? _formatWallClock(endTime) : 'passed';+ secondsUntil > 0 ? _formatWallClock(endTime) : l.sleepTimerSheetSpecificPassedShort;return DropdownMenuItem(value: e.key,@@ -363,8 +363,8 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {child: SegmentedButton<bool>(showSelectedIcon: false,segments: const [- ButtonSegment(value: false, label: Text('Chapter Start')),- ButtonSegment(value: true, label: Text('Chapter End')),+ ButtonSegment(value: false, label: Text(l.sleepTimerSheetSpecificStart)),+ ButtonSegment(value: true, label: Text(l.sleepTimerSheetSpecificEnd)),],selected: {_useChapterEnd},style: const ButtonStyle(@@ -379,7 +379,7 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {// Estimated end timeif (!isPast) ...[- Text('Sleep timer will end at',+ Text(l.sleepTimerSheetSpecificEndsAt,style: TextStyle(color: cs.onSurfaceVariant, fontSize: 12)),const SizedBox(height: 4),Text(_formatWallClock(endTime),@@ -390,10 +390,10 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {fontFeatures: const [FontFeature.tabularFigures()])),const SizedBox(height: 4),Text(- 'in ${_formatCountdown(Duration(seconds: realSecondsUntil.round()))}',+ l.sleepTimerSheetSpecificCountdown(_formatCountdown(Duration(seconds: realSecondsUntil.round()))),style: TextStyle(color: cs.onSurfaceVariant, fontSize: 12)),] else- Text('This point has already passed',+ Text(l.sleepTimerSheetSpecificAlreadyPassed,style: TextStyle(color: cs.error, fontSize: 13)),const SizedBox(height: 16),@@ -419,7 +419,7 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {Navigator.pop(context);},child: Text(- isPast ? 'Already passed' : 'Start timer',+ isPast ? l.sleepTimerSheetSpecificStartButtonPassed : l.sleepTimerSheetSpecificStartButton,style: const TextStyle(fontWeight: FontWeight.w600, fontSize: 14),),)),@@ -427,9 +427,10 @@ class _SleepTimerSheetState extends State<SleepTimerSheet> {}String _formatWallClock(DateTime dt) {+ final l = AppLocalizations.of(context)!;final h = dt.hour == 0 ? 12 : (dt.hour > 12 ? dt.hour - 12 : dt.hour);final m = dt.minute.toString().padLeft(2, '0');- final period = dt.hour >= 12 ? 'PM' : 'AM';+ final period = dt.hour >= 12 ? l.timePm : l.timeAm;return '$h:$m $period';}