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_ja.dart'; import 'app_localizations_zh.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(context, AppLocalizations); } static const LocalizationsDelegate 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> localizationsDelegates = >[ delegate, GlobalMaterialLocalizations.delegate, GlobalCupertinoLocalizations.delegate, GlobalWidgetsLocalizations.delegate, ]; /// A list of this localizations delegate's supported locales. static const List supportedLocales = [ Locale('en'), Locale('ja'), Locale('zh'), Locale.fromSubtags(languageCode: 'zh', scriptCode: 'Hant'), ]; /// No description provided for @settings. /// /// In en, this message translates to: /// **'Settings'** String get settings; /// No description provided for @networkConfiguration. /// /// In en, this message translates to: /// **'Network Configuration'** String get networkConfiguration; /// No description provided for @backendServerUrl. /// /// In en, this message translates to: /// **'Backend Server URL'** String get backendServerUrl; /// No description provided for @saveNetworkSettings. /// /// In en, this message translates to: /// **'Save Network Settings'** String get saveNetworkSettings; /// No description provided for @serverUrlUpdated. /// /// In en, this message translates to: /// **'Server URL Updated'** String get serverUrlUpdated; /// No description provided for @themeCustomization. /// /// In en, this message translates to: /// **'Theme Customization'** String get themeCustomization; /// No description provided for @appearanceMode. /// /// In en, this message translates to: /// **'Appearance Mode'** String get appearanceMode; /// No description provided for @system. /// /// In en, this message translates to: /// **'System'** String get system; /// No description provided for @light. /// /// In en, this message translates to: /// **'Light'** String get light; /// No description provided for @dark. /// /// In en, this message translates to: /// **'Dark'** String get dark; /// No description provided for @accentColor. /// /// In en, this message translates to: /// **'Accent Color'** String get accentColor; /// No description provided for @explore. /// /// In en, this message translates to: /// **'Explore'** String get explore; /// No description provided for @livePreviewThumbnails. /// /// In en, this message translates to: /// **'Live Preview Thumbnails'** String get livePreviewThumbnails; /// No description provided for @livePreviewThumbnailsDesc. /// /// In en, this message translates to: /// **'Show cached snapshot covers for live rooms when available.'** String get livePreviewThumbnailsDesc; /// No description provided for @security. /// /// In en, this message translates to: /// **'Security'** String get security; /// No description provided for @oldPassword. /// /// In en, this message translates to: /// **'Old Password'** String get oldPassword; /// No description provided for @newPassword. /// /// In en, this message translates to: /// **'New Password'** String get newPassword; /// No description provided for @changePassword. /// /// In en, this message translates to: /// **'Change Password'** String get changePassword; /// No description provided for @logout. /// /// In en, this message translates to: /// **'Logout'** String get logout; /// No description provided for @confirmLogout. /// /// In en, this message translates to: /// **'Confirm Logout'** String get confirmLogout; /// No description provided for @confirmLogoutDesc. /// /// In en, this message translates to: /// **'Are you sure you want to log out now?'** String get confirmLogoutDesc; /// No description provided for @cancel. /// /// In en, this message translates to: /// **'Cancel'** String get cancel; /// No description provided for @language. /// /// In en, this message translates to: /// **'Language'** String get language; /// No description provided for @selectLanguage. /// /// In en, this message translates to: /// **'Select Language'** String get selectLanguage; /// No description provided for @english. /// /// In en, this message translates to: /// **'English'** String get english; /// No description provided for @simplifiedChinese. /// /// In en, this message translates to: /// **'简体中文'** String get simplifiedChinese; /// No description provided for @traditionalChinese. /// /// In en, this message translates to: /// **'繁體中文'** String get traditionalChinese; /// No description provided for @japanese. /// /// In en, this message translates to: /// **'日本語'** String get japanese; /// No description provided for @console. /// /// In en, this message translates to: /// **'Console'** String get console; /// No description provided for @failedToLoadRooms. /// /// In en, this message translates to: /// **'Failed to load rooms'** String get failedToLoadRooms; /// No description provided for @goLive. /// /// In en, this message translates to: /// **'Go Live'** String get goLive; /// No description provided for @noActiveRooms. /// /// In en, this message translates to: /// **'No active rooms. Be the first!'** String get noActiveRooms; /// No description provided for @hostId. /// /// In en, this message translates to: /// **'Host ID'** String get hostId; /// No description provided for @username. /// /// In en, this message translates to: /// **'Username'** String get username; /// No description provided for @password. /// /// In en, this message translates to: /// **'Password'** String get password; /// No description provided for @fillAllFields. /// /// In en, this message translates to: /// **'Please fill in all fields'** String get fillAllFields; /// No description provided for @networkError. /// /// In en, this message translates to: /// **'Network Error: Could not connect to server'** String get networkError; /// No description provided for @loginFailed. /// /// In en, this message translates to: /// **'Login Failed'** String get loginFailed; /// No description provided for @login. /// /// In en, this message translates to: /// **'LOGIN'** String get login; /// No description provided for @dontHaveAccount. /// /// In en, this message translates to: /// **'Don\'t have an account? Create one'** String get dontHaveAccount; /// No description provided for @createAccount. /// /// In en, this message translates to: /// **'Create Account'** String get createAccount; /// No description provided for @joinHightube. /// /// In en, this message translates to: /// **'Join Hightube'** String get joinHightube; /// No description provided for @desiredUsername. /// /// In en, this message translates to: /// **'Desired Username'** String get desiredUsername; /// No description provided for @register. /// /// In en, this message translates to: /// **'REGISTER'** String get register; /// No description provided for @alreadyHaveAccount. /// /// In en, this message translates to: /// **'Already have an account? Login here'** String get alreadyHaveAccount; /// No description provided for @accountCreated. /// /// In en, this message translates to: /// **'Account created! Please login.'** String get accountCreated; /// No description provided for @playbackResolution. /// /// In en, this message translates to: /// **'Playback Resolution'** String get playbackResolution; /// No description provided for @availableNow. /// /// In en, this message translates to: /// **'Available now'** String get availableNow; /// No description provided for @waitingForTranscoding. /// /// In en, this message translates to: /// **'Waiting for backend transcoding output'** String get waitingForTranscoding; /// No description provided for @sendMessage. /// /// In en, this message translates to: /// **'Send a message...'** String get sendMessage; /// No description provided for @liveChat. /// /// In en, this message translates to: /// **'Live Chat'** String get liveChat; /// No description provided for @refresh. /// /// In en, this message translates to: /// **'Refresh'** String get refresh; /// No description provided for @volume. /// /// In en, this message translates to: /// **'Volume'** String get volume; /// No description provided for @danmakuOn. /// /// In en, this message translates to: /// **'Danmaku On'** String get danmakuOn; /// No description provided for @danmakuOff. /// /// In en, this message translates to: /// **'Danmaku Off'** String get danmakuOff; /// No description provided for @fullscreen. /// /// In en, this message translates to: /// **'Fullscreen'** String get fullscreen; /// No description provided for @exitFullscreen. /// /// In en, this message translates to: /// **'Exit Fullscreen'** String get exitFullscreen; /// No description provided for @resolution. /// /// In en, this message translates to: /// **'Resolution'** String get resolution; /// No description provided for @playbackOptionsDesc. /// /// In en, this message translates to: /// **'Select an available transcoded stream.'** String get playbackOptionsDesc; /// No description provided for @sourceOnlyDesc. /// /// In en, this message translates to: /// **'Only the source stream is available right now.'** String get sourceOnlyDesc; /// No description provided for @myStreamConsole. /// /// In en, this message translates to: /// **'My Stream Console'** String get myStreamConsole; /// No description provided for @noRoomInfo. /// /// In en, this message translates to: /// **'No room info found.'** String get noRoomInfo; /// No description provided for @roomTitle. /// /// In en, this message translates to: /// **'Room Title'** String get roomTitle; /// No description provided for @rtmpServerUrl. /// /// In en, this message translates to: /// **'RTMP Server URL'** String get rtmpServerUrl; /// No description provided for @streamKey. /// /// In en, this message translates to: /// **'Stream Key (Keep Secret!)'** String get streamKey; /// No description provided for @copiedToClipboard. /// /// In en, this message translates to: /// **'Copied to clipboard'** String get copiedToClipboard; /// No description provided for @failedToFetchRoomInfo. /// /// In en, this message translates to: /// **'Failed to fetch room info'** String get failedToFetchRoomInfo; } class _AppLocalizationsDelegate extends LocalizationsDelegate { const _AppLocalizationsDelegate(); @override Future load(Locale locale) { return SynchronousFuture(lookupAppLocalizations(locale)); } @override bool isSupported(Locale locale) => ['en', 'ja', 'zh'].contains(locale.languageCode); @override bool shouldReload(_AppLocalizationsDelegate old) => false; } AppLocalizations lookupAppLocalizations(Locale locale) { // Lookup logic when language+script codes are specified. switch (locale.languageCode) { case 'zh': { switch (locale.scriptCode) { case 'Hant': return AppLocalizationsZhHant(); } break; } } // Lookup logic when only language code is specified. switch (locale.languageCode) { case 'en': return AppLocalizationsEn(); case 'ja': return AppLocalizationsJa(); case 'zh': return AppLocalizationsZh(); } 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.', ); }