• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1import 'localizations_utils.dart';
2
3HeaderGenerator generateCupertinoHeader = (String regenerateInstructions) {
4  return '''
5// Copyright 2019 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/cupertino.dart';
17import 'package:intl/intl.dart' as intl;
18
19import '../cupertino_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 [getCupertinoTranslation] method at the
25// bottom of this file, and used by the [_GlobalCupertinoLocalizationsDelegate.load]
26// method defined in `flutter_localizations/lib/src/cupertino_localizations.dart`.''';
27};
28
29/// Returns the source of the constructor for a GlobalCupertinoLocalizations
30/// subclass.
31ConstructorGenerator generateCupertinoConstructor = (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 [GlobalCupertinoLocalizations].
37  const CupertinoLocalization${camelCase(locale)}({
38    String localeName = '$localeName',
39    @required intl.DateFormat fullYearFormat,
40    @required intl.DateFormat dayFormat,
41    @required intl.DateFormat mediumDateFormat,
42    @required intl.DateFormat singleDigitHourFormat,
43    @required intl.DateFormat singleDigitMinuteFormat,
44    @required intl.DateFormat doubleDigitMinuteFormat,
45    @required intl.DateFormat singleDigitSecondFormat,
46    @required intl.NumberFormat decimalFormat,
47  }) : super(
48    localeName: localeName,
49    fullYearFormat: fullYearFormat,
50    dayFormat: dayFormat,
51    mediumDateFormat: mediumDateFormat,
52    singleDigitHourFormat: singleDigitHourFormat,
53    singleDigitMinuteFormat: singleDigitMinuteFormat,
54    doubleDigitMinuteFormat: doubleDigitMinuteFormat,
55    singleDigitSecondFormat: singleDigitSecondFormat,
56    decimalFormat: decimalFormat,
57  );''';
58};
59
60const String cupertinoFactoryName = 'getCupertinoTranslation';
61
62const String cupertinoFactoryDeclaration = '''
63GlobalCupertinoLocalizations getCupertinoTranslation(
64  Locale locale,
65  intl.DateFormat fullYearFormat,
66  intl.DateFormat dayFormat,
67  intl.DateFormat mediumDateFormat,
68  intl.DateFormat singleDigitHourFormat,
69  intl.DateFormat singleDigitMinuteFormat,
70  intl.DateFormat doubleDigitMinuteFormat,
71  intl.DateFormat singleDigitSecondFormat,
72  intl.NumberFormat decimalFormat,
73) {''';
74
75const String cupertinoFactoryArguments =
76    'fullYearFormat: fullYearFormat, dayFormat: dayFormat, mediumDateFormat: mediumDateFormat, singleDigitHourFormat: singleDigitHourFormat, singleDigitMinuteFormat: singleDigitMinuteFormat, doubleDigitMinuteFormat: doubleDigitMinuteFormat, singleDigitSecondFormat: singleDigitSecondFormat, decimalFormat: decimalFormat';
77
78const String cupertinoSupportedLanguagesConstant = 'kCupertinoSupportedLanguages';
79
80const String cupertinoSupportedLanguagesDocMacro = 'flutter.localizations.cupertino.languages';
81