From 304632f949ab972090f983a0eafc4e3bb351ab1d Mon Sep 17 00:00:00 2001 From: Googler Date: Thu, 14 Nov 2024 07:55:15 -0800 Subject: [PATCH] No public description PiperOrigin-RevId: 696522560 --- .../intl_translation/lib/src/messages/composite_message.dart | 2 +- .../lib/src/messages/literal_string_message.dart | 2 +- pkgs/intl_translation/lib/src/messages/main_message.dart | 3 ++- pkgs/intl_translation/lib/src/messages/message.dart | 4 ++-- pkgs/intl_translation/lib/src/messages/pair_message.dart | 2 +- .../lib/src/messages/submessages/submessage.dart | 5 +++-- .../lib/src/messages/variable_substitution_message.dart | 4 ++-- 7 files changed, 12 insertions(+), 10 deletions(-) diff --git a/pkgs/intl_translation/lib/src/messages/composite_message.dart b/pkgs/intl_translation/lib/src/messages/composite_message.dart index 76191947..a3a66eb4 100644 --- a/pkgs/intl_translation/lib/src/messages/composite_message.dart +++ b/pkgs/intl_translation/lib/src/messages/composite_message.dart @@ -23,6 +23,6 @@ class CompositeMessage extends Message { String toString() => 'CompositeMessage($pieces)'; @override String expanded( - [String Function(dynamic, dynamic) transform = nullTransform]) => + [String Function(Message, Object) transform = nullTransform]) => pieces.map((chunk) => transform(this, chunk)).join(''); } diff --git a/pkgs/intl_translation/lib/src/messages/literal_string_message.dart b/pkgs/intl_translation/lib/src/messages/literal_string_message.dart index 9ad56c54..f5343818 100644 --- a/pkgs/intl_translation/lib/src/messages/literal_string_message.dart +++ b/pkgs/intl_translation/lib/src/messages/literal_string_message.dart @@ -16,6 +16,6 @@ class LiteralString extends Message { String toString() => 'Literal($string)'; @override String expanded( - [String Function(dynamic, dynamic) transform = nullTransform]) => + [String Function(Message, Object) transform = nullTransform]) => transform(this, string); } diff --git a/pkgs/intl_translation/lib/src/messages/main_message.dart b/pkgs/intl_translation/lib/src/messages/main_message.dart index fbc7ff88..9943fde1 100644 --- a/pkgs/intl_translation/lib/src/messages/main_message.dart +++ b/pkgs/intl_translation/lib/src/messages/main_message.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'package:analyzer/dart/ast/ast.dart'; + import 'complex_message.dart'; import 'message.dart'; import 'message_extraction_exception.dart'; @@ -121,7 +122,7 @@ class MainMessage extends ComplexMessage { /// See [messagePieces]. @override String expanded( - [String Function(Message, dynamic) transform = nullTransform]) => + [String Function(Message, Object) transform = nullTransform]) => messagePieces.map((chunk) => transform(this, chunk)).join(''); /// Record the translation for this message in the given locale, after diff --git a/pkgs/intl_translation/lib/src/messages/message.dart b/pkgs/intl_translation/lib/src/messages/message.dart index 81fcbb9c..e66bdf34 100644 --- a/pkgs/intl_translation/lib/src/messages/message.dart +++ b/pkgs/intl_translation/lib/src/messages/message.dart @@ -369,8 +369,8 @@ abstract class Message { return value; } - /// Expand this string out into a printed form. The function [f] will be + /// Expand this string out into a printed form. The function [transform] is /// applied to any sub-messages, allowing this to be used to generate a form /// suitable for a wide variety of translation file formats. - String expanded([String Function(dynamic, dynamic) transform]); + String expanded([String Function(Message, Object) transform]); } diff --git a/pkgs/intl_translation/lib/src/messages/pair_message.dart b/pkgs/intl_translation/lib/src/messages/pair_message.dart index 74450861..03896c78 100644 --- a/pkgs/intl_translation/lib/src/messages/pair_message.dart +++ b/pkgs/intl_translation/lib/src/messages/pair_message.dart @@ -12,7 +12,7 @@ class PairMessage extends Message { @override String expanded( - [String Function(dynamic, dynamic) transform = nullTransform]) => + [String Function(Message, Object) transform = nullTransform]) => [first, second].map((chunk) => transform(this, chunk)).join(''); @override diff --git a/pkgs/intl_translation/lib/src/messages/submessages/submessage.dart b/pkgs/intl_translation/lib/src/messages/submessages/submessage.dart index 8391804f..a6a20bd3 100644 --- a/pkgs/intl_translation/lib/src/messages/submessages/submessage.dart +++ b/pkgs/intl_translation/lib/src/messages/submessages/submessage.dart @@ -3,6 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'package:analyzer/dart/ast/ast.dart'; + import '../complex_message.dart'; import '../composite_message.dart'; import '../literal_string_message.dart'; @@ -59,9 +60,9 @@ abstract class SubMessage extends ComplexMessage { @override String expanded( - [String Function(dynamic, dynamic) transform = nullTransform]) { + [String Function(Message, Object) transform = nullTransform]) { String fullMessageForClause(String key) => - '$key{${transform(parent, this[key])}}'; + '$key{${transform(parent!, this[key])}}'; var clauses = attributeNames .where((key) => this[key] != null) .map(fullMessageForClause) diff --git a/pkgs/intl_translation/lib/src/messages/variable_substitution_message.dart b/pkgs/intl_translation/lib/src/messages/variable_substitution_message.dart index acc56e55..d7ef572e 100644 --- a/pkgs/intl_translation/lib/src/messages/variable_substitution_message.dart +++ b/pkgs/intl_translation/lib/src/messages/variable_substitution_message.dart @@ -62,6 +62,6 @@ class VariableSubstitution extends Message { String toString() => 'VariableSubstitution(${index ?? _variableName})'; @override String expanded( - [String Function(dynamic, dynamic) transform = nullTransform]) => - transform(this, index); + [String Function(Message, Object) transform = nullTransform]) => + transform(this, index!); }