Revert "[gen-l10n] Fixes named and positional parameter issue with NumberFormat when type is specified (#75209)" (#75306)
This reverts commit 917577b808.
This commit is contained in:
@@ -146,24 +146,13 @@ String generateNumberFormattingLogic(Message message) {
|
||||
}
|
||||
final Iterable<String> parameters =
|
||||
placeholder.optionalParameters.map<String>((OptionalParameter parameter) {
|
||||
if (parameter.value is num) {
|
||||
return '${parameter.name}: ${parameter.value}';
|
||||
} else {
|
||||
return '${parameter.name}: ${generateString(parameter.value.toString())}';
|
||||
}
|
||||
return '${parameter.name}: ${parameter.value}';
|
||||
},
|
||||
);
|
||||
|
||||
if (placeholder.hasNumberFormatWithParameters) {
|
||||
return numberFormatNamedTemplate
|
||||
.replaceAll('@(placeholder)', placeholder.name)
|
||||
.replaceAll('@(format)', placeholder.format)
|
||||
.replaceAll('@(parameters)', parameters.join(',\n '));
|
||||
} else {
|
||||
return numberFormatPositionalTemplate
|
||||
.replaceAll('@(placeholder)', placeholder.name)
|
||||
.replaceAll('@(format)', placeholder.format);
|
||||
}
|
||||
return numberFormatTemplate
|
||||
.replaceAll('@(placeholder)', placeholder.name)
|
||||
.replaceAll('@(format)', placeholder.format)
|
||||
.replaceAll('@(parameters)', parameters.join(', \n'));
|
||||
});
|
||||
|
||||
return formatStatements.isEmpty ? '@(none)' : formatStatements.join('');
|
||||
|
||||
@@ -112,12 +112,7 @@ abstract class @(class) {
|
||||
@(delegateClass)
|
||||
''';
|
||||
|
||||
const String numberFormatPositionalTemplate = '''
|
||||
final intl.NumberFormat @(placeholder)NumberFormat = intl.NumberFormat.@(format)(localeName);
|
||||
final String @(placeholder)String = @(placeholder)NumberFormat.format(@(placeholder));
|
||||
''';
|
||||
|
||||
const String numberFormatNamedTemplate = '''
|
||||
const String numberFormatTemplate = '''
|
||||
final intl.NumberFormat @(placeholder)NumberFormat = intl.NumberFormat.@(format)(
|
||||
locale: localeName,
|
||||
@(parameters)
|
||||
|
||||
Reference in New Issue
Block a user