christmas_cats/lib/localizations.dart

106 lines
3.5 KiB
Dart
Raw Normal View History

2020-01-15 19:04:40 +01:00
import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';
class ChristmasCatsLocalizations {
final Locale locale;
final allStrings = {
'en': {
'title': 'Christmas Cats',
'dedication': 'For Kira',
'play': 'Play',
'records': 'Records',
'records1': '1. %i',
'records2': '2. %i',
'records3': '3. %i',
'back': 'Back',
'intro': 'Introduction',
'coins': '%i Coins',
'getCoins': 'Get coins',
'adLoading': 'Ad loading',
2020-01-15 19:04:40 +01:00
'noAds': 'No ads available',
2020-01-16 11:58:29 +01:00
'poem': 'Cats are climbing Christmas trees,\n'
2020-01-15 19:04:40 +01:00
'The trees are getting wiggly,\n'
'You\'ll get a lot of trouble,\n'
2020-01-16 11:58:29 +01:00
'If you don\'t tap them quickly.',
2020-01-15 19:04:40 +01:00
'paused': 'Paused',
'unpause': 'Continue',
'exit': 'Exit',
'gameOver': 'Game over!',
'score': '%i Points',
'tryAgain': 'Try again',
},
'de': {
'title': 'Weihnachtskatzen',
'dedication': 'Für Kira',
'play': 'Spielen',
'records': 'Rekorde',
'records1': '1. %i',
'records2': '2. %i',
'records3': '3. %i',
'back': 'Zurück',
'intro': 'Einführung',
'coins': '%i Münzen',
'adLoading': 'Werbung wird geladen',
2020-01-15 19:04:40 +01:00
'noAds': 'Keine Werbung verfügbar',
'getCoins': 'Münzen bekommen',
2020-01-15 19:04:40 +01:00
'poem': 'Katzen, die auf Tannen steigen,\n'
'Welche sich gefährlich neigen,\n'
'Du musst auf die Tannen tippen,\n'
'Denn sonst werden diese kippen!',
'paused': 'Pausiert',
'unpause': 'Weiter',
'exit': 'Beenden',
'gameOver': 'Spiel vorbei!',
'score': '%i Punkte',
'tryAgain': 'Nochmal',
},
};
static const delegate = _ChristmasCatsLocalizationsDelegate();
static ChristmasCatsLocalizations of(BuildContext context) =>
Localizations.of(context, ChristmasCatsLocalizations);
Map<String, String> get localizedStrings => allStrings[locale.languageCode];
String get title => localizedStrings['title'];
String get dedication => localizedStrings['dedication'];
String get play => localizedStrings['play'];
String get records => localizedStrings['records'];
String get records1 => localizedStrings['records1'];
String get records2 => localizedStrings['records2'];
String get records3 => localizedStrings['records3'];
String get back => localizedStrings['back'];
String get intro => localizedStrings['intro'];
String get coins => localizedStrings['coins'];
String get adLoading => localizedStrings['adLoading'];
2020-01-15 19:04:40 +01:00
String get noAds => localizedStrings['noAds'];
String get getCoins => localizedStrings['getCoins'];
2020-01-15 19:04:40 +01:00
String get poem => localizedStrings['poem'];
String get paused => localizedStrings['paused'];
String get unpause => localizedStrings['unpause'];
String get exit => localizedStrings['exit'];
String get gameOver => localizedStrings['gameOver'];
String get score => localizedStrings['score'];
String get tryAgain => localizedStrings['tryAgain'];
ChristmasCatsLocalizations(this.locale);
}
class _ChristmasCatsLocalizationsDelegate
extends LocalizationsDelegate<ChristmasCatsLocalizations> {
const _ChristmasCatsLocalizationsDelegate();
@override
bool isSupported(Locale locale) => ['en', 'de'].contains(locale.languageCode);
@override
Future<ChristmasCatsLocalizations> load(Locale locale) =>
SynchronousFuture(ChristmasCatsLocalizations(locale));
@override
bool shouldReload(LocalizationsDelegate<ChristmasCatsLocalizations> old) =>
false;
}