stock_strings.dart 1.31 KB
Newer Older
1 2 3 4
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5 6
import 'dart:async';

7 8
import 'package:intl/intl.dart';
import 'package:flutter/widgets.dart';
9

10
import 'i18n/stock_messages_all.dart';
11

12 13 14 15 16 17 18 19 20 21
// Information about how this file relates to i18n/stock_messages_all.dart and how the i18n files
// were generated can be found in i18n/regenerate.md.

class StockStrings {
  StockStrings(Locale locale) : _localeName = locale.toString();

  final String _localeName;

  static Future<StockStrings> load(Locale locale) {
    return initializeMessages(locale.toString())
22
      .then<StockStrings>((Object _) {
23
        return StockStrings(locale);
24
      });
25 26
  }

27 28 29
  static StockStrings of(BuildContext context) {
    return Localizations.of<StockStrings>(context, StockStrings);
  }
30

31 32 33 34 35 36 37 38
  String title() {
    return Intl.message(
      '<Stocks>',
      name: 'title',
      desc: 'Title for the Stocks application',
      locale: _localeName,
    );
  }
39

40
  String market() => Intl.message(
41 42
    'MARKET',
    name: 'market',
43 44
    desc: 'Label for the Market tab',
    locale: _localeName,
45 46
  );

47
  String portfolio() => Intl.message(
48 49
    'PORTFOLIO',
    name: 'portfolio',
50 51
    desc: 'Label for the Portfolio tab',
    locale: _localeName,
52 53
  );
}