Skip to content

Commit

Permalink
No public description
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 693191237
  • Loading branch information
Googler authored and copybara-github committed Nov 14, 2024
1 parent dff57eb commit f2fa571
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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('');
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
3 changes: 2 additions & 1 deletion pkgs/intl_translation/lib/src/messages/main_message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pkgs/intl_translation/lib/src/messages/message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
2 changes: 1 addition & 1 deletion pkgs/intl_translation/lib/src/messages/pair_message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class PairMessage<T extends Message, S extends Message> 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!);
}

0 comments on commit f2fa571

Please sign in to comment.