blob: e22c09fd84fced4b9561615d9c9981c7dab4949b [file] [log] [blame]
Ian Hickson449f4a62019-11-27 15:04:02 -08001// Copyright 2014 The Flutter Authors. All rights reserved.
Ian Hickson1ce4a4f2019-11-08 16:53:21 -08002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
xster5a6c1402019-04-10 01:24:58 -07005import 'localizations_utils.dart';
6
7HeaderGenerator generateMaterialHeader = (String regenerateInstructions) {
8 return '''
Ian Hickson449f4a62019-11-27 15:04:02 -08009// Copyright 2014 The Flutter Authors. All rights reserved.
xster5a6c1402019-04-10 01:24:58 -070010// 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
17import 'dart:collection';
18
19import 'package:flutter/foundation.dart';
20import 'package:flutter/material.dart';
21import 'package:intl/intl.dart' as intl;
22
23import '../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.
35ConstructorGenerator 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 Muller82c00c92020-02-05 06:35:49 -080041 const MaterialLocalization${locale.camelCase()}({
xster5a6c1402019-04-10 01:24:58 -070042 String localeName = '$localeName',
43 @required intl.DateFormat fullYearFormat,
Darren Austin142b5262020-03-24 18:44:57 -070044 @required intl.DateFormat compactDateFormat,
45 @required intl.DateFormat shortDateFormat,
xster5a6c1402019-04-10 01:24:58 -070046 @required intl.DateFormat mediumDateFormat,
47 @required intl.DateFormat longDateFormat,
48 @required intl.DateFormat yearMonthFormat,
Darren Austin142b5262020-03-24 18:44:57 -070049 @required intl.DateFormat shortMonthDayFormat,
xster5a6c1402019-04-10 01:24:58 -070050 @required intl.NumberFormat decimalFormat,
51 @required intl.NumberFormat twoDigitZeroPaddedFormat,
52 }) : super(
53 localeName: localeName,
54 fullYearFormat: fullYearFormat,
Darren Austin142b5262020-03-24 18:44:57 -070055 compactDateFormat: compactDateFormat,
56 shortDateFormat: shortDateFormat,
xster5a6c1402019-04-10 01:24:58 -070057 mediumDateFormat: mediumDateFormat,
58 longDateFormat: longDateFormat,
59 yearMonthFormat: yearMonthFormat,
Darren Austin142b5262020-03-24 18:44:57 -070060 shortMonthDayFormat: shortMonthDayFormat,
xster5a6c1402019-04-10 01:24:58 -070061 decimalFormat: decimalFormat,
62 twoDigitZeroPaddedFormat: twoDigitZeroPaddedFormat,
63 );''';
64};
65
xsterc7a09a42019-04-24 12:40:17 -070066const String materialFactoryName = 'getMaterialTranslation';
67
xster5a6c1402019-04-10 01:24:58 -070068const String materialFactoryDeclaration = '''
69GlobalMaterialLocalizations getMaterialTranslation(
70 Locale locale,
71 intl.DateFormat fullYearFormat,
Darren Austin142b5262020-03-24 18:44:57 -070072 intl.DateFormat compactDateFormat,
73 intl.DateFormat shortDateFormat,
xster5a6c1402019-04-10 01:24:58 -070074 intl.DateFormat mediumDateFormat,
75 intl.DateFormat longDateFormat,
76 intl.DateFormat yearMonthFormat,
Darren Austin142b5262020-03-24 18:44:57 -070077 intl.DateFormat shortMonthDayFormat,
xster5a6c1402019-04-10 01:24:58 -070078 intl.NumberFormat decimalFormat,
79 intl.NumberFormat twoDigitZeroPaddedFormat,
80) {''';
81
82const String materialFactoryArguments =
Darren Austin142b5262020-03-24 18:44:57 -070083 'fullYearFormat: fullYearFormat, compactDateFormat: compactDateFormat, shortDateFormat: shortDateFormat, mediumDateFormat: mediumDateFormat, longDateFormat: longDateFormat, yearMonthFormat: yearMonthFormat, shortMonthDayFormat: shortMonthDayFormat, decimalFormat: decimalFormat, twoDigitZeroPaddedFormat: twoDigitZeroPaddedFormat';
xsterc7a09a42019-04-24 12:40:17 -070084
85const String materialSupportedLanguagesConstant = 'kMaterialSupportedLanguages';
86
87const String materialSupportedLanguagesDocMacro = 'flutter.localizations.material.languages';