Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
667c38d5
Unverified
Commit
667c38d5
authored
Jan 16, 2020
by
Hans Muller
Committed by
GitHub
Jan 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gen_l10n: generated Intl.message parameter should be an ordinary string (#48929)
parent
c51059f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
10 deletions
+12
-10
gen_l10n.dart
dev/tools/localization/gen_l10n.dart
+4
-2
gen_l10n_test.dart
dev/tools/test/localization/gen_l10n_test.dart
+8
-8
No files found.
dev/tools/localization/gen_l10n.dart
View file @
667c38d5
...
...
@@ -456,18 +456,20 @@ String genSimpleMethod(Map<String, dynamic> arbBundle, String resourceId) {
);
if
(
attributesMap
.
containsKey
(
'placeholders'
))
{
final
String
rawMessageString
=
genSimpleMethodMessage
(
arbBundle
,
resourceId
);
// "r'...'"
return
simpleMethodTemplate
.
replaceAll
(
'@methodName'
,
resourceId
)
.
replaceAll
(
'@methodParameters'
,
genMethodParameters
(
arbBundle
,
resourceId
,
'Object'
).
join
(
', '
))
.
replaceAll
(
'@dateFormatting'
,
generateDateFormattingLogic
(
arbBundle
,
resourceId
))
.
replaceAll
(
'@numberFormatting'
,
generateNumberFormattingLogic
(
arbBundle
,
resourceId
))
.
replaceAll
(
'@message'
,
'
${
genSimpleMethodMessage(arbBundle, resourceId
)}
'
)
.
replaceAll
(
'@message'
,
'
${
rawMessageString.substring(1
)}
'
)
.
replaceAll
(
'@intlMethodArgs'
,
genIntlMethodArgs
(
arbBundle
,
resourceId
).
join
(
',
\n
'
));
}
final
String
rawMessageString
=
generateString
(
arbBundle
[
resourceId
]
as
String
);
// "r'...'"
return
getterMethodTemplate
.
replaceAll
(
'@methodName'
,
resourceId
)
.
replaceAll
(
'@message'
,
'
${
generateString(arbBundle[resourceId] as String
)}
'
)
.
replaceAll
(
'@message'
,
'
${
rawMessageString.substring(1
)}
'
)
.
replaceAll
(
'@intlMethodArgs'
,
genIntlMethodArgs
(
arbBundle
,
resourceId
).
join
(
',
\n
'
));
}
...
...
dev/tools/test/localization/gen_l10n_test.dart
View file @
667c38d5
...
...
@@ -611,7 +611,7 @@ void main() {
generator
.
classMethods
.
first
,
''' String get title {
return Intl.message(
r
'
Title
',
'
Title
',
locale: _localeName,
name: '
title
',
desc: r'
Title
for
the
application
'
...
...
@@ -656,7 +656,7 @@ void main() {
generator
.
classMethods
.
first
,
''' String itemNumber(Object value) {
return Intl.message(
r
\'
Item
\
$value
\'
,
\'
Item
\
$value
\'
,
locale: _localeName,
name: '
itemNumber
',
desc: r
\'
Item placement in list.
\'
,
...
...
@@ -707,7 +707,7 @@ void main() {
final String springStartDateString = springStartDateDateFormat.format(springStartDate);
return Intl.message(
r
'
Spring
begins
on
\
$springStartDateString
',
'
Spring
begins
on
\
$springStartDateString
',
locale: _localeName,
name: '
springBegins
',
desc: r'
The
first
day
of
spring
',
...
...
@@ -831,7 +831,7 @@ void main() {
final String springStartDateString = springStartDateDateFormat.format(springStartDate);
return Intl.message(
r
\'
Since it
\'
"
\
'" r
\'
s
\
$springStartDateString
, it
\'
"
\'
" r
\'
s finally spring!
\
$helloWorld
!
\'
,
\'
Since it
\'
"
\
'" r
\'
s
\
$springStartDateString
, it
\'
"
\'
" r
\'
s finally spring!
\
$helloWorld
!
\'
,
locale: _localeName,
name: '
springGreetings
',
desc: r
\'
A realization that it
\'
"
\'
" r
\'
s finally the spring season, followed by a greeting.
\'
,
...
...
@@ -888,7 +888,7 @@ void main() {
final String springEndDateString = springEndDateDateFormat.format(springEndDate);
return Intl.message(
r
\'
Spring begins on
\
$springStartDateString
and ends on
\
$springEndDateString
\'
,
\'
Spring begins on
\
$springStartDateString
and ends on
\
$springEndDateString
\'
,
locale: _localeName,
name: '
springRange
',
desc: r
\'
The range of dates for spring in the year
\'
,
...
...
@@ -996,7 +996,7 @@ void main() {
final String progressString = progressNumberFormat.format(progress);
return Intl.message(
r
'
You
have
completed
\
$progressString
of
the
course
.
',
'
You
have
completed
\
$progressString
of
the
course
.
',
locale: _localeName,
name: '
courseCompletion
',
desc: r'
The
amount
of
progress
the
student
has
made
in
their
class
.',
...
...
@@ -1063,7 +1063,7 @@ void main() {
final
String
progressString
=
progressNumberFormat
.
format
(
progress
);
return
Intl
.
message
(
r
'You have completed \$progressString of the course.'
,
'You have completed
\
$progressString
of the course.'
,
locale:
_localeName
,
name:
'courseCompletion'
,
desc:
r'The amount of progress the student has made in their class.'
,
...
...
@@ -1121,7 +1121,7 @@ void main() {
final
String
progressString
=
progressNumberFormat
.
format
(
progress
);
return
Intl
.
message
(
r
'You have completed \$progressString of the course.'
,
'You have completed
\
$progressString
of the course.'
,
locale:
_localeName
,
name:
'courseCompletion'
,
desc:
r'The amount of progress the student has made in their class.'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment