Use raw string for l10n description (#44451)
* Use raw string for l10n description
* Stock app refresh
diff --git a/dev/tools/localization/gen_l10n.dart b/dev/tools/localization/gen_l10n.dart
index dbc7956..95d53ae 100644
--- a/dev/tools/localization/gen_l10n.dart
+++ b/dev/tools/localization/gen_l10n.dart
@@ -164,7 +164,7 @@
if (attributesMap != null) {
if (attributesMap.containsKey('description')) {
final String description = attributesMap['description'];
- attributes.add('desc: \'$description\'');
+ attributes.add('desc: ${generateString(description)}');
}
if (attributesMap.containsKey('placeholders')) {
final Map<String, dynamic> placeholders = attributesMap['placeholders'];
diff --git a/examples/stocks/lib/i18n/messages_all.dart b/examples/stocks/lib/i18n/messages_all.dart
index 867afc7..2ea2655 100644
--- a/examples/stocks/lib/i18n/messages_all.dart
+++ b/examples/stocks/lib/i18n/messages_all.dart
@@ -15,21 +15,21 @@
import 'package:intl/message_lookup_by_library.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_en_US.dart' as messages_en_us;
typedef Future<dynamic> LibraryLoader();
Map<String, LibraryLoader> _deferredLibraries = {
- 'en_US': () => new Future.value(null),
'es_ES': () => new Future.value(null),
+ 'en_US': () => new Future.value(null),
};
MessageLookupByLibrary _findExact(String localeName) {
switch (localeName) {
- case 'en_US':
- return messages_en_us.messages;
case 'es_ES':
return messages_es_es.messages;
+ case 'en_US':
+ return messages_en_us.messages;
default:
return null;
}
diff --git a/examples/stocks/lib/i18n/stock_strings.dart b/examples/stocks/lib/i18n/stock_strings.dart
index 8fc351c..d8a3c81 100644
--- a/examples/stocks/lib/i18n/stock_strings.dart
+++ b/examples/stocks/lib/i18n/stock_strings.dart
@@ -30,8 +30,7 @@
///
/// ```
/// dependencies:
-/// # rest of dependencies
-///
+/// # Internationalization support.
/// flutter_localizations:
/// sdk: flutter
/// intl: 0.16.0
@@ -90,8 +89,8 @@
/// A list of this localizations delegate's supported locales.
static const List<Locale> supportedLocales = <Locale>[
- Locale('en', 'US'),
Locale('es', 'ES'),
+ Locale('en', 'US'),
];
String title() {
@@ -99,7 +98,7 @@
r'Stocks',
locale: _localeName,
name: 'title',
- desc: 'Title for the Stocks application',
+ desc: r'Title for the Stocks application',
args: <Object>[]
);
}
@@ -109,7 +108,7 @@
r'MARKET',
locale: _localeName,
name: 'market',
- desc: 'Label for the Market tab',
+ desc: r'Label for the Market tab',
args: <Object>[]
);
}
@@ -119,7 +118,7 @@
r'PORTFOLIO',
locale: _localeName,
name: 'portfolio',
- desc: 'Label for the Portfolio tab',
+ desc: r'Label for the Portfolio tab',
args: <Object>[]
);
}
@@ -133,7 +132,7 @@
Future<StockStrings> load(Locale locale) => StockStrings.load(locale);
@override
- bool isSupported(Locale locale) => <String>['en', 'es'].contains(locale.languageCode);
+ bool isSupported(Locale locale) => <String>['es', 'en'].contains(locale.languageCode);
@override
bool shouldReload(_StockStringsDelegate old) => false;