Приложение на флаторе, настройки
This commit is contained in:
@@ -0,0 +1,421 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:intl/intl.dart' as intl;
|
||||
|
||||
import 'app_localizations_en.dart';
|
||||
import 'app_localizations_ru.dart';
|
||||
|
||||
// ignore_for_file: type=lint
|
||||
|
||||
/// Callers can lookup localized strings with an instance of AppLocalizations
|
||||
/// returned by `AppLocalizations.of(context)`.
|
||||
///
|
||||
/// Applications need to include `AppLocalizations.delegate()` in their app's
|
||||
/// `localizationDelegates` list, and the locales they support in the app's
|
||||
/// `supportedLocales` list. For example:
|
||||
///
|
||||
/// ```dart
|
||||
/// import 'l10n/app_localizations.dart';
|
||||
///
|
||||
/// return MaterialApp(
|
||||
/// localizationsDelegates: AppLocalizations.localizationsDelegates,
|
||||
/// supportedLocales: AppLocalizations.supportedLocales,
|
||||
/// home: MyApplicationHome(),
|
||||
/// );
|
||||
/// ```
|
||||
///
|
||||
/// ## Update pubspec.yaml
|
||||
///
|
||||
/// Please make sure to update your pubspec.yaml to include the following
|
||||
/// packages:
|
||||
///
|
||||
/// ```yaml
|
||||
/// dependencies:
|
||||
/// # Internationalization support.
|
||||
/// flutter_localizations:
|
||||
/// sdk: flutter
|
||||
/// intl: any # Use the pinned version from flutter_localizations
|
||||
///
|
||||
/// # Rest of dependencies
|
||||
/// ```
|
||||
///
|
||||
/// ## iOS Applications
|
||||
///
|
||||
/// iOS applications define key application metadata, including supported
|
||||
/// locales, in an Info.plist file that is built into the application bundle.
|
||||
/// To configure the locales supported by your app, you’ll need to edit this
|
||||
/// file.
|
||||
///
|
||||
/// First, open your project’s ios/Runner.xcworkspace Xcode workspace file.
|
||||
/// Then, in the Project Navigator, open the Info.plist file under the Runner
|
||||
/// project’s Runner folder.
|
||||
///
|
||||
/// Next, select the Information Property List item, select Add Item from the
|
||||
/// Editor menu, then select Localizations from the pop-up menu.
|
||||
///
|
||||
/// Select and expand the newly-created Localizations item then, for each
|
||||
/// locale your application supports, add a new item and select the locale
|
||||
/// you wish to add from the pop-up menu in the Value field. This list should
|
||||
/// be consistent with the languages listed in the AppLocalizations.supportedLocales
|
||||
/// property.
|
||||
abstract class AppLocalizations {
|
||||
AppLocalizations(String locale)
|
||||
: localeName = intl.Intl.canonicalizedLocale(locale.toString());
|
||||
|
||||
final String localeName;
|
||||
|
||||
static AppLocalizations? of(BuildContext context) {
|
||||
return Localizations.of<AppLocalizations>(context, AppLocalizations);
|
||||
}
|
||||
|
||||
static const LocalizationsDelegate<AppLocalizations> delegate =
|
||||
_AppLocalizationsDelegate();
|
||||
|
||||
/// 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>>[
|
||||
delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
];
|
||||
|
||||
/// A list of this localizations delegate's supported locales.
|
||||
static const List<Locale> supportedLocales = <Locale>[
|
||||
Locale('en'),
|
||||
Locale('ru')
|
||||
];
|
||||
|
||||
/// No description provided for @appTitle.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Мессенджер'**
|
||||
String get appTitle;
|
||||
|
||||
/// No description provided for @chats.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Чаты'**
|
||||
String get chats;
|
||||
|
||||
/// No description provided for @contacts.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Контакты'**
|
||||
String get contacts;
|
||||
|
||||
/// No description provided for @settings.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Настройки'**
|
||||
String get settings;
|
||||
|
||||
/// No description provided for @login.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Вход'**
|
||||
String get login;
|
||||
|
||||
/// No description provided for @email.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Email'**
|
||||
String get email;
|
||||
|
||||
/// No description provided for @password.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Пароль'**
|
||||
String get password;
|
||||
|
||||
/// No description provided for @name.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Имя'**
|
||||
String get name;
|
||||
|
||||
/// No description provided for @loginButton.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Войти'**
|
||||
String get loginButton;
|
||||
|
||||
/// No description provided for @register.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Зарегистрироваться'**
|
||||
String get register;
|
||||
|
||||
/// No description provided for @noAccount.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Нет аккаунта? Зарегистрироваться'**
|
||||
String get noAccount;
|
||||
|
||||
/// No description provided for @logout.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Выйти из аккаунта'**
|
||||
String get logout;
|
||||
|
||||
/// No description provided for @serverSettings.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Настройки сервера'**
|
||||
String get serverSettings;
|
||||
|
||||
/// No description provided for @apiUrl.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Адрес API'**
|
||||
String get apiUrl;
|
||||
|
||||
/// No description provided for @apiUrlHint.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'https://api.example.com'**
|
||||
String get apiUrlHint;
|
||||
|
||||
/// No description provided for @save.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Сохранить'**
|
||||
String get save;
|
||||
|
||||
/// No description provided for @serverConfig.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Конфигурация сервера'**
|
||||
String get serverConfig;
|
||||
|
||||
/// No description provided for @system.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Система'**
|
||||
String get system;
|
||||
|
||||
/// No description provided for @stories.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Истории'**
|
||||
String get stories;
|
||||
|
||||
/// No description provided for @chatsModule.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Чаты'**
|
||||
String get chatsModule;
|
||||
|
||||
/// No description provided for @messages.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Сообщения'**
|
||||
String get messages;
|
||||
|
||||
/// No description provided for @calls.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Звонки'**
|
||||
String get calls;
|
||||
|
||||
/// No description provided for @klipy.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Клипы'**
|
||||
String get klipy;
|
||||
|
||||
/// No description provided for @import.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Импорт'**
|
||||
String get import;
|
||||
|
||||
/// No description provided for @federation.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Федерация'**
|
||||
String get federation;
|
||||
|
||||
/// No description provided for @domainUrl.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Домен'**
|
||||
String get domainUrl;
|
||||
|
||||
/// No description provided for @enableRegistration.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Регистрация включена'**
|
||||
String get enableRegistration;
|
||||
|
||||
/// No description provided for @enabled.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Включено'**
|
||||
String get enabled;
|
||||
|
||||
/// No description provided for @disabled.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Отключено'**
|
||||
String get disabled;
|
||||
|
||||
/// No description provided for @language.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Язык'**
|
||||
String get language;
|
||||
|
||||
/// No description provided for @russian.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Русский'**
|
||||
String get russian;
|
||||
|
||||
/// No description provided for @english.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'English'**
|
||||
String get english;
|
||||
|
||||
/// No description provided for @notifications.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Уведомления'**
|
||||
String get notifications;
|
||||
|
||||
/// No description provided for @privacy.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Конфиденциальность'**
|
||||
String get privacy;
|
||||
|
||||
/// No description provided for @soundsAndVibration.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Звуки и вибрация'**
|
||||
String get soundsAndVibration;
|
||||
|
||||
/// No description provided for @dataAndStorage.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Данные и память'**
|
||||
String get dataAndStorage;
|
||||
|
||||
/// No description provided for @aboutApp.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'О приложении'**
|
||||
String get aboutApp;
|
||||
|
||||
/// No description provided for @help.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Помощь'**
|
||||
String get help;
|
||||
|
||||
/// No description provided for @version.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Версия'**
|
||||
String get version;
|
||||
|
||||
/// No description provided for @loading.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Загрузка...'**
|
||||
String get loading;
|
||||
|
||||
/// No description provided for @error.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Ошибка'**
|
||||
String get error;
|
||||
|
||||
/// No description provided for @retry.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Повторить'**
|
||||
String get retry;
|
||||
|
||||
/// No description provided for @noChats.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'У вас пока нет чатов'**
|
||||
String get noChats;
|
||||
|
||||
/// No description provided for @inDevelopment.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Функция в разработке'**
|
||||
String get inDevelopment;
|
||||
|
||||
/// No description provided for @user.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Пользователь'**
|
||||
String get user;
|
||||
|
||||
/// No description provided for @edit.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Редактировать'**
|
||||
String get edit;
|
||||
|
||||
/// No description provided for @serverConnectionError.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Ошибка подключения к серверу'**
|
||||
String get serverConnectionError;
|
||||
|
||||
/// No description provided for @settingsSaved.
|
||||
///
|
||||
/// In ru, this message translates to:
|
||||
/// **'Настройки сохранены'**
|
||||
String get settingsSaved;
|
||||
}
|
||||
|
||||
class _AppLocalizationsDelegate
|
||||
extends LocalizationsDelegate<AppLocalizations> {
|
||||
const _AppLocalizationsDelegate();
|
||||
|
||||
@override
|
||||
Future<AppLocalizations> load(Locale locale) {
|
||||
return SynchronousFuture<AppLocalizations>(lookupAppLocalizations(locale));
|
||||
}
|
||||
|
||||
@override
|
||||
bool isSupported(Locale locale) =>
|
||||
<String>['en', 'ru'].contains(locale.languageCode);
|
||||
|
||||
@override
|
||||
bool shouldReload(_AppLocalizationsDelegate old) => false;
|
||||
}
|
||||
|
||||
AppLocalizations lookupAppLocalizations(Locale locale) {
|
||||
// Lookup logic when only language code is specified.
|
||||
switch (locale.languageCode) {
|
||||
case 'en':
|
||||
return AppLocalizationsEn();
|
||||
case 'ru':
|
||||
return AppLocalizationsRu();
|
||||
}
|
||||
|
||||
throw FlutterError(
|
||||
'AppLocalizations.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.');
|
||||
}
|
||||
Reference in New Issue
Block a user