• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1import 'localizations_utils.dart';
2
3HeaderGenerator generateMaterialHeader = (String regenerateInstructions) {
4  return '''
5// Copyright 2017 The Chromium Authors. All rights reserved.
6// Use of this source code is governed by a BSD-style license that can be
7// found in the LICENSE file.
8
9// This file has been automatically generated. Please do not edit it manually.
10// To regenerate the file, use:
11// $regenerateInstructions
12
13import 'dart:collection';
14
15import 'package:flutter/foundation.dart';
16import 'package:flutter/material.dart';
17import 'package:intl/intl.dart' as intl;
18
19import '../material_localizations.dart';
20
21// The classes defined here encode all of the translations found in the
22// `flutter_localizations/lib/src/l10n/*.arb` files.
23//
24// These classes are constructed by the [getMaterialTranslation] method at the
25// bottom of this file, and used by the [_MaterialLocalizationsDelegate.load]
26// method defined in `flutter_localizations/lib/src/material_localizations.dart`.''';
27};
28
29/// Returns the source of the constructor for a GlobalMaterialLocalizations
30/// subclass.
31ConstructorGenerator generateMaterialConstructor = (LocaleInfo locale) {
32  final String localeName = locale.originalString;
33  return '''
34  /// Create an instance of the translation bundle for ${describeLocale(localeName)}.
35  ///
36  /// For details on the meaning of the arguments, see [GlobalMaterialLocalizations].
37  const MaterialLocalization${camelCase(locale)}({
38    String localeName = '$localeName',
39    @required intl.DateFormat fullYearFormat,
40    @required intl.DateFormat mediumDateFormat,
41    @required intl.DateFormat longDateFormat,
42    @required intl.DateFormat yearMonthFormat,
43    @required intl.NumberFormat decimalFormat,
44    @required intl.NumberFormat twoDigitZeroPaddedFormat,
45  }) : super(
46    localeName: localeName,
47    fullYearFormat: fullYearFormat,
48    mediumDateFormat: mediumDateFormat,
49    longDateFormat: longDateFormat,
50    yearMonthFormat: yearMonthFormat,
51    decimalFormat: decimalFormat,
52    twoDigitZeroPaddedFormat: twoDigitZeroPaddedFormat,
53  );''';
54};
55
56const String materialFactoryName = 'getMaterialTranslation';
57
58const String materialFactoryDeclaration = '''
59GlobalMaterialLocalizations getMaterialTranslation(
60  Locale locale,
61  intl.DateFormat fullYearFormat,
62  intl.DateFormat mediumDateFormat,
63  intl.DateFormat longDateFormat,
64  intl.DateFormat yearMonthFormat,
65  intl.NumberFormat decimalFormat,
66  intl.NumberFormat twoDigitZeroPaddedFormat,
67) {''';
68
69const String materialFactoryArguments =
70    'fullYearFormat: fullYearFormat, mediumDateFormat: mediumDateFormat, longDateFormat: longDateFormat, yearMonthFormat: yearMonthFormat, decimalFormat: decimalFormat, twoDigitZeroPaddedFormat: twoDigitZeroPaddedFormat';
71
72const String materialSupportedLanguagesConstant = 'kMaterialSupportedLanguages';
73
74const String materialSupportedLanguagesDocMacro = 'flutter.localizations.material.languages';
75