Skip to content

Commit

Permalink
Merge pull request #84 from paolovalerdi/main
Browse files Browse the repository at this point in the history
feat: Add Spanish localization
  • Loading branch information
JonasWanke authored Jul 15, 2021
2 parents b118c0f + cc6485a commit 2c3b951
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions example/lib/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ final _mediaOverrideState = ValueNotifier(MediaOverrideState());
final _supportedLocales = [
const Locale('de'),
const Locale('en'),
const Locale('es'),
const Locale('ja'),
const Locale('zh', 'CN'),
const Locale('zh', 'TW'),
Expand Down
21 changes: 21 additions & 0 deletions lib/src/localization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'week.dart';
/// * `de` –German
/// * `en` – English
/// * `ja` – Japanese
/// * `es` – Spanish
/// * `zh_CN` – Chinese(Simplified)
/// * `zh_TW` – Chinese(Traditional)
/// * `it` – Italian
Expand Down Expand Up @@ -47,6 +48,8 @@ class TimetableLocalizationsDelegate
return const TimetableLocalizationEn();
case 'ja':
return const TimetableLocalizationJa();
case 'es':
return const TimetableLocalizationEs();
case 'zh':
if (locale.countryCode?.toLowerCase() == 'tw') {
return const TimetableLocalizationZhTw();
Expand Down Expand Up @@ -177,6 +180,24 @@ class TimetableLocalizationJa extends TimetableLocalizations {
'Week ${week.weekOfYear}, ${week.weekBasedYear}';
}

class TimetableLocalizationEs extends TimetableLocalizations {
const TimetableLocalizationEs();

@override
List<String> weekLabels(Week week) {
return [
weekOfYear(week),
'Semana ${week.weekOfYear}',
'S ${week.weekOfYear}',
'${week.weekOfYear}',
];
}

@override
String weekOfYear(Week week) =>
'Semana ${week.weekOfYear}, ${week.weekBasedYear}';
}

class TimetableLocalizationZhCn extends TimetableLocalizations {
const TimetableLocalizationZhCn();

Expand Down

0 comments on commit 2c3b951

Please sign in to comment.