app_localizations.dart 14 KB

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