Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(45)

Unified Diff: pkg/intl/lib/message_lookup_local.dart

Issue 11783009: Big merge from experimental to bleeding edge. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/intl/lib/intl_standalone.dart ('k') | pkg/intl/lib/src/date_format_internal.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/intl/lib/message_lookup_local.dart
diff --git a/pkg/intl/lib/message_lookup_local.dart b/pkg/intl/lib/message_lookup_local.dart
index 9c62fb33f4bf3b387338933eeff39a2cc1dbe7a9..e8a0e97ebb09ba3df15a9ebc00fe9ca01a726416 100644
--- a/pkg/intl/lib/message_lookup_local.dart
+++ b/pkg/intl/lib/message_lookup_local.dart
@@ -15,6 +15,7 @@
library message_lookup_local;
+import 'dart:async';
import 'intl.dart';
import 'src/intl_helpers.dart';
import 'dart:mirrors';
@@ -88,13 +89,13 @@ class MessageLookupLocal {
* will be extracted automatically but for the time being it must be passed
* explicitly in the [name] and [args] arguments.
*/
- String lookupMessage(String message_str, [final String desc='',
+ Future<String> lookupMessage(String message_str, [final String desc='',
final Map examples=const {}, String locale,
String name, List<String> args]) {
- if (name == null) return message_str;
+ if (name == null) return new Future.immediate(message_str);
// The translations also make use of Intl.message, so we need to not
// recurse and just stop when we find the first substitution.
- if (_lookupInProgress) return message_str;
+ if (_lookupInProgress) return new Future.immediate(message_str);
_lookupInProgress = true;
var result;
try {
@@ -108,14 +109,15 @@ class MessageLookupLocal {
onFailure: (locale)=>locale);
LibraryMirror messagesForThisLocale =
_libraries['$_sourcePrefix$verifiedLocale'];
- if (messagesForThisLocale == null) return message_str;
+ if (messagesForThisLocale == null) {
+ return new Future.immediate(message_str);
+ }
MethodMirror localized = messagesForThisLocale.functions[name];
- if (localized == null) return message_str;
+ if (localized == null) return new Future.immediate(message_str);
result = messagesForThisLocale.invoke(localized.simpleName, args);
- }
- finally {
+ } finally {
_lookupInProgress = false;
}
- return result.value.reflectee;
+ return result.then((value) => value.reflectee);
}
-}
+}
« no previous file with comments | « pkg/intl/lib/intl_standalone.dart ('k') | pkg/intl/lib/src/date_format_internal.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698