Unverified Commit e7d78b69 authored by Shi-Hao Hong's avatar Shi-Hao Hong Committed by GitHub

Use raw string for l10n description (#44451)

* Use raw string for l10n description

* Stock app refresh
parent 924ab725
...@@ -164,7 +164,7 @@ List<String> genIntlMethodArgs(Map<String, dynamic> bundle, String key) { ...@@ -164,7 +164,7 @@ List<String> genIntlMethodArgs(Map<String, dynamic> bundle, String key) {
if (attributesMap != null) { if (attributesMap != null) {
if (attributesMap.containsKey('description')) { if (attributesMap.containsKey('description')) {
final String description = attributesMap['description']; final String description = attributesMap['description'];
attributes.add('desc: \'$description\''); attributes.add('desc: ${generateString(description)}');
} }
if (attributesMap.containsKey('placeholders')) { if (attributesMap.containsKey('placeholders')) {
final Map<String, dynamic> placeholders = attributesMap['placeholders']; final Map<String, dynamic> placeholders = attributesMap['placeholders'];
......
...@@ -15,21 +15,21 @@ import 'package:intl/intl.dart'; ...@@ -15,21 +15,21 @@ import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart'; import 'package:intl/message_lookup_by_library.dart';
import 'package:intl/src/intl_helpers.dart'; import 'package:intl/src/intl_helpers.dart';
import 'messages_en_US.dart' as messages_en_us;
import 'messages_es_ES.dart' as messages_es_es; import 'messages_es_ES.dart' as messages_es_es;
import 'messages_en_US.dart' as messages_en_us;
typedef Future<dynamic> LibraryLoader(); typedef Future<dynamic> LibraryLoader();
Map<String, LibraryLoader> _deferredLibraries = { Map<String, LibraryLoader> _deferredLibraries = {
'en_US': () => new Future.value(null),
'es_ES': () => new Future.value(null), 'es_ES': () => new Future.value(null),
'en_US': () => new Future.value(null),
}; };
MessageLookupByLibrary _findExact(String localeName) { MessageLookupByLibrary _findExact(String localeName) {
switch (localeName) { switch (localeName) {
case 'en_US':
return messages_en_us.messages;
case 'es_ES': case 'es_ES':
return messages_es_es.messages; return messages_es_es.messages;
case 'en_US':
return messages_en_us.messages;
default: default:
return null; return null;
} }
......
...@@ -30,8 +30,7 @@ import 'messages_all.dart'; ...@@ -30,8 +30,7 @@ import 'messages_all.dart';
/// ///
/// ``` /// ```
/// dependencies: /// dependencies:
/// # rest of dependencies /// # Internationalization support.
///
/// flutter_localizations: /// flutter_localizations:
/// sdk: flutter /// sdk: flutter
/// intl: 0.16.0 /// intl: 0.16.0
...@@ -90,8 +89,8 @@ class StockStrings { ...@@ -90,8 +89,8 @@ class StockStrings {
/// A list of this localizations delegate's supported locales. /// A list of this localizations delegate's supported locales.
static const List<Locale> supportedLocales = <Locale>[ static const List<Locale> supportedLocales = <Locale>[
Locale('en', 'US'),
Locale('es', 'ES'), Locale('es', 'ES'),
Locale('en', 'US'),
]; ];
String title() { String title() {
...@@ -99,7 +98,7 @@ class StockStrings { ...@@ -99,7 +98,7 @@ class StockStrings {
r'Stocks', r'Stocks',
locale: _localeName, locale: _localeName,
name: 'title', name: 'title',
desc: 'Title for the Stocks application', desc: r'Title for the Stocks application',
args: <Object>[] args: <Object>[]
); );
} }
...@@ -109,7 +108,7 @@ class StockStrings { ...@@ -109,7 +108,7 @@ class StockStrings {
r'MARKET', r'MARKET',
locale: _localeName, locale: _localeName,
name: 'market', name: 'market',
desc: 'Label for the Market tab', desc: r'Label for the Market tab',
args: <Object>[] args: <Object>[]
); );
} }
...@@ -119,7 +118,7 @@ class StockStrings { ...@@ -119,7 +118,7 @@ class StockStrings {
r'PORTFOLIO', r'PORTFOLIO',
locale: _localeName, locale: _localeName,
name: 'portfolio', name: 'portfolio',
desc: 'Label for the Portfolio tab', desc: r'Label for the Portfolio tab',
args: <Object>[] args: <Object>[]
); );
} }
...@@ -133,7 +132,7 @@ class _StockStringsDelegate extends LocalizationsDelegate<StockStrings> { ...@@ -133,7 +132,7 @@ class _StockStringsDelegate extends LocalizationsDelegate<StockStrings> {
Future<StockStrings> load(Locale locale) => StockStrings.load(locale); Future<StockStrings> load(Locale locale) => StockStrings.load(locale);
@override @override
bool isSupported(Locale locale) => <String>['en', 'es'].contains(locale.languageCode); bool isSupported(Locale locale) => <String>['es', 'en'].contains(locale.languageCode);
@override @override
bool shouldReload(_StockStringsDelegate old) => false; bool shouldReload(_StockStringsDelegate old) => false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment