flutter gen-l10n

Generate localizations for the current project

Options

NameDescription
-h, --helpPrint this usage information
-v, --verboseNoisy logging, including all shell commands executed. If used with --help, shows hidden options
-d, --device-id <device id>Target device id or name (prefixes allowed)
--suppress-analyticsSuppress analytics reporting when this command runs
--arb-dirThe directory where the template and translated arb files are located. (defaults to "lib/l10n")
--output-dirThe directory where the generated localization classes will be written if the synthetic-package flag is set to false. If output-dir is specified and the synthetic-package flag is enabled, this option will be ignored by the tool. The app must import the file specified in the 'output-localization-file' option from this directory. If unspecified, this defaults to
--template-arb-fileThe template arb file that will be used as the basis for generating the Dart localization and messages files. (defaults to "app_en.arb")
--output-localization-fileThe filename for the output localization and localizations delegate classes. (defaults to "app_localizations.dart")
--untranslated-messages-fileThe location of a file that describes the localization messages have not been translated yet. Using this option will create a JSON file at the target location, in the following format: "locale": ["message_1", "message_2" ... "message_n"] If this option is not specified, a summary of the messages that have not been translated will be printed on the command line
--output-classThe Dart class name to use for the output localization and localizations delegate classes. (defaults to "AppLocalizations")
--preferred-supported-locales <locale>The list of preferred supported locales for the application. By default, the tool will generate the supported locales list in alphabetical order. Use this flag if you would like to default to a different locale. For example, pass in `en_US` if you would like your app to default to American English if a device supports it.(Pass this option multiple times for defining multiple items
--headerThe header to prepend to the generated Dart localizations files. This option takes in a string. For example, pass in "/// All localized files." if you would like this string prepended to the generated Dart file. Alternatively, see the `header-file` option to pass in a text file for longer headers
--header-fileThe header to prepend to the generated Dart localizations files. The value of this option is the name of the file that contains the header text which will be inserted at the top of each generated Dart file. Alternatively, see the `header` option to pass in a string for a simpler header. This file should be placed in the directory specified in 'arb-dir'
--use-deferred-loadingGenerate the Dart localization file with locales imported as deferred, allowing for lazy loading of each locale in Flutter web. This can reduce a web app’s initial startup time by decreasing the size of the JavaScript bundle. When this flag is set to true, the messages for a particular locale are only downloaded and loaded by the Flutter app as they are needed. For projects with a lot of different locales and many localization strings, it can be an performance improvement to have deferred loading. For projects with a small number of locales, the difference is negligible, and might slow down the start up compared to bundling the localizations with the rest of the application. Note that this flag does not affect other platforms such as mobile or desktop
--no-use-deferred-loadingDon't generate the Dart localization file with locales imported as deferred
--gen-inputs-and-outputs-list <path to output directory>When specified, the tool generates a JSON file containing the tool's inputs and outputs named gen_l10n_inputs_and_outputs.json. This can be useful for keeping track of which files of the Flutter project were used when generating the latest set of localizations. For example, the Flutter tool's build system uses this file to keep track of when to call gen_l10n during hot reload. The value of this option is the directory where the JSON file will be generated. When null, the JSON file will not be generated
--synthetic-packageDetermines that the generated output files will be generated as a synthetic package or at a specified directory in the Flutter project. This flag is set to true by default. When synthetic-package is set to false, it will generate the localizations files in the directory specified by arb-dir by default. If output-dir is specified, files will be generated there
--no-synthetic-package
--project-dir <absolute path to flutter project>When specified, the tool uses the path passed into this option as the directory of the root Flutter project. When null, the relative path to the present working directory will be used
--required-resource-attributesRequires all resource ids to contain a corresponding resource attribute. By default, simple messages will not require metadata, but it is highly recommended as this provides context for the meaning of a message to readers. Resource attributes are still required for plural messages
--no-required-resource-attributes