Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No public description #905

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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!);
}
Loading