fix(i18n): 印尼语内容缺失时不再回退中文
This commit is contained in:
1 parent
9ef8eb15b0
commit
19196ceb8e
13 files changed
+261
-95
No files matched your search
@@ -8,6 +8,7 @@ import '../../../core/data/models/playlist_detail.dart';
|
||||
import '../../../core/data/services/category_controller.dart';
|
||||
import '../../../core/data/services/home_feed_controller.dart';
|
||||
import '../../../core/data/services/playlist_controller.dart';
|
||||
import '../../../core/formatting/content_locale_guard.dart';
|
||||
import '../../../core/theme/app_colors.dart';
|
||||
import '../../../core/theme/app_dimens.dart';
|
||||
import '../../../core/widgets/app_pull_to_refresh.dart';
|
||||
@@ -43,7 +44,8 @@ class RecommendSectionsView extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final l10n = AppLocalizations.of(context)!;
|
||||
final source = feedController.dramas;
|
||||
final languageCode = Localizations.localeOf(context).languageCode;
|
||||
final source = visibleDramasForLocale(feedController.dramas, languageCode);
|
||||
final remote = playlists;
|
||||
return AppPullToRefresh(
|
||||
key: const Key('recommend-sections-refresh'),
|
||||
@@ -83,39 +85,39 @@ class RecommendSectionsView extends StatelessWidget {
|
||||
source: source,
|
||||
);
|
||||
return [
|
||||
_section(
|
||||
context,
|
||||
l10n,
|
||||
key: 'hits',
|
||||
title: l10n.weeklyHitsTitle,
|
||||
subtitle: l10n.weeklyHitsSubtitle,
|
||||
dramas: hits.take(_sectionPreviewCount).toList(),
|
||||
onMore: () => onMore(RecommendSectionKind.hits),
|
||||
),
|
||||
const SizedBox(height: AppDimens.recommendSectionGap),
|
||||
_section(
|
||||
context,
|
||||
l10n,
|
||||
key: 'new',
|
||||
title: l10n.weeklyNewTitle,
|
||||
subtitle: l10n.weeklyNewSubtitle,
|
||||
dramas: newest.take(_sectionPreviewCount).toList(),
|
||||
onMore: () => onMore(RecommendSectionKind.newReleases),
|
||||
),
|
||||
const SizedBox(height: AppDimens.recommendSectionGap),
|
||||
_section(
|
||||
context,
|
||||
l10n,
|
||||
key: 'costume',
|
||||
title: l10n.costumeAwardsTitle,
|
||||
subtitle: l10n.costumeAwardsSubtitle,
|
||||
dramas: recommendSectionDramas(
|
||||
kind: RecommendSectionKind.costume,
|
||||
source: source,
|
||||
categories: categories,
|
||||
).take(_sectionPreviewCount).toList(),
|
||||
onMore: () => onMore(RecommendSectionKind.costume),
|
||||
),
|
||||
_section(
|
||||
context,
|
||||
l10n,
|
||||
key: 'hits',
|
||||
title: l10n.weeklyHitsTitle,
|
||||
subtitle: l10n.weeklyHitsSubtitle,
|
||||
dramas: hits.take(_sectionPreviewCount).toList(),
|
||||
onMore: () => onMore(RecommendSectionKind.hits),
|
||||
),
|
||||
const SizedBox(height: AppDimens.recommendSectionGap),
|
||||
_section(
|
||||
context,
|
||||
l10n,
|
||||
key: 'new',
|
||||
title: l10n.weeklyNewTitle,
|
||||
subtitle: l10n.weeklyNewSubtitle,
|
||||
dramas: newest.take(_sectionPreviewCount).toList(),
|
||||
onMore: () => onMore(RecommendSectionKind.newReleases),
|
||||
),
|
||||
const SizedBox(height: AppDimens.recommendSectionGap),
|
||||
_section(
|
||||
context,
|
||||
l10n,
|
||||
key: 'costume',
|
||||
title: l10n.costumeAwardsTitle,
|
||||
subtitle: l10n.costumeAwardsSubtitle,
|
||||
dramas: recommendSectionDramas(
|
||||
kind: RecommendSectionKind.costume,
|
||||
source: source,
|
||||
categories: categories,
|
||||
).take(_sectionPreviewCount).toList(),
|
||||
onMore: () => onMore(RecommendSectionKind.costume),
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -163,7 +165,10 @@ class RecommendSectionsView extends StatelessWidget {
|
||||
subtitle: playlist.localizedDescription(
|
||||
Localizations.localeOf(context).languageCode,
|
||||
),
|
||||
dramas: playlist.dramas.take(_sectionPreviewCount).toList(),
|
||||
dramas: visibleDramasForLocale(
|
||||
playlist.dramas,
|
||||
Localizations.localeOf(context).languageCode,
|
||||
).take(_sectionPreviewCount).toList(),
|
||||
onMore: () => onOpenPlaylist?.call(playlist),
|
||||
),
|
||||
);
|
||||
@@ -320,9 +325,15 @@ List<Drama> recommendSectionDramas({
|
||||
int _newestFirst(Drama leftDrama, Drama rightDrama) {
|
||||
final left = publishedAtForDrama(leftDrama);
|
||||
final right = publishedAtForDrama(rightDrama);
|
||||
if (left == null && right == null) return rightDrama.id.compareTo(leftDrama.id);
|
||||
if (left == null) return 1;
|
||||
if (right == null) return -1;
|
||||
if (left == null && right == null) {
|
||||
return rightDrama.id.compareTo(leftDrama.id);
|
||||
}
|
||||
if (left == null) {
|
||||
return 1;
|
||||
}
|
||||
if (right == null) {
|
||||
return -1;
|
||||
}
|
||||
return right.compareTo(left);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user