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
2da22859
Unverified
Commit
2da22859
authored
Jul 15, 2022
by
Tae Hyung Kim
Committed by
GitHub
Jul 15, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[gen_l10n] Throw error when arb file does not exist (#107583)
parent
c4975d9b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
1 deletion
+33
-1
gen_l10n.dart
packages/flutter_tools/lib/src/localizations/gen_l10n.dart
+7
-1
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 @
2da22859
...
...
@@ -942,7 +942,13 @@ class LocalizationsGenerator {
@visibleForTesting
static
File
templateArbFileFromFileName
(
String
templateArbFileName
,
Directory
inputDirectory
)
{
final
File
templateArbFile
=
inputDirectory
.
childFile
(
templateArbFileName
);
final
String
templateArbFileStatModeString
=
templateArbFile
.
statSync
().
modeString
();
final
FileStat
templateArbFileStat
=
templateArbFile
.
statSync
();
if
(
templateArbFileStat
.
type
==
FileSystemEntityType
.
notFound
)
{
throw
L10nException
(
"The 'template-arb-file',
$templateArbFile
, does not exist."
);
}
final
String
templateArbFileStatModeString
=
templateArbFileStat
.
modeString
();
if
(
templateArbFileStatModeString
[
0
]
==
'-'
&&
templateArbFileStatModeString
[
3
]
==
'-'
)
{
throw
L10nException
(
"The 'template-arb-file',
$templateArbFile
, is not readable.
\n
"
...
...
packages/flutter_tools/test/general.shard/generate_localizations_test.dart
View file @
2da22859
...
...
@@ -180,6 +180,32 @@ void main() {
);
});
testWithoutContext
(
'throws error when arb file does not exist'
,
()
{
// Set up project directory.
fs
.
currentDirectory
.
childDirectory
(
'lib'
)
.
childDirectory
(
'l10n'
)
.
createSync
(
recursive:
true
);
// Arb file should be nonexistent in the l10n directory.
expect
(
()
=>
LocalizationsGenerator
(
fileSystem:
fs
,
projectPathString:
'./'
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
),
throwsA
(
isA
<
L10nException
>().
having
(
(
L10nException
e
)
=>
e
.
message
,
'message'
,
contains
(
', does not exist.'
),
)),
);
});
group
(
'className should only take valid Dart class names'
,
()
{
setUp
(()
{
_standardFlutterDirectoryL10nSetup
(
fs
);
...
...
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