локализация 3
This commit is contained in:
parent
2ddd459f25
commit
5c056797a0
@ -4,6 +4,9 @@
|
|||||||
"search": "Search",
|
"search": "Search",
|
||||||
"liked": "liked!",
|
"liked": "liked!",
|
||||||
"disliked": "disliked :<",
|
"disliked": "disliked :<",
|
||||||
|
"heroDetailsTitle": "Hero Details",
|
||||||
|
"heroNoImage": "No image available",
|
||||||
|
"heroNoDescription": "No description available",
|
||||||
|
|
||||||
"arbEnding": "ЗАПЯТАЯ"
|
"arbEnding": "ЗАПЯТАЯ"
|
||||||
}
|
}
|
@ -4,6 +4,9 @@
|
|||||||
"search": "Поиск",
|
"search": "Поиск",
|
||||||
"liked": "нравится!",
|
"liked": "нравится!",
|
||||||
"disliked": "не нравится :<",
|
"disliked": "не нравится :<",
|
||||||
|
"heroDetailsTitle": "Детали героя",
|
||||||
|
"heroNoImage": "Изображение недоступно",
|
||||||
|
"heroNoDescription": "Описание отсутствует",
|
||||||
|
|
||||||
"arbEnding": "ЗАПЯТАЯ"
|
"arbEnding": "ЗАПЯТАЯ"
|
||||||
}
|
}
|
@ -72,6 +72,16 @@ abstract class AppLocale {
|
|||||||
|
|
||||||
static const LocalizationsDelegate<AppLocale> delegate = _AppLocaleDelegate();
|
static const LocalizationsDelegate<AppLocale> delegate = _AppLocaleDelegate();
|
||||||
|
|
||||||
|
/// A list of this localizations delegate along with the default localizations
|
||||||
|
/// delegates.
|
||||||
|
///
|
||||||
|
/// Returns a list of localizations delegates containing this delegate along with
|
||||||
|
/// GlobalMaterialLocalizations.delegate, GlobalCupertinoLocalizations.delegate,
|
||||||
|
/// and GlobalWidgetsLocalizations.delegate.
|
||||||
|
///
|
||||||
|
/// Additional delegates can be added by appending to this list in
|
||||||
|
/// MaterialApp. This list does not have to be used at all if a custom list
|
||||||
|
/// of delegates is preferred or required.
|
||||||
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates = <LocalizationsDelegate<dynamic>>[
|
static const List<LocalizationsDelegate<dynamic>> localizationsDelegates = <LocalizationsDelegate<dynamic>>[
|
||||||
delegate,
|
delegate,
|
||||||
GlobalMaterialLocalizations.delegate,
|
GlobalMaterialLocalizations.delegate,
|
||||||
@ -79,19 +89,83 @@ abstract class AppLocale {
|
|||||||
GlobalWidgetsLocalizations.delegate,
|
GlobalWidgetsLocalizations.delegate,
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/// A list of this localizations delegate's supported locales.
|
||||||
static const List<Locale> supportedLocales = <Locale>[
|
static const List<Locale> supportedLocales = <Locale>[
|
||||||
Locale('en'),
|
Locale('en'),
|
||||||
Locale('ru')
|
Locale('ru')
|
||||||
];
|
];
|
||||||
|
|
||||||
// Существующие строки
|
/// No description provided for @search.
|
||||||
|
///
|
||||||
|
/// In ru, this message translates to:
|
||||||
|
/// **'Поиск'**
|
||||||
String get search;
|
String get search;
|
||||||
String get liked;
|
|
||||||
String get disliked;
|
|
||||||
String get arbEnding;
|
|
||||||
|
|
||||||
// Новые строки для HeroDetailScreen
|
/// No description provided for @liked.
|
||||||
|
///
|
||||||
|
/// In ru, this message translates to:
|
||||||
|
/// **'нравится!'**
|
||||||
|
String get liked;
|
||||||
|
|
||||||
|
/// No description provided for @disliked.
|
||||||
|
///
|
||||||
|
/// In ru, this message translates to:
|
||||||
|
/// **'не нравится :<'**
|
||||||
|
String get disliked;
|
||||||
|
|
||||||
|
/// No description provided for @heroDetailsTitle.
|
||||||
|
///
|
||||||
|
/// In ru, this message translates to:
|
||||||
|
/// **'Детали героя'**
|
||||||
String get heroDetailsTitle;
|
String get heroDetailsTitle;
|
||||||
|
|
||||||
|
/// No description provided for @heroNoImage.
|
||||||
|
///
|
||||||
|
/// In ru, this message translates to:
|
||||||
|
/// **'Изображение недоступно'**
|
||||||
String get heroNoImage;
|
String get heroNoImage;
|
||||||
|
|
||||||
|
/// No description provided for @heroNoDescription.
|
||||||
|
///
|
||||||
|
/// In ru, this message translates to:
|
||||||
|
/// **'Описание отсутствует'**
|
||||||
String get heroNoDescription;
|
String get heroNoDescription;
|
||||||
|
|
||||||
|
/// No description provided for @arbEnding.
|
||||||
|
///
|
||||||
|
/// In ru, this message translates to:
|
||||||
|
/// **'ЗАПЯТАЯ'**
|
||||||
|
String get arbEnding;
|
||||||
|
}
|
||||||
|
|
||||||
|
class _AppLocaleDelegate extends LocalizationsDelegate<AppLocale> {
|
||||||
|
const _AppLocaleDelegate();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<AppLocale> load(Locale locale) {
|
||||||
|
return SynchronousFuture<AppLocale>(lookupAppLocale(locale));
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool isSupported(Locale locale) => <String>['en', 'ru'].contains(locale.languageCode);
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool shouldReload(_AppLocaleDelegate old) => false;
|
||||||
|
}
|
||||||
|
|
||||||
|
AppLocale lookupAppLocale(Locale locale) {
|
||||||
|
|
||||||
|
|
||||||
|
// Lookup logic when only language code is specified.
|
||||||
|
switch (locale.languageCode) {
|
||||||
|
case 'en': return AppLocaleEn();
|
||||||
|
case 'ru': return AppLocaleRu();
|
||||||
|
}
|
||||||
|
|
||||||
|
throw FlutterError(
|
||||||
|
'AppLocale.delegate failed to load unsupported locale "$locale". This is likely '
|
||||||
|
'an issue with the localizations generation tool. Please file an issue '
|
||||||
|
'on GitHub with a reproducible sample app and the gen-l10n configuration '
|
||||||
|
'that was used.'
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,6 @@ class AppLocaleEn extends AppLocale {
|
|||||||
@override
|
@override
|
||||||
String get disliked => 'disliked :<';
|
String get disliked => 'disliked :<';
|
||||||
|
|
||||||
@override
|
|
||||||
String get arbEnding => 'COMMA';
|
|
||||||
|
|
||||||
// Добавленные строки
|
|
||||||
@override
|
@override
|
||||||
String get heroDetailsTitle => 'Hero Details';
|
String get heroDetailsTitle => 'Hero Details';
|
||||||
|
|
||||||
@ -27,4 +23,7 @@ class AppLocaleEn extends AppLocale {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String get heroNoDescription => 'No description available';
|
String get heroNoDescription => 'No description available';
|
||||||
}
|
|
||||||
|
@override
|
||||||
|
String get arbEnding => 'ЗАПЯТАЯ';
|
||||||
|
}
|
||||||
|
@ -15,16 +15,15 @@ class AppLocaleRu extends AppLocale {
|
|||||||
@override
|
@override
|
||||||
String get disliked => 'не нравится :<';
|
String get disliked => 'не нравится :<';
|
||||||
|
|
||||||
@override
|
|
||||||
String get arbEnding => 'ЗАПЯТАЯ';
|
|
||||||
|
|
||||||
// Добавленные строки
|
|
||||||
@override
|
@override
|
||||||
String get heroDetailsTitle => 'Детали героя';
|
String get heroDetailsTitle => 'Детали героя';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get heroNoImage => 'Изображение отсутствует';
|
String get heroNoImage => 'Изображение недоступно';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get heroNoDescription => 'Описание отсутствует';
|
String get heroNoDescription => 'Описание отсутствует';
|
||||||
}
|
|
||||||
|
@override
|
||||||
|
String get arbEnding => 'ЗАПЯТАЯ';
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user