Ian Hickson | 449f4a6 | 2019-11-27 15:04:02 -0800 | [diff] [blame] | 1 | // Copyright 2014 The Flutter Authors. All rights reserved. |
Ian Hickson | 1ce4a4f | 2019-11-08 16:53:21 -0800 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
xster | 5a6c140 | 2019-04-10 01:24:58 -0700 | [diff] [blame] | 5 | import 'localizations_utils.dart'; |
| 6 | |
| 7 | HeaderGenerator generateMaterialHeader = (String regenerateInstructions) { |
| 8 | return ''' |
Ian Hickson | 449f4a6 | 2019-11-27 15:04:02 -0800 | [diff] [blame] | 9 | // Copyright 2014 The Flutter Authors. All rights reserved. |
xster | 5a6c140 | 2019-04-10 01:24:58 -0700 | [diff] [blame] | 10 | // Use of this source code is governed by a BSD-style license that can be |
| 11 | // found in the LICENSE file. |
| 12 | |
| 13 | // This file has been automatically generated. Please do not edit it manually. |
| 14 | // To regenerate the file, use: |
| 15 | // $regenerateInstructions |
| 16 | |
| 17 | import 'dart:collection'; |
| 18 | |
| 19 | import 'package:flutter/foundation.dart'; |
| 20 | import 'package:flutter/material.dart'; |
| 21 | import 'package:intl/intl.dart' as intl; |
| 22 | |
| 23 | import '../material_localizations.dart'; |
| 24 | |
| 25 | // The classes defined here encode all of the translations found in the |
| 26 | // `flutter_localizations/lib/src/l10n/*.arb` files. |
| 27 | // |
| 28 | // These classes are constructed by the [getMaterialTranslation] method at the |
| 29 | // bottom of this file, and used by the [_MaterialLocalizationsDelegate.load] |
| 30 | // method defined in `flutter_localizations/lib/src/material_localizations.dart`.'''; |
| 31 | }; |
| 32 | |
| 33 | /// Returns the source of the constructor for a GlobalMaterialLocalizations |
| 34 | /// subclass. |
| 35 | ConstructorGenerator generateMaterialConstructor = (LocaleInfo locale) { |
| 36 | final String localeName = locale.originalString; |
| 37 | return ''' |
| 38 | /// Create an instance of the translation bundle for ${describeLocale(localeName)}. |
| 39 | /// |
| 40 | /// For details on the meaning of the arguments, see [GlobalMaterialLocalizations]. |
Hans Muller | 82c00c9 | 2020-02-05 06:35:49 -0800 | [diff] [blame] | 41 | const MaterialLocalization${locale.camelCase()}({ |
xster | 5a6c140 | 2019-04-10 01:24:58 -0700 | [diff] [blame] | 42 | String localeName = '$localeName', |
| 43 | @required intl.DateFormat fullYearFormat, |
Darren Austin | 142b526 | 2020-03-24 18:44:57 -0700 | [diff] [blame] | 44 | @required intl.DateFormat compactDateFormat, |
| 45 | @required intl.DateFormat shortDateFormat, |
xster | 5a6c140 | 2019-04-10 01:24:58 -0700 | [diff] [blame] | 46 | @required intl.DateFormat mediumDateFormat, |
| 47 | @required intl.DateFormat longDateFormat, |
| 48 | @required intl.DateFormat yearMonthFormat, |
Darren Austin | 142b526 | 2020-03-24 18:44:57 -0700 | [diff] [blame] | 49 | @required intl.DateFormat shortMonthDayFormat, |
xster | 5a6c140 | 2019-04-10 01:24:58 -0700 | [diff] [blame] | 50 | @required intl.NumberFormat decimalFormat, |
| 51 | @required intl.NumberFormat twoDigitZeroPaddedFormat, |
| 52 | }) : super( |
| 53 | localeName: localeName, |
| 54 | fullYearFormat: fullYearFormat, |
Darren Austin | 142b526 | 2020-03-24 18:44:57 -0700 | [diff] [blame] | 55 | compactDateFormat: compactDateFormat, |
| 56 | shortDateFormat: shortDateFormat, |
xster | 5a6c140 | 2019-04-10 01:24:58 -0700 | [diff] [blame] | 57 | mediumDateFormat: mediumDateFormat, |
| 58 | longDateFormat: longDateFormat, |
| 59 | yearMonthFormat: yearMonthFormat, |
Darren Austin | 142b526 | 2020-03-24 18:44:57 -0700 | [diff] [blame] | 60 | shortMonthDayFormat: shortMonthDayFormat, |
xster | 5a6c140 | 2019-04-10 01:24:58 -0700 | [diff] [blame] | 61 | decimalFormat: decimalFormat, |
| 62 | twoDigitZeroPaddedFormat: twoDigitZeroPaddedFormat, |
| 63 | );'''; |
| 64 | }; |
| 65 | |
xster | c7a09a4 | 2019-04-24 12:40:17 -0700 | [diff] [blame] | 66 | const String materialFactoryName = 'getMaterialTranslation'; |
| 67 | |
xster | 5a6c140 | 2019-04-10 01:24:58 -0700 | [diff] [blame] | 68 | const String materialFactoryDeclaration = ''' |
| 69 | GlobalMaterialLocalizations getMaterialTranslation( |
| 70 | Locale locale, |
| 71 | intl.DateFormat fullYearFormat, |
Darren Austin | 142b526 | 2020-03-24 18:44:57 -0700 | [diff] [blame] | 72 | intl.DateFormat compactDateFormat, |
| 73 | intl.DateFormat shortDateFormat, |
xster | 5a6c140 | 2019-04-10 01:24:58 -0700 | [diff] [blame] | 74 | intl.DateFormat mediumDateFormat, |
| 75 | intl.DateFormat longDateFormat, |
| 76 | intl.DateFormat yearMonthFormat, |
Darren Austin | 142b526 | 2020-03-24 18:44:57 -0700 | [diff] [blame] | 77 | intl.DateFormat shortMonthDayFormat, |
xster | 5a6c140 | 2019-04-10 01:24:58 -0700 | [diff] [blame] | 78 | intl.NumberFormat decimalFormat, |
| 79 | intl.NumberFormat twoDigitZeroPaddedFormat, |
| 80 | ) {'''; |
| 81 | |
| 82 | const String materialFactoryArguments = |
Darren Austin | 142b526 | 2020-03-24 18:44:57 -0700 | [diff] [blame] | 83 | 'fullYearFormat: fullYearFormat, compactDateFormat: compactDateFormat, shortDateFormat: shortDateFormat, mediumDateFormat: mediumDateFormat, longDateFormat: longDateFormat, yearMonthFormat: yearMonthFormat, shortMonthDayFormat: shortMonthDayFormat, decimalFormat: decimalFormat, twoDigitZeroPaddedFormat: twoDigitZeroPaddedFormat'; |
xster | c7a09a4 | 2019-04-24 12:40:17 -0700 | [diff] [blame] | 84 | |
| 85 | const String materialSupportedLanguagesConstant = 'kMaterialSupportedLanguages'; |
| 86 | |
| 87 | const String materialSupportedLanguagesDocMacro = 'flutter.localizations.material.languages'; |