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
9d7af39a
Unverified
Commit
9d7af39a
authored
Apr 28, 2020
by
Shi-Hao Hong
Committed by
GitHub
Apr 28, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[gen_l10n] Output directory option (#55792)
* Add new output-dir option for gen_l10n tool
parent
8cbba0a5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
261 additions
and
90 deletions
+261
-90
gen_l10n.dart
dev/tools/localization/bin/gen_l10n.dart
+16
-8
gen_l10n.dart
dev/tools/localization/gen_l10n.dart
+82
-34
gen_l10n_test.dart
dev/tools/test/localization/gen_l10n_test.dart
+163
-48
No files found.
dev/tools/localization/bin/gen_l10n.dart
View file @
9d7af39a
...
@@ -23,10 +23,14 @@ void main(List<String> arguments) {
...
@@ -23,10 +23,14 @@ void main(List<String> arguments) {
parser
.
addOption
(
parser
.
addOption
(
'arb-dir'
,
'arb-dir'
,
defaultsTo:
path
.
join
(
'lib'
,
'l10n'
),
defaultsTo:
path
.
join
(
'lib'
,
'l10n'
),
help:
'The directory where all localization files should reside. For '
help:
'The directory where the template and translated arb files are located.'
,
'example, the template and translated arb files should be located here. '
);
'Also, the generated output messages Dart files for each locale and the '
parser
.
addOption
(
'generated localizations classes will be created here.'
,
'output-dir'
,
defaultsTo:
path
.
join
(
'lib'
,
'l10n'
),
help:
'The directory where the generated localization classes will be written. '
'The app must import the file specified in the
\'
output-localization-file
\'
'
'option from this directory.'
);
);
parser
.
addOption
(
parser
.
addOption
(
'template-arb-file'
,
'template-arb-file'
,
...
@@ -77,9 +81,11 @@ void main(List<String> arguments) {
...
@@ -77,9 +81,11 @@ void main(List<String> arguments) {
'header-file'
,
'header-file'
,
help:
'The header to prepend to the generated Dart localizations '
help:
'The header to prepend to the generated Dart localizations '
'files. The value of this option is the name of the file that '
'files. The value of this option is the name of the file that '
'contains the header text.
\n\n
'
'contains the header text which will be inserted at the top '
'of each generated Dart file.
\n\n
'
'Alternatively, see the `header` option to pass in a string '
'Alternatively, see the `header` option to pass in a string '
'for a simpler header.'
'for a simpler header.
\n\n
'
'This file should be placed in the directory specified in
\'
arb-dir
\'
.'
);
);
parser
.
addFlag
(
parser
.
addFlag
(
'use-deferred-loading'
,
'use-deferred-loading'
,
...
@@ -108,7 +114,8 @@ void main(List<String> arguments) {
...
@@ -108,7 +114,8 @@ void main(List<String> arguments) {
precacheLanguageAndRegionTags
();
precacheLanguageAndRegionTags
();
final
String
arbPathString
=
results
[
'arb-dir'
]
as
String
;
final
String
inputPathString
=
results
[
'arb-dir'
]
as
String
;
final
String
outputPathString
=
results
[
'output-dir'
]
as
String
;
final
String
outputFileString
=
results
[
'output-localization-file'
]
as
String
;
final
String
outputFileString
=
results
[
'output-localization-file'
]
as
String
;
final
String
templateArbFileName
=
results
[
'template-arb-file'
]
as
String
;
final
String
templateArbFileName
=
results
[
'template-arb-file'
]
as
String
;
final
String
untranslatedMessagesFile
=
results
[
'untranslated-messages-file'
]
as
String
;
final
String
untranslatedMessagesFile
=
results
[
'untranslated-messages-file'
]
as
String
;
...
@@ -124,7 +131,8 @@ void main(List<String> arguments) {
...
@@ -124,7 +131,8 @@ void main(List<String> arguments) {
try
{
try
{
localizationsGenerator
localizationsGenerator
..
initialize
(
..
initialize
(
l10nDirectoryPath:
arbPathString
,
inputPathString:
inputPathString
,
outputPathString:
outputPathString
,
templateArbFileName:
templateArbFileName
,
templateArbFileName:
templateArbFileName
,
outputFileString:
outputFileString
,
outputFileString:
outputFileString
,
classNameString:
classNameString
,
classNameString:
classNameString
,
...
...
dev/tools/localization/gen_l10n.dart
View file @
9d7af39a
...
@@ -394,15 +394,23 @@ class LocalizationsGenerator {
...
@@ -394,15 +394,23 @@ class LocalizationsGenerator {
AppResourceBundleCollection
_allBundles
;
AppResourceBundleCollection
_allBundles
;
LocaleInfo
_templateArbLocale
;
LocaleInfo
_templateArbLocale
;
/// The reference to the project's l10n directory.
/// The directory that contains the project's arb files, as well as the
/// header file, if specified.
///
///
/// It is assumed that all input files (e.g. [templateArbFile], arb files
/// It is assumed that all input files (e.g. [templateArbFile], arb files
/// for translated messages) and output files (e.g. The localizations
/// for translated messages, header file templates) will reside here.
///
/// This directory is specified with the [initialize] method.
Directory
inputDirectory
;
/// The directory to generate the project's localizations files in.
///
/// It is assumed that all output files (e.g. The localizations
/// [outputFile], `messages_<locale>.dart` and `messages_all.dart`)
/// [outputFile], `messages_<locale>.dart` and `messages_all.dart`)
/// will reside here.
/// will reside here.
///
///
/// This directory is specified with the [initialize] method.
/// This directory is specified with the [initialize] method.
Directory
l10n
Directory
;
Directory
output
Directory
;
/// The input arb file which defines all of the messages that will be
/// The input arb file which defines all of the messages that will be
/// exported by the generated class that's written to [outputFile].
/// exported by the generated class that's written to [outputFile].
...
@@ -440,17 +448,17 @@ class LocalizationsGenerator {
...
@@ -440,17 +448,17 @@ class LocalizationsGenerator {
List
<
LocaleInfo
>
get
preferredSupportedLocales
=>
_preferredSupportedLocales
;
List
<
LocaleInfo
>
get
preferredSupportedLocales
=>
_preferredSupportedLocales
;
List
<
LocaleInfo
>
_preferredSupportedLocales
;
List
<
LocaleInfo
>
_preferredSupportedLocales
;
/// The list of all arb path strings in [
l10n
Directory].
/// The list of all arb path strings in [
input
Directory].
List
<
String
>
get
arbPathStrings
{
List
<
String
>
get
arbPathStrings
{
return
_allBundles
.
bundles
.
map
((
AppResourceBundle
bundle
)
=>
bundle
.
file
.
path
).
toList
();
return
_allBundles
.
bundles
.
map
((
AppResourceBundle
bundle
)
=>
bundle
.
file
.
path
).
toList
();
}
}
/// The supported language codes as found in the arb files located in
/// The supported language codes as found in the arb files located in
/// [
l10n
Directory].
/// [
input
Directory].
final
Set
<
String
>
supportedLanguageCodes
=
<
String
>{};
final
Set
<
String
>
supportedLanguageCodes
=
<
String
>{};
/// The supported locales as found in the arb files located in
/// The supported locales as found in the arb files located in
/// [
l10n
Directory].
/// [
input
Directory].
final
Set
<
LocaleInfo
>
supportedLocales
=
<
LocaleInfo
>{};
final
Set
<
LocaleInfo
>
supportedLocales
=
<
LocaleInfo
>{};
/// The header to be prepended to the generated Dart localization file.
/// The header to be prepended to the generated Dart localization file.
...
@@ -475,7 +483,16 @@ class LocalizationsGenerator {
...
@@ -475,7 +483,16 @@ class LocalizationsGenerator {
bool
get
useDeferredLoading
=>
_useDeferredLoading
;
bool
get
useDeferredLoading
=>
_useDeferredLoading
;
bool
_useDeferredLoading
;
bool
_useDeferredLoading
;
/// Initializes [l10nDirectory], [templateArbFile], [outputFile] and [className].
/// Contains a map of each output language file to its corresponding content in
/// string format.
final
Map
<
File
,
String
>
_languageFileMap
=
<
File
,
String
>{};
/// Contains the generated application's localizations and localizations delegate
/// classes.
String
_generatedLocalizationsFile
;
/// Initializes [inputDirectory], [outputDirectory], [templateArbFile],
/// [outputFile] and [className].
///
///
/// Throws an [L10nException] when a provided configuration is not allowed
/// Throws an [L10nException] when a provided configuration is not allowed
/// by [LocalizationsGenerator].
/// by [LocalizationsGenerator].
...
@@ -483,7 +500,8 @@ class LocalizationsGenerator {
...
@@ -483,7 +500,8 @@ class LocalizationsGenerator {
/// Throws a [FileSystemException] when a file operation necessary for setting
/// Throws a [FileSystemException] when a file operation necessary for setting
/// up the [LocalizationsGenerator] cannot be completed.
/// up the [LocalizationsGenerator] cannot be completed.
void
initialize
({
void
initialize
({
String
l10nDirectoryPath
,
String
inputPathString
,
String
outputPathString
,
String
templateArbFileName
,
String
templateArbFileName
,
String
outputFileString
,
String
outputFileString
,
String
classNameString
,
String
classNameString
,
...
@@ -492,7 +510,8 @@ class LocalizationsGenerator {
...
@@ -492,7 +510,8 @@ class LocalizationsGenerator {
String
headerFile
,
String
headerFile
,
bool
useDeferredLoading
=
false
,
bool
useDeferredLoading
=
false
,
})
{
})
{
setL10nDirectory
(
l10nDirectoryPath
);
setInputDirectory
(
inputPathString
);
setOutputDirectory
(
outputPathString
);
setTemplateArbFile
(
templateArbFileName
);
setTemplateArbFile
(
templateArbFileName
);
setOutputFile
(
outputFileString
);
setOutputFile
(
outputFileString
);
setPreferredSupportedLocales
(
preferredSupportedLocaleString
);
setPreferredSupportedLocales
(
preferredSupportedLocaleString
);
...
@@ -515,35 +534,43 @@ class LocalizationsGenerator {
...
@@ -515,35 +534,43 @@ class LocalizationsGenerator {
return
!(
statString
[
1
]
==
'w'
||
statString
[
4
]
==
'w'
||
statString
[
7
]
==
'w'
);
return
!(
statString
[
1
]
==
'w'
||
statString
[
4
]
==
'w'
||
statString
[
7
]
==
'w'
);
}
}
/// Sets the reference [Directory] for [
l10n
Directory].
/// Sets the reference [Directory] for [
input
Directory].
@visibleForTesting
@visibleForTesting
void
set
L10nDirectory
(
String
arb
PathString
)
{
void
set
InputDirectory
(
String
input
PathString
)
{
if
(
arb
PathString
==
null
)
if
(
input
PathString
==
null
)
throw
L10nException
(
'
arb
PathString argument cannot be null'
);
throw
L10nException
(
'
input
PathString argument cannot be null'
);
l10nDirectory
=
_fs
.
directory
(
arb
PathString
);
inputDirectory
=
_fs
.
directory
(
input
PathString
);
if
(!
l10n
Directory
.
existsSync
())
if
(!
input
Directory
.
existsSync
())
throw
FileSystemException
(
throw
FileSystemException
(
"The '
arb-dir' directory,
$l10nDirectory
, does not exist.
\n
"
"The '
input-dir' directory, '
$inputDirectory
'
, does not exist.
\n
"
'Make sure that the correct path was provided.'
'Make sure that the correct path was provided.'
);
);
final
FileStat
fileStat
=
l10n
Directory
.
statSync
();
final
FileStat
fileStat
=
input
Directory
.
statSync
();
if
(
_isNotReadable
(
fileStat
)
||
_isNotWritable
(
fileStat
))
if
(
_isNotReadable
(
fileStat
)
||
_isNotWritable
(
fileStat
))
throw
FileSystemException
(
throw
FileSystemException
(
"The '
arb-dir' directory,
$l10nDirectory
, doesn't allow reading and writing.
\n
"
"The '
input-dir' directory, '
$inputDirectory
'
, doesn't allow reading and writing.
\n
"
'Please ensure that the user has read and write permissions.'
'Please ensure that the user has read and write permissions.'
);
);
}
}
/// Sets the reference [Directory] for [outputDirectory].
@visibleForTesting
void
setOutputDirectory
(
String
outputPathString
)
{
if
(
outputPathString
==
null
)
throw
L10nException
(
'outputPathString argument cannot be null'
);
outputDirectory
=
_fs
.
directory
(
outputPathString
);
}
/// Sets the reference [File] for [templateArbFile].
/// Sets the reference [File] for [templateArbFile].
@visibleForTesting
@visibleForTesting
void
setTemplateArbFile
(
String
templateArbFileName
)
{
void
setTemplateArbFile
(
String
templateArbFileName
)
{
if
(
templateArbFileName
==
null
)
if
(
templateArbFileName
==
null
)
throw
L10nException
(
'templateArbFileName argument cannot be null'
);
throw
L10nException
(
'templateArbFileName argument cannot be null'
);
if
(
l10n
Directory
==
null
)
if
(
input
Directory
==
null
)
throw
L10nException
(
'
l10n
Directory cannot be null when setting template arb file'
);
throw
L10nException
(
'
input
Directory cannot be null when setting template arb file'
);
templateArbFile
=
_fs
.
file
(
path
.
join
(
l10n
Directory
.
path
,
templateArbFileName
));
templateArbFile
=
_fs
.
file
(
path
.
join
(
input
Directory
.
path
,
templateArbFileName
));
final
String
templateArbFileStatModeString
=
templateArbFile
.
statSync
().
modeString
();
final
String
templateArbFileStatModeString
=
templateArbFile
.
statSync
().
modeString
();
if
(
templateArbFileStatModeString
[
0
]
==
'-'
&&
templateArbFileStatModeString
[
3
]
==
'-'
)
if
(
templateArbFileStatModeString
[
0
]
==
'-'
&&
templateArbFileStatModeString
[
3
]
==
'-'
)
throw
FileSystemException
(
throw
FileSystemException
(
...
@@ -557,7 +584,7 @@ class LocalizationsGenerator {
...
@@ -557,7 +584,7 @@ class LocalizationsGenerator {
void
setOutputFile
(
String
outputFileString
)
{
void
setOutputFile
(
String
outputFileString
)
{
if
(
outputFileString
==
null
)
if
(
outputFileString
==
null
)
throw
L10nException
(
'outputFileString argument cannot be null'
);
throw
L10nException
(
'outputFileString argument cannot be null'
);
outputFile
=
_fs
.
file
(
path
.
join
(
l10n
Directory
.
path
,
outputFileString
));
outputFile
=
_fs
.
file
(
path
.
join
(
output
Directory
.
path
,
outputFileString
));
}
}
static
bool
_isValidClassName
(
String
className
)
{
static
bool
_isValidClassName
(
String
className
)
{
...
@@ -620,7 +647,7 @@ class LocalizationsGenerator {
...
@@ -620,7 +647,7 @@ class LocalizationsGenerator {
header
=
headerString
;
header
=
headerString
;
}
else
if
(
headerFile
!=
null
)
{
}
else
if
(
headerFile
!=
null
)
{
try
{
try
{
header
=
_fs
.
file
(
path
.
join
(
l10n
Directory
.
path
,
headerFile
)).
readAsStringSync
();
header
=
_fs
.
file
(
path
.
join
(
input
Directory
.
path
,
headerFile
)).
readAsStringSync
();
}
on
FileSystemException
catch
(
error
)
{
}
on
FileSystemException
catch
(
error
)
{
throw
L10nException
(
throw
L10nException
(
'Failed to read header file: "
$headerFile
".
\n
'
'Failed to read header file: "
$headerFile
".
\n
'
...
@@ -654,7 +681,7 @@ class LocalizationsGenerator {
...
@@ -654,7 +681,7 @@ class LocalizationsGenerator {
}
}
// Load _allMessages from templateArbFile and _allBundles from all of the ARB
// Load _allMessages from templateArbFile and _allBundles from all of the ARB
// files in
l10n
Directory. Also initialized: supportedLocales.
// files in
input
Directory. Also initialized: supportedLocales.
void
loadResources
()
{
void
loadResources
()
{
final
AppResourceBundle
templateBundle
=
AppResourceBundle
(
templateArbFile
);
final
AppResourceBundle
templateBundle
=
AppResourceBundle
(
templateArbFile
);
_templateArbLocale
=
templateBundle
.
locale
;
_templateArbLocale
=
templateBundle
.
locale
;
...
@@ -669,7 +696,7 @@ class LocalizationsGenerator {
...
@@ -669,7 +696,7 @@ class LocalizationsGenerator {
);
);
}
}
_allBundles
=
AppResourceBundleCollection
(
l10n
Directory
);
_allBundles
=
AppResourceBundleCollection
(
input
Directory
);
final
List
<
LocaleInfo
>
allLocales
=
List
<
LocaleInfo
>.
from
(
_allBundles
.
locales
);
final
List
<
LocaleInfo
>
allLocales
=
List
<
LocaleInfo
>.
from
(
_allBundles
.
locales
);
for
(
final
LocaleInfo
preferredLocale
in
preferredSupportedLocales
)
{
for
(
final
LocaleInfo
preferredLocale
in
preferredSupportedLocales
)
{
...
@@ -755,7 +782,7 @@ class LocalizationsGenerator {
...
@@ -755,7 +782,7 @@ class LocalizationsGenerator {
// Generate the AppLocalizations class, its LocalizationsDelegate subclass,
// Generate the AppLocalizations class, its LocalizationsDelegate subclass,
// and all AppLocalizations subclasses for every locale.
// and all AppLocalizations subclasses for every locale.
String
generateCode
()
{
void
generateCode
()
{
bool
isBaseClassLocale
(
LocaleInfo
locale
,
String
language
)
{
bool
isBaseClassLocale
(
LocaleInfo
locale
,
String
language
)
{
return
locale
.
languageCode
==
language
return
locale
.
languageCode
==
language
&&
locale
.
countryCode
==
null
&&
locale
.
countryCode
==
null
...
@@ -772,7 +799,7 @@ class LocalizationsGenerator {
...
@@ -772,7 +799,7 @@ class LocalizationsGenerator {
.
map
((
AppResourceBundle
bundle
)
=>
bundle
.
locale
).
toList
();
.
map
((
AppResourceBundle
bundle
)
=>
bundle
.
locale
).
toList
();
}
}
final
String
directory
=
path
.
basename
(
l10n
Directory
.
path
);
final
String
directory
=
path
.
basename
(
output
Directory
.
path
);
final
String
outputFileName
=
path
.
basename
(
outputFile
.
path
);
final
String
outputFileName
=
path
.
basename
(
outputFile
.
path
);
final
Iterable
<
String
>
supportedLocalesCode
=
supportedLocales
.
map
((
LocaleInfo
locale
)
{
final
Iterable
<
String
>
supportedLocalesCode
=
supportedLocales
.
map
((
LocaleInfo
locale
)
{
...
@@ -799,8 +826,8 @@ class LocalizationsGenerator {
...
@@ -799,8 +826,8 @@ class LocalizationsGenerator {
final
String
fileName
=
outputFileName
.
split
(
'.'
)[
0
];
final
String
fileName
=
outputFileName
.
split
(
'.'
)[
0
];
for
(
final
LocaleInfo
locale
in
allLocales
)
{
for
(
final
LocaleInfo
locale
in
allLocales
)
{
if
(
isBaseClassLocale
(
locale
,
locale
.
languageCode
))
{
if
(
isBaseClassLocale
(
locale
,
locale
.
languageCode
))
{
final
File
l
ocal
eMessageFile
=
_fs
.
file
(
final
File
l
anguag
eMessageFile
=
_fs
.
file
(
path
.
join
(
l10n
Directory
.
path
,
'
${fileName}
_
$locale
.dart'
),
path
.
join
(
output
Directory
.
path
,
'
${fileName}
_
$locale
.dart'
),
);
);
// Generate the template for the base class file. Further string
// Generate the template for the base class file. Further string
...
@@ -827,9 +854,9 @@ class LocalizationsGenerator {
...
@@ -827,9 +854,9 @@ class LocalizationsGenerator {
);
);
});
});
localeMessageFile
.
writeAsStringSync
(
_languageFileMap
.
putIfAbsent
(
languageMessageFile
,
()
{
languageBaseClassFile
.
replaceAll
(
'@(subclasses)'
,
subclasses
.
join
()),
return
languageBaseClassFile
.
replaceAll
(
'@(subclasses)'
,
subclasses
.
join
());
);
}
);
}
}
}
}
...
@@ -854,7 +881,7 @@ class LocalizationsGenerator {
...
@@ -854,7 +881,7 @@ class LocalizationsGenerator {
fileName:
fileName
,
fileName:
fileName
,
);
);
return
fileTemplate
_generatedLocalizationsFile
=
fileTemplate
.
replaceAll
(
'@(header)'
,
header
)
.
replaceAll
(
'@(header)'
,
header
)
.
replaceAll
(
'@(class)'
,
className
)
.
replaceAll
(
'@(class)'
,
className
)
.
replaceAll
(
'@(methods)'
,
_allMessages
.
map
(
generateBaseClassMethod
).
join
(
'
\n
'
))
.
replaceAll
(
'@(methods)'
,
_allMessages
.
map
(
generateBaseClassMethod
).
join
(
'
\n
'
))
...
@@ -866,7 +893,28 @@ class LocalizationsGenerator {
...
@@ -866,7 +893,28 @@ class LocalizationsGenerator {
}
}
void
writeOutputFile
()
{
void
writeOutputFile
()
{
outputFile
.
writeAsStringSync
(
generateCode
());
// First, generate the string contents of all necessary files.
generateCode
();
// Since all validity checks have passed up to this point,
// write the contents into the directory.
if
(!
outputDirectory
.
existsSync
())
{
outputDirectory
.
createSync
(
recursive:
true
);
}
// Ensure that the created directory has read/write permissions.
final
FileStat
fileStat
=
outputDirectory
.
statSync
();
if
(
_isNotReadable
(
fileStat
)
||
_isNotWritable
(
fileStat
))
throw
FileSystemException
(
"The 'output-dir' directory,
$outputDirectory
, doesn't allow reading and writing.
\n
"
'Please ensure that the user has read and write permissions.'
);
// Generate the required files for localizations.
_languageFileMap
.
forEach
((
File
file
,
String
contents
)
{
file
.
writeAsStringSync
(
contents
);
});
outputFile
.
writeAsStringSync
(
_generatedLocalizationsFile
);
}
}
void
outputUnimplementedMessages
(
String
untranslatedMessagesFile
)
{
void
outputUnimplementedMessages
(
String
untranslatedMessagesFile
)
{
...
...
dev/tools/test/localization/gen_l10n_test.dart
View file @
9d7af39a
...
@@ -15,9 +15,9 @@ import '../../localization/localizations_utils.dart';
...
@@ -15,9 +15,9 @@ import '../../localization/localizations_utils.dart';
import
'../common.dart'
;
import
'../common.dart'
;
final
String
default
Arb
PathString
=
path
.
join
(
'lib'
,
'l10n'
);
final
String
default
L10n
PathString
=
path
.
join
(
'lib'
,
'l10n'
);
const
String
defaultTemplateArbFileName
=
'app_en.arb'
;
const
String
defaultTemplateArbFileName
=
'app_en.arb'
;
const
String
defaultOutputFileString
=
'output-localization-file'
;
const
String
defaultOutputFileString
=
'output-localization-file
.dart
'
;
const
String
defaultClassNameString
=
'AppLocalizations'
;
const
String
defaultClassNameString
=
'AppLocalizations'
;
const
String
singleMessageArbFileString
=
'''
const
String
singleMessageArbFileString
=
'''
{
{
...
@@ -67,38 +67,54 @@ void main() {
...
@@ -67,38 +67,54 @@ void main() {
});
});
group
(
'Setters'
,
()
{
group
(
'Setters'
,
()
{
test
(
'set
L10n
Directory fails if the directory does not exist'
,
()
{
test
(
'set
Input
Directory fails if the directory does not exist'
,
()
{
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
try
{
try
{
generator
.
set
L10n
Directory
(
'lib'
);
generator
.
set
Input
Directory
(
'lib'
);
}
on
FileSystemException
catch
(
e
)
{
}
on
FileSystemException
catch
(
e
)
{
expect
(
e
.
message
,
contains
(
'Make sure that the correct path was provided'
));
expect
(
e
.
message
,
contains
(
'Make sure that the correct path was provided'
));
return
;
return
;
}
}
fail
(
fail
(
'Attempting to set LocalizationsGenerator.set
L10n
Directory should fail if the '
'Attempting to set LocalizationsGenerator.set
Input
Directory should fail if the '
'directory does not exist.'
'directory does not exist.'
);
);
});
});
test
(
'set
L10n
Directory fails if input string is null'
,
()
{
test
(
'set
Input
Directory fails if input string is null'
,
()
{
_standardFlutterDirectoryL10nSetup
(
fs
);
_standardFlutterDirectoryL10nSetup
(
fs
);
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
try
{
try
{
generator
.
set
L10n
Directory
(
null
);
generator
.
set
Input
Directory
(
null
);
}
on
L10nException
catch
(
e
)
{
}
on
L10nException
catch
(
e
)
{
expect
(
e
.
message
,
contains
(
'cannot be null'
));
expect
(
e
.
message
,
contains
(
'cannot be null'
));
return
;
return
;
}
}
fail
(
fail
(
'Attempting to set LocalizationsGenerator.set
L10n
Directory should fail if the '
'Attempting to set LocalizationsGenerator.set
Input
Directory should fail if the '
'the input string is null.'
'the input string is null.'
);
);
});
});
test
(
'setTemplateArbFile fails if l10nDirectory is null'
,
()
{
test
(
'setOutputDirectory fails if output string is null'
,
()
{
_standardFlutterDirectoryL10nSetup
(
fs
);
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
try
{
generator
.
setOutputDirectory
(
null
);
}
on
L10nException
catch
(
e
)
{
expect
(
e
.
message
,
contains
(
'cannot be null'
));
return
;
}
fail
(
'Attempting to set LocalizationsGenerator.setOutputDirectory should fail if the '
'the input string is null.'
);
});
test
(
'setTemplateArbFile fails if inputDirectory is null'
,
()
{
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
try
{
try
{
generator
.
setTemplateArbFile
(
defaultTemplateArbFileName
);
generator
.
setTemplateArbFile
(
defaultTemplateArbFileName
);
...
@@ -109,7 +125,7 @@ void main() {
...
@@ -109,7 +125,7 @@ void main() {
fail
(
fail
(
'Attempting to set LocalizationsGenerator.setTemplateArbFile should fail if the '
'Attempting to set LocalizationsGenerator.setTemplateArbFile should fail if the '
'the
l10nDirectory is null
.'
'the
inputDirectory is not specified
.'
);
);
});
});
...
@@ -125,7 +141,7 @@ void main() {
...
@@ -125,7 +141,7 @@ void main() {
fail
(
fail
(
'Attempting to set LocalizationsGenerator.setTemplateArbFile should fail if the '
'Attempting to set LocalizationsGenerator.setTemplateArbFile should fail if the '
'the
l10nDirectory
is null.'
'the
templateArbFileName passed in
is null.'
);
);
});
});
...
@@ -183,7 +199,8 @@ void main() {
...
@@ -183,7 +199,8 @@ void main() {
_standardFlutterDirectoryL10nSetup
(
fs
);
_standardFlutterDirectoryL10nSetup
(
fs
);
generator
=
LocalizationsGenerator
(
fs
);
generator
=
LocalizationsGenerator
(
fs
);
try
{
try
{
generator
.
setL10nDirectory
(
defaultArbPathString
);
generator
.
setInputDirectory
(
defaultL10nPathString
);
generator
.
setOutputDirectory
(
defaultL10nPathString
);
generator
.
setTemplateArbFile
(
defaultTemplateArbFileName
);
generator
.
setTemplateArbFile
(
defaultTemplateArbFileName
);
generator
.
setOutputFile
(
defaultOutputFileString
);
generator
.
setOutputFile
(
defaultOutputFileString
);
}
on
L10nException
catch
(
e
)
{
}
on
L10nException
catch
(
e
)
{
...
@@ -252,7 +269,8 @@ void main() {
...
@@ -252,7 +269,8 @@ void main() {
try
{
try
{
generator
=
LocalizationsGenerator
(
fs
);
generator
=
LocalizationsGenerator
(
fs
);
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -276,7 +294,8 @@ void main() {
...
@@ -276,7 +294,8 @@ void main() {
try
{
try
{
generator
=
LocalizationsGenerator
(
fs
);
generator
=
LocalizationsGenerator
(
fs
);
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -300,7 +319,8 @@ void main() {
...
@@ -300,7 +319,8 @@ void main() {
generator
=
LocalizationsGenerator
(
fs
);
generator
=
LocalizationsGenerator
(
fs
);
generator
generator
..
initialize
(
..
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -326,6 +346,72 @@ void main() {
...
@@ -326,6 +346,72 @@ void main() {
expect
(
unimplementedOutputString
,
contains
(
'subtitle'
));
expect
(
unimplementedOutputString
,
contains
(
'subtitle'
));
});
});
test
(
'correctly generates output files in non-default output directory if it already exists'
,
()
{
final
Directory
l10nDirectory
=
fs
.
currentDirectory
.
childDirectory
(
'lib'
)
.
childDirectory
(
'l10n'
)
..
createSync
(
recursive:
true
);
// Create the directory 'lib/l10n/output'.
l10nDirectory
.
childDirectory
(
'output'
);
l10nDirectory
.
childFile
(
defaultTemplateArbFileName
)
.
writeAsStringSync
(
singleMessageArbFileString
);
l10nDirectory
.
childFile
(
esArbFileName
)
.
writeAsStringSync
(
singleEsMessageArbFileString
);
LocalizationsGenerator
generator
;
try
{
generator
=
LocalizationsGenerator
(
fs
);
generator
..
initialize
(
inputPathString:
defaultL10nPathString
,
outputPathString:
path
.
join
(
'lib'
,
'l10n'
,
'output'
),
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
)
..
loadResources
()
..
writeOutputFile
();
}
on
L10nException
catch
(
e
)
{
fail
(
'Generating output should not fail:
\n
${e.message}
'
);
}
final
Directory
outputDirectory
=
fs
.
directory
(
'lib'
).
childDirectory
(
'l10n'
).
childDirectory
(
'output'
);
expect
(
outputDirectory
.
existsSync
(),
isTrue
);
expect
(
outputDirectory
.
childFile
(
'output-localization-file.dart'
).
existsSync
(),
isTrue
);
expect
(
outputDirectory
.
childFile
(
'output-localization-file_en.dart'
).
existsSync
(),
isTrue
);
expect
(
outputDirectory
.
childFile
(
'output-localization-file_es.dart'
).
existsSync
(),
isTrue
);
});
test
(
'correctly creates output directory if it does not exist and writes files in it'
,
()
{
_standardFlutterDirectoryL10nSetup
(
fs
);
LocalizationsGenerator
generator
;
try
{
generator
=
LocalizationsGenerator
(
fs
);
generator
..
initialize
(
inputPathString:
defaultL10nPathString
,
outputPathString:
path
.
join
(
'lib'
,
'l10n'
,
'output'
),
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
)
..
loadResources
()
..
writeOutputFile
();
}
on
L10nException
catch
(
e
)
{
fail
(
'Generating output should not fail:
\n
${e.message}
'
);
}
final
Directory
outputDirectory
=
fs
.
directory
(
'lib'
).
childDirectory
(
'l10n'
).
childDirectory
(
'output'
);
expect
(
outputDirectory
.
existsSync
(),
isTrue
);
expect
(
outputDirectory
.
childFile
(
'output-localization-file.dart'
).
existsSync
(),
isTrue
);
expect
(
outputDirectory
.
childFile
(
'output-localization-file_en.dart'
).
existsSync
(),
isTrue
);
expect
(
outputDirectory
.
childFile
(
'output-localization-file_es.dart'
).
existsSync
(),
isTrue
);
});
test
(
'setting both a headerString and a headerFile should fail'
,
()
{
test
(
'setting both a headerString and a headerFile should fail'
,
()
{
fs
.
currentDirectory
.
childDirectory
(
'lib'
).
childDirectory
(
'l10n'
)
fs
.
currentDirectory
.
childDirectory
(
'lib'
).
childDirectory
(
'l10n'
)
..
createSync
(
recursive:
true
)
..
createSync
(
recursive:
true
)
...
@@ -337,7 +423,8 @@ void main() {
...
@@ -337,7 +423,8 @@ void main() {
try
{
try
{
generator
=
LocalizationsGenerator
(
fs
);
generator
=
LocalizationsGenerator
(
fs
);
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -366,7 +453,8 @@ void main() {
...
@@ -366,7 +453,8 @@ void main() {
try
{
try
{
generator
=
LocalizationsGenerator
(
fs
);
generator
=
LocalizationsGenerator
(
fs
);
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -387,7 +475,8 @@ void main() {
...
@@ -387,7 +475,8 @@ void main() {
try
{
try
{
generator
=
LocalizationsGenerator
(
fs
);
generator
=
LocalizationsGenerator
(
fs
);
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -410,7 +499,8 @@ void main() {
...
@@ -410,7 +499,8 @@ void main() {
try
{
try
{
generator
=
LocalizationsGenerator
(
fs
);
generator
=
LocalizationsGenerator
(
fs
);
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -439,7 +529,8 @@ void main() {
...
@@ -439,7 +529,8 @@ void main() {
try
{
try
{
generator
=
LocalizationsGenerator
(
fs
);
generator
=
LocalizationsGenerator
(
fs
);
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -469,7 +560,8 @@ void main() {
...
@@ -469,7 +560,8 @@ void main() {
try
{
try
{
generator
=
LocalizationsGenerator
(
fs
);
generator
=
LocalizationsGenerator
(
fs
);
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -503,7 +595,8 @@ void main() {
...
@@ -503,7 +595,8 @@ void main() {
try
{
try
{
generator
=
LocalizationsGenerator
(
fs
);
generator
=
LocalizationsGenerator
(
fs
);
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -544,7 +637,8 @@ void main() {
...
@@ -544,7 +637,8 @@ void main() {
try
{
try
{
generator
=
LocalizationsGenerator
(
fs
);
generator
=
LocalizationsGenerator
(
fs
);
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -581,7 +675,8 @@ void main() {
...
@@ -581,7 +675,8 @@ void main() {
try
{
try
{
generator
=
LocalizationsGenerator
(
fs
);
generator
=
LocalizationsGenerator
(
fs
);
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -632,7 +727,8 @@ void main() {
...
@@ -632,7 +727,8 @@ void main() {
try
{
try
{
generator
=
LocalizationsGenerator
(
fs
);
generator
=
LocalizationsGenerator
(
fs
);
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
'first_file.arb'
,
templateArbFileName:
'first_file.arb'
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -676,7 +772,8 @@ void main() {
...
@@ -676,7 +772,8 @@ void main() {
try
{
try
{
generator
=
LocalizationsGenerator
(
fs
);
generator
=
LocalizationsGenerator
(
fs
);
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
'app_es.arb'
,
templateArbFileName:
'app_es.arb'
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -702,7 +799,8 @@ void main() {
...
@@ -702,7 +799,8 @@ void main() {
try
{
try
{
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
'app.arb'
,
templateArbFileName:
'app.arb'
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -736,7 +834,8 @@ void main() {
...
@@ -736,7 +834,8 @@ void main() {
try
{
try
{
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
'app_en.arb'
,
templateArbFileName:
'app_en.arb'
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -762,7 +861,8 @@ void main() {
...
@@ -762,7 +861,8 @@ void main() {
try
{
try
{
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
'app_en_US.arb'
,
templateArbFileName:
'app_en_US.arb'
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -793,7 +893,8 @@ void main() {
...
@@ -793,7 +893,8 @@ void main() {
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
try
{
try
{
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -824,7 +925,8 @@ void main() {
...
@@ -824,7 +925,8 @@ void main() {
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
try
{
try
{
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -841,9 +943,9 @@ void main() {
...
@@ -841,9 +943,9 @@ void main() {
).
readAsStringSync
();
).
readAsStringSync
();
expect
(
localizationsFile
,
contains
(
expect
(
localizationsFile
,
contains
(
'''
'''
import '
$
{
defaultOutputFileString
}
_en
.
dart
';
import '
output
-
localization
-
file
_en
.
dart
';
import '
$
{
defaultOutputFileString
}
_es
.
dart
';
import '
output
-
localization
-
file
_es
.
dart
';
import '
$
{
defaultOutputFileString
}
_zh
.
dart
';
import '
output
-
localization
-
file
_zh
.
dart
';
'''
));
'''
));
});
});
...
@@ -854,7 +956,8 @@ import '${defaultOutputFileString}_zh.dart';
...
@@ -854,7 +956,8 @@ import '${defaultOutputFileString}_zh.dart';
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
try
{
try
{
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -871,7 +974,7 @@ import '${defaultOutputFileString}_zh.dart';
...
@@ -871,7 +974,7 @@ import '${defaultOutputFileString}_zh.dart';
).
readAsStringSync
();
).
readAsStringSync
();
expect
(
localizationsFile
,
contains
(
expect
(
localizationsFile
,
contains
(
'''
'''
import '
$
{
defaultOutputFileString
}
_en
.
dart
' deferred as
${defaultOutputFileString}
_en;
import '
output
-
localization
-
file_en
.
dart
' deferred as output-localization-file
_en;
'''
));
'''
));
});
});
...
@@ -899,7 +1002,8 @@ import '${defaultOutputFileString}_en.dart' deferred as ${defaultOutputFileStrin
...
@@ -899,7 +1002,8 @@ import '${defaultOutputFileString}_en.dart' deferred as ${defaultOutputFileStrin
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
try
{
try
{
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -937,7 +1041,8 @@ import '${defaultOutputFileString}_en.dart' deferred as ${defaultOutputFileStrin
...
@@ -937,7 +1041,8 @@ import '${defaultOutputFileString}_en.dart' deferred as ${defaultOutputFileStrin
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
try
{
try
{
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -974,7 +1079,8 @@ import '${defaultOutputFileString}_en.dart' deferred as ${defaultOutputFileStrin
...
@@ -974,7 +1079,8 @@ import '${defaultOutputFileString}_en.dart' deferred as ${defaultOutputFileStrin
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
try
{
try
{
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -1010,7 +1116,8 @@ import '${defaultOutputFileString}_en.dart' deferred as ${defaultOutputFileStrin
...
@@ -1010,7 +1116,8 @@ import '${defaultOutputFileString}_en.dart' deferred as ${defaultOutputFileStrin
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
try
{
try
{
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -1042,7 +1149,8 @@ import '${defaultOutputFileString}_en.dart' deferred as ${defaultOutputFileStrin
...
@@ -1042,7 +1149,8 @@ import '${defaultOutputFileString}_en.dart' deferred as ${defaultOutputFileStrin
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
try
{
try
{
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -1070,7 +1178,8 @@ import '${defaultOutputFileString}_en.dart' deferred as ${defaultOutputFileStrin
...
@@ -1070,7 +1178,8 @@ import '${defaultOutputFileString}_en.dart' deferred as ${defaultOutputFileStrin
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
try
{
try
{
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -1101,7 +1210,8 @@ import '${defaultOutputFileString}_en.dart' deferred as ${defaultOutputFileStrin
...
@@ -1101,7 +1210,8 @@ import '${defaultOutputFileString}_en.dart' deferred as ${defaultOutputFileStrin
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
try
{
try
{
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -1133,7 +1243,8 @@ import '${defaultOutputFileString}_en.dart' deferred as ${defaultOutputFileStrin
...
@@ -1133,7 +1243,8 @@ import '${defaultOutputFileString}_en.dart' deferred as ${defaultOutputFileStrin
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
try
{
try
{
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -1164,7 +1275,8 @@ import '${defaultOutputFileString}_en.dart' deferred as ${defaultOutputFileStrin
...
@@ -1164,7 +1275,8 @@ import '${defaultOutputFileString}_en.dart' deferred as ${defaultOutputFileStrin
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
try
{
try
{
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -1199,7 +1311,8 @@ import '${defaultOutputFileString}_en.dart' deferred as ${defaultOutputFileStrin
...
@@ -1199,7 +1311,8 @@ import '${defaultOutputFileString}_en.dart' deferred as ${defaultOutputFileStrin
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
try
{
try
{
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -1230,7 +1343,8 @@ import '${defaultOutputFileString}_en.dart' deferred as ${defaultOutputFileStrin
...
@@ -1230,7 +1343,8 @@ import '${defaultOutputFileString}_en.dart' deferred as ${defaultOutputFileStrin
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
try
{
try
{
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
@@ -1261,7 +1375,8 @@ import '${defaultOutputFileString}_en.dart' deferred as ${defaultOutputFileStrin
...
@@ -1261,7 +1375,8 @@ import '${defaultOutputFileString}_en.dart' deferred as ${defaultOutputFileStrin
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
final
LocalizationsGenerator
generator
=
LocalizationsGenerator
(
fs
);
try
{
try
{
generator
.
initialize
(
generator
.
initialize
(
l10nDirectoryPath:
defaultArbPathString
,
inputPathString:
defaultL10nPathString
,
outputPathString:
defaultL10nPathString
,
templateArbFileName:
defaultTemplateArbFileName
,
templateArbFileName:
defaultTemplateArbFileName
,
outputFileString:
defaultOutputFileString
,
outputFileString:
defaultOutputFileString
,
classNameString:
defaultClassNameString
,
classNameString:
defaultClassNameString
,
...
...
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