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
9c5009b2
Unverified
Commit
9c5009b2
authored
Mar 05, 2020
by
Flutter GitHub Bot
Committed by
GitHub
Mar 05, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[gen_l10n] Escape quote characters in ARB files (#51952)
parent
cccbf1f2
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
33 additions
and
14 deletions
+33
-14
regenerate.md
dev/benchmarks/test_apps/stocks/lib/i18n/regenerate.md
+1
-1
stocks_en.arb
dev/benchmarks/test_apps/stocks/lib/i18n/stocks_en.arb
+12
-1
stocks_en_US.arb
dev/benchmarks/test_apps/stocks/lib/i18n/stocks_en_US.arb
+1
-12
gen_l10n.dart
dev/tools/localization/gen_l10n.dart
+5
-0
gen_l10n_test.dart
...s/flutter_tools/test/integration.shard/gen_l10n_test.dart
+2
-0
gen_l10n_project.dart
...ls/test/integration.shard/test_data/gen_l10n_project.dart
+12
-0
No files found.
dev/benchmarks/test_apps/stocks/lib/i18n/regenerate.md
View file @
9c5009b2
...
@@ -17,7 +17,7 @@ for more info.
...
@@ -17,7 +17,7 @@ for more info.
```
dart
```
dart
dart
$
{
FLUTTER_PATH
}/
dev
/
tools
/
localization
/
bin
/
gen_l10n
.
dart
--
arb
-
dir
=
lib
/
i18n
\
dart
$
{
FLUTTER_PATH
}/
dev
/
tools
/
localization
/
bin
/
gen_l10n
.
dart
--
arb
-
dir
=
lib
/
i18n
\
--
template
-
arb
-
file
=
stocks_en
_US
.
arb
--
output
-
localization
-
file
=
stock_strings
.
dart
\
--
template
-
arb
-
file
=
stocks_en
.
arb
--
output
-
localization
-
file
=
stock_strings
.
dart
\
--
output
-
class
=
StockStrings
--
output
-
class
=
StockStrings
```
```
...
...
dev/benchmarks/test_apps/stocks/lib/i18n/stocks_en.arb
View file @
9c5009b2
{
{
"title"
:
"Stocks"
,
"title"
:
"Stocks"
,
"@title"
:
{
"description"
:
"Title for the Stocks application"
},
"market"
:
"MARKET"
,
"market"
:
"MARKET"
,
"portfolio"
:
"PORTFOLIO"
"@market"
:
{
"description"
:
"Label for the Market tab"
},
"portfolio"
:
"PORTFOLIO"
,
"@portfolio"
:
{
"description"
:
"Label for the Portfolio tab"
}
}
}
dev/benchmarks/test_apps/stocks/lib/i18n/stocks_en_US.arb
View file @
9c5009b2
{
{
"title"
:
"Stocks"
,
"title"
:
"Stocks"
,
"@title"
:
{
"description"
:
"Title for the Stocks application"
},
"market"
:
"MARKET"
,
"market"
:
"MARKET"
,
"@market"
:
{
"portfolio"
:
"PORTFOLIO"
"description"
:
"Label for the Market tab"
},
"portfolio"
:
"PORTFOLIO"
,
"@portfolio"
:
{
"description"
:
"Label for the Portfolio tab"
}
}
}
dev/tools/localization/gen_l10n.dart
View file @
9c5009b2
...
@@ -163,6 +163,11 @@ String generateMethod(Message message, AppResourceBundle bundle) {
...
@@ -163,6 +163,11 @@ String generateMethod(Message message, AppResourceBundle bundle) {
messageValue
=
messageValue
.
replaceAll
(
'{
${placeholder.name}
}'
,
'
\
${${placeholder.name}
}'
);
messageValue
=
messageValue
.
replaceAll
(
'{
${placeholder.name}
}'
,
'
\
${${placeholder.name}
}'
);
}
}
}
}
// Escape single and double quotes.
messageValue
=
messageValue
.
replaceAll
(
"'"
,
'
\\\'
'
);
messageValue
=
messageValue
.
replaceAll
(
'"'
,
'
\\\"
'
);
return
"'
$messageValue
'"
;
return
"'
$messageValue
'"
;
}
}
...
...
packages/flutter_tools/test/integration.shard/gen_l10n_test.dart
View file @
9c5009b2
...
@@ -101,6 +101,8 @@ void main() {
...
@@ -101,6 +101,8 @@ void main() {
'#l10n 22 (Hello World of 101 citizens)
\n
'
'#l10n 22 (Hello World of 101 citizens)
\n
'
'#l10n 23 (Hello two worlds with 102 total citizens)
\n
'
'#l10n 23 (Hello two worlds with 102 total citizens)
\n
'
'#l10n 24 ([Hello] -World- #123#)
\n
'
'#l10n 24 ([Hello] -World- #123#)
\n
'
'#l10n 25 (Flutter
\'
s amazing!)
\n
'
'#l10n 26 (Flutter is "amazing"!)
\n
'
'#l10n END
\n
'
'#l10n END
\n
'
);
);
});
});
...
...
packages/flutter_tools/test/integration.shard/test_data/gen_l10n_project.dart
View file @
9c5009b2
...
@@ -108,6 +108,8 @@ class Home extends StatelessWidget {
...
@@ -108,6 +108,8 @@ class Home extends StatelessWidget {
'
$
{
localizations
.
helloWorldPopulation
(
1
,
101
)}
',
'
$
{
localizations
.
helloWorldPopulation
(
1
,
101
)}
',
'
$
{
localizations
.
helloWorldPopulation
(
2
,
102
)}
',
'
$
{
localizations
.
helloWorldPopulation
(
2
,
102
)}
',
'
$
{
localizations
.
helloWorldsInterpolation
(
123
,
"Hello"
,
"World"
)}
',
'
$
{
localizations
.
helloWorldsInterpolation
(
123
,
"Hello"
,
"World"
)}
',
'
$
{
localizations
.
singleQuote
}
',
'
$
{
localizations
.
doubleQuote
}
',
]);
]);
for (final String result in results) {
for (final String result in results) {
print('
#l10n
$n
(
$result
)
\
n
');
print('
#l10n
$n
(
$result
)
\
n
');
...
@@ -286,6 +288,16 @@ void main() {
...
@@ -286,6 +288,16 @@ void main() {
"hello": {},
"hello": {},
"world": {}
"world": {}
}
}
},
"singleQuote": "Flutter'
s
amazing
!
",
"
@singleQuote
": {
"
description
": "
A
message
with
a
single
quote
.
"
},
"
doubleQuote
": "
Flutter
is
\
"amazing
\"
!"
,
"@doubleQuote"
:
{
"description"
:
"A message with double quotes."
}
}
}
}
''';
''';
...
...
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