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
b0bd7cf1
Unverified
Commit
b0bd7cf1
authored
Jul 01, 2021
by
Shi-Hao Hong
Committed by
GitHub
Jul 01, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make app localizations lookup a public method (#84732)
parent
aeca5c95
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
2 deletions
+28
-2
gen_l10n.dart
packages/flutter_tools/lib/src/localizations/gen_l10n.dart
+2
-2
generate_localizations_test.dart
...tools/test/general.shard/generate_localizations_test.dart
+26
-0
No files found.
packages/flutter_tools/lib/src/localizations/gen_l10n.dart
View file @
b0bd7cf1
...
...
@@ -541,11 +541,11 @@ String _generateDelegateClass({
useDeferredLoading
?
loadBodyDeferredLoadingTemplate
:
loadBodyTemplate
)
.
replaceAll
(
'@(class)'
,
className
)
.
replaceAll
(
'@(lookupName)'
,
'
_
lookup
$className
'
);
.
replaceAll
(
'@(lookupName)'
,
'lookup
$className
'
);
final
String
lookupFunction
=
(
useDeferredLoading
?
lookupFunctionDeferredLoadingTemplate
:
lookupFunctionTemplate
)
.
replaceAll
(
'@(class)'
,
className
)
.
replaceAll
(
'@(lookupName)'
,
'
_
lookup
$className
'
)
.
replaceAll
(
'@(lookupName)'
,
'lookup
$className
'
)
.
replaceAll
(
'@(lookupBody)'
,
lookupBody
);
return
delegateClassTemplate
.
replaceAll
(
'@(class)'
,
className
)
...
...
packages/flutter_tools/test/general.shard/generate_localizations_test.dart
View file @
b0bd7cf1
...
...
@@ -2449,4 +2449,30 @@ String orderNumber(int number) {
'''
));
expect
(
localizationsFile
,
isNot
(
contains
(
intlImportDartCode
)));
});
testWithoutContext
(
'app localizations lookup is a public method'
,
()
{
final
Directory
l10nDirectory
=
fs
.
currentDirectory
.
childDirectory
(
'lib'
).
childDirectory
(
'l10n'
)
..
createSync
(
recursive:
true
);
l10nDirectory
.
childFile
(
defaultTemplateArbFileName
)
.
writeAsStringSync
(
singleMessageArbFileString
);
LocalizationsGenerator
(
fileSystem:
fs
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
)
..
loadResources
()
..
writeOutputFiles
(
BufferLogger
.
test
());
final
String
localizationsFile
=
fs
.
file
(
fs
.
path
.
join
(
syntheticL10nPackagePath
,
'output-localization-file.dart'
),
).
readAsStringSync
();
print
(
localizationsFile
);
expect
(
localizationsFile
,
containsIgnoringWhitespace
(
r''
'
AppLocalizations lookupAppLocalizations(Locale locale) {
'''
));
});
}
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