app_localizations.dart 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  1. import 'dart:async';
  2. import 'package:flutter/foundation.dart';
  3. import 'package:flutter/widgets.dart';
  4. import 'package:flutter_localizations/flutter_localizations.dart';
  5. import 'package:intl/intl.dart' as intl;
  6. import 'app_localizations_en.dart';
  7. // ignore_for_file: type=lint
  8. /// Callers can lookup localized strings with an instance of AppLocalizations
  9. /// returned by `AppLocalizations.of(context)`.
  10. ///
  11. /// Applications need to include `AppLocalizations.delegate()` in their app's
  12. /// `localizationDelegates` list, and the locales they support in the app's
  13. /// `supportedLocales` list. For example:
  14. ///
  15. /// ```dart
  16. /// import 'l10n/app_localizations.dart';
  17. ///
  18. /// return MaterialApp(
  19. /// localizationsDelegates: AppLocalizations.localizationsDelegates,
  20. /// supportedLocales: AppLocalizations.supportedLocales,
  21. /// home: MyApplicationHome(),
  22. /// );
  23. /// ```
  24. ///
  25. /// ## Update pubspec.yaml
  26. ///
  27. /// Please make sure to update your pubspec.yaml to include the following
  28. /// packages:
  29. ///
  30. /// ```yaml
  31. /// dependencies:
  32. /// # Internationalization support.
  33. /// flutter_localizations:
  34. /// sdk: flutter
  35. /// intl: any # Use the pinned version from flutter_localizations
  36. ///
  37. /// # Rest of dependencies
  38. /// ```
  39. ///
  40. /// ## iOS Applications
  41. ///
  42. /// iOS applications define key application metadata, including supported
  43. /// locales, in an Info.plist file that is built into the application bundle.
  44. /// To configure the locales supported by your app, you’ll need to edit this
  45. /// file.
  46. ///
  47. /// First, open your project’s ios/Runner.xcworkspace Xcode workspace file.
  48. /// Then, in the Project Navigator, open the Info.plist file under the Runner
  49. /// project’s Runner folder.
  50. ///
  51. /// Next, select the Information Property List item, select Add Item from the
  52. /// Editor menu, then select Localizations from the pop-up menu.
  53. ///
  54. /// Select and expand the newly-created Localizations item then, for each
  55. /// locale your application supports, add a new item and select the locale
  56. /// you wish to add from the pop-up menu in the Value field. This list should
  57. /// be consistent with the languages listed in the AppLocalizations.supportedLocales
  58. /// property.
  59. abstract class AppLocalizations {
  60. AppLocalizations(String locale)
  61. : localeName = intl.Intl.canonicalizedLocale(locale.toString());
  62. final String localeName;
  63. static AppLocalizations? of(BuildContext context) {
  64. return Localizations.of<AppLocalizations>(context, AppLocalizations);
  65. }
  66. static const LocalizationsDelegate<AppLocalizations> delegate =
  67. _AppLocalizationsDelegate();
  68. /// A list of this localizations delegate along with the default localizations
  69. /// delegates.
  70. ///
  71. /// Returns a list of localizations delegates containing this delegate along with
  72. /// GlobalMaterialLocalizations.delegate, GlobalCupertinoLocalizations.delegate,
  73. /// and GlobalWidgetsLocalizations.delegate.
  74. ///
  75. /// Additional delegates can be added by appending to this list in
  76. /// MaterialApp. This list does not have to be used at all if a custom list
  77. /// of delegates is preferred or required.
  78. static const List<LocalizationsDelegate<dynamic>> localizationsDelegates =
  79. <LocalizationsDelegate<dynamic>>[
  80. delegate,
  81. GlobalMaterialLocalizations.delegate,
  82. GlobalCupertinoLocalizations.delegate,
  83. GlobalWidgetsLocalizations.delegate,
  84. ];
  85. /// A list of this localizations delegate's supported locales.
  86. static const List<Locale> supportedLocales = <Locale>[Locale('en')];
  87. /// No description provided for @appName.
  88. ///
  89. /// In en, this message translates to:
  90. /// **'PB Authenticator'**
  91. String get appName;
  92. /// No description provided for @ok.
  93. ///
  94. /// In en, this message translates to:
  95. /// **'OK'**
  96. String get ok;
  97. /// No description provided for @yes.
  98. ///
  99. /// In en, this message translates to:
  100. /// **'Yes'**
  101. String get yes;
  102. /// No description provided for @no.
  103. ///
  104. /// In en, this message translates to:
  105. /// **'No'**
  106. String get no;
  107. /// No description provided for @error.
  108. ///
  109. /// In en, this message translates to:
  110. /// **'Error'**
  111. String get error;
  112. /// No description provided for @save.
  113. ///
  114. /// In en, this message translates to:
  115. /// **'Save'**
  116. String get save;
  117. /// No description provided for @edit.
  118. ///
  119. /// In en, this message translates to:
  120. /// **'Edit'**
  121. String get edit;
  122. /// No description provided for @add.
  123. ///
  124. /// In en, this message translates to:
  125. /// **'Add'**
  126. String get add;
  127. /// No description provided for @addTitle.
  128. ///
  129. /// In en, this message translates to:
  130. /// **'Add Account'**
  131. String get addTitle;
  132. /// No description provided for @addScanQR.
  133. ///
  134. /// In en, this message translates to:
  135. /// **'Scan QR Code'**
  136. String get addScanQR;
  137. /// No description provided for @addManualInput.
  138. ///
  139. /// In en, this message translates to:
  140. /// **'Manual Input'**
  141. String get addManualInput;
  142. /// No description provided for @addMethodPrompt.
  143. ///
  144. /// In en, this message translates to:
  145. /// **'Please select input method.'**
  146. String get addMethodPrompt;
  147. /// No description provided for @cancel.
  148. ///
  149. /// In en, this message translates to:
  150. /// **'Cancel'**
  151. String get cancel;
  152. /// No description provided for @secret.
  153. ///
  154. /// In en, this message translates to:
  155. /// **'Secret key'**
  156. String get secret;
  157. /// No description provided for @secretInvalidMessage.
  158. ///
  159. /// In en, this message translates to:
  160. /// **'Secret key is invalid'**
  161. String get secretInvalidMessage;
  162. /// No description provided for @issuer.
  163. ///
  164. /// In en, this message translates to:
  165. /// **'Provider/Issuer'**
  166. String get issuer;
  167. /// No description provided for @accountName.
  168. ///
  169. /// In en, this message translates to:
  170. /// **'Account Name'**
  171. String get accountName;
  172. /// No description provided for @digits.
  173. ///
  174. /// In en, this message translates to:
  175. /// **'Number of digits'**
  176. String get digits;
  177. /// No description provided for @period.
  178. ///
  179. /// In en, this message translates to:
  180. /// **'Time step'**
  181. String get period;
  182. /// No description provided for @settingsTitle.
  183. ///
  184. /// In en, this message translates to:
  185. /// **'Settings'**
  186. String get settingsTitle;
  187. /// No description provided for @source.
  188. ///
  189. /// In en, this message translates to:
  190. /// **'Source code'**
  191. String get source;
  192. /// No description provided for @clipboard.
  193. ///
  194. /// In en, this message translates to:
  195. /// **'Copied to clipboard'**
  196. String get clipboard;
  197. /// No description provided for @noAccounts.
  198. ///
  199. /// In en, this message translates to:
  200. /// **'You have no accounts,\n press the + button to add one.'**
  201. String get noAccounts;
  202. /// No description provided for @loading.
  203. ///
  204. /// In en, this message translates to:
  205. /// **'Loading...'**
  206. String get loading;
  207. /// No description provided for @editTitle.
  208. ///
  209. /// In en, this message translates to:
  210. /// **'Edit Accounts'**
  211. String get editTitle;
  212. /// No description provided for @removeAccounts.
  213. ///
  214. /// In en, this message translates to:
  215. /// **'Remove accounts'**
  216. String get removeAccounts;
  217. /// No description provided for @removeConfirmation.
  218. ///
  219. /// In en, this message translates to:
  220. /// **'Please do not forget to turn off 2 factor authentication before removal.\n\nAre you sure that you want to remove the selected account(s)?'**
  221. String get removeConfirmation;
  222. /// No description provided for @exitEditTitle.
  223. ///
  224. /// In en, this message translates to:
  225. /// **'Exit'**
  226. String get exitEditTitle;
  227. /// No description provided for @exitEditInfo.
  228. ///
  229. /// In en, this message translates to:
  230. /// **'Do you want to exit edit mode without saving?'**
  231. String get exitEditInfo;
  232. /// No description provided for @errDuplicateAccount.
  233. ///
  234. /// In en, this message translates to:
  235. /// **'Duplicate account'**
  236. String get errDuplicateAccount;
  237. /// No description provided for @errIdCollision.
  238. ///
  239. /// In en, this message translates to:
  240. /// **'A rare ID collision has occurred. Please try again.'**
  241. String get errIdCollision;
  242. /// No description provided for @errNoCameraPermission.
  243. ///
  244. /// In en, this message translates to:
  245. /// **'Camera permission not granted'**
  246. String get errNoCameraPermission;
  247. /// No description provided for @errIncorrectFormat.
  248. ///
  249. /// In en, this message translates to:
  250. /// **'Scanned code is of incorrect format'**
  251. String get errIncorrectFormat;
  252. /// No description provided for @errUnknown.
  253. ///
  254. /// In en, this message translates to:
  255. /// **'Unknown error'**
  256. String get errUnknown;
  257. /// No description provided for @howItWorksTitle.
  258. ///
  259. /// In en, this message translates to:
  260. /// **'How it works'**
  261. String get howItWorksTitle;
  262. /// No description provided for @howItWorksTitle1.
  263. ///
  264. /// In en, this message translates to:
  265. /// **'Secure your accounts'**
  266. String get howItWorksTitle1;
  267. /// No description provided for @howItWorksBody1.
  268. ///
  269. /// In en, this message translates to:
  270. /// **'Add your accounts to generate time-based one-time passwords (TOTP) for secure sign-in.'**
  271. String get howItWorksBody1;
  272. /// No description provided for @howItWorksTitle2.
  273. ///
  274. /// In en, this message translates to:
  275. /// **'Scan QR codes'**
  276. String get howItWorksTitle2;
  277. /// No description provided for @howItWorksBody2.
  278. ///
  279. /// In en, this message translates to:
  280. /// **'Easily add new accounts by scanning QR codes provided by your services.'**
  281. String get howItWorksBody2;
  282. /// No description provided for @howItWorksTitle3.
  283. ///
  284. /// In en, this message translates to:
  285. /// **'Backup & Restore'**
  286. String get howItWorksTitle3;
  287. /// No description provided for @howItWorksBody3.
  288. ///
  289. /// In en, this message translates to:
  290. /// **'Backup your accounts securely and restore them when needed.'**
  291. String get howItWorksBody3;
  292. /// No description provided for @howItWorksTitle4.
  293. ///
  294. /// In en, this message translates to:
  295. /// **'Offline & Private'**
  296. String get howItWorksTitle4;
  297. /// No description provided for @howItWorksBody4.
  298. ///
  299. /// In en, this message translates to:
  300. /// **'All data stays on your device. No internet required for generating codes.'**
  301. String get howItWorksBody4;
  302. /// No description provided for @skip.
  303. ///
  304. /// In en, this message translates to:
  305. /// **'Skip'**
  306. String get skip;
  307. /// No description provided for @done.
  308. ///
  309. /// In en, this message translates to:
  310. /// **'Done'**
  311. String get done;
  312. /// No description provided for @transferCodesTitle.
  313. ///
  314. /// In en, this message translates to:
  315. /// **'Transfer codes'**
  316. String get transferCodesTitle;
  317. /// No description provided for @transferCodesDescription.
  318. ///
  319. /// In en, this message translates to:
  320. /// **'Transfer your accounts to another device.'**
  321. String get transferCodesDescription;
  322. /// No description provided for @exportAccounts.
  323. ///
  324. /// In en, this message translates to:
  325. /// **'Export accounts'**
  326. String get exportAccounts;
  327. /// No description provided for @importAccounts.
  328. ///
  329. /// In en, this message translates to:
  330. /// **'Import accounts'**
  331. String get importAccounts;
  332. /// No description provided for @importSuccess.
  333. ///
  334. /// In en, this message translates to:
  335. /// **'Accounts imported successfully!'**
  336. String get importSuccess;
  337. /// No description provided for @importDescription.
  338. ///
  339. /// In en, this message translates to:
  340. /// **'Import your accounts from Google Authenticator or PB Authenticator by scanning a QR code.'**
  341. String get importDescription;
  342. /// No description provided for @exportDescription.
  343. ///
  344. /// In en, this message translates to:
  345. /// **'Select which accounts to export and generate a QR code to transfer them to another device.'**
  346. String get exportDescription;
  347. /// No description provided for @generateQr.
  348. ///
  349. /// In en, this message translates to:
  350. /// **'Generate QR'**
  351. String get generateQr;
  352. /// No description provided for @noAccountsSelected.
  353. ///
  354. /// In en, this message translates to:
  355. /// **'No accounts selected.'**
  356. String get noAccountsSelected;
  357. /// No description provided for @themeMode.
  358. ///
  359. /// In en, this message translates to:
  360. /// **'Theme'**
  361. String get themeMode;
  362. /// No description provided for @themeSystem.
  363. ///
  364. /// In en, this message translates to:
  365. /// **'System'**
  366. String get themeSystem;
  367. /// No description provided for @themeLight.
  368. ///
  369. /// In en, this message translates to:
  370. /// **'Light'**
  371. String get themeLight;
  372. /// No description provided for @themeDark.
  373. ///
  374. /// In en, this message translates to:
  375. /// **'Dark'**
  376. String get themeDark;
  377. /// No description provided for @preventScreenCapture.
  378. ///
  379. /// In en, this message translates to:
  380. /// **'Prevent screen capture'**
  381. String get preventScreenCapture;
  382. /// No description provided for @helpTitle.
  383. ///
  384. /// In en, this message translates to:
  385. /// **'Help'**
  386. String get helpTitle;
  387. /// No description provided for @helpBody.
  388. ///
  389. /// In en, this message translates to:
  390. /// **'Need assistance? Here you can find answers to common questions and tips for using PB Authenticator.'**
  391. String get helpBody;
  392. }
  393. class _AppLocalizationsDelegate
  394. extends LocalizationsDelegate<AppLocalizations> {
  395. const _AppLocalizationsDelegate();
  396. @override
  397. Future<AppLocalizations> load(Locale locale) {
  398. return SynchronousFuture<AppLocalizations>(lookupAppLocalizations(locale));
  399. }
  400. @override
  401. bool isSupported(Locale locale) =>
  402. <String>['en'].contains(locale.languageCode);
  403. @override
  404. bool shouldReload(_AppLocalizationsDelegate old) => false;
  405. }
  406. AppLocalizations lookupAppLocalizations(Locale locale) {
  407. // Lookup logic when only language code is specified.
  408. switch (locale.languageCode) {
  409. case 'en':
  410. return AppLocalizationsEn();
  411. }
  412. throw FlutterError(
  413. 'AppLocalizations.delegate failed to load unsupported locale "$locale". This is likely '
  414. 'an issue with the localizations generation tool. Please file an issue '
  415. 'on GitHub with a reproducible sample app and the gen-l10n configuration '
  416. 'that was used.');
  417. }