Skip to main content

Output Directory

The CLI outputs data from Ditto by writing files to disk. By default, these files are written to a ./ditto  folder relative to the current working directory, but the location of the output files can be customized by defining the outDir property in your config.yml file or by setting the environment variable DITTO_OUT_DIR.

./ditto Directory

By default, this directory houses the configuration file (./ditto/config.yml) used by the CLI and is also the default write destination for any output files the CLI writes to disk. You can override the default location of the config file by using the --config flag when running any command or by setting the environment variable DITTO_PROJECT_CONFIG_FILE . Legacy Ditto users can use the config override path to support maintaining separate config files for the legacy and current versions of Ditto within the same application. If you run the CLI and the resolved config file does not exist, the CLI will automatically create a default config.yml file at the path specified.

String File Naming Conventions

All string files created will generally adhere to the following template:
  • project_id: the Developer ID of the project.
  • variant_id: the Developer ID of a variant or base for files generated for non-variant text
  • extension: the file extension that corresponds to the configured format(s) (e.g., json, xml, strings, stringsdict)
If components is included in the config, a single, combined file for all fetched components will also be created for each variant with the format components__{variant_id}.{extension}. To keep cross-platform behavior consistent, file names will be fully lowercase, have whitespace replaced with hyphens, and have non-word characters (with the exception of - and _) removed.

Format-specific Files

JSON

If one or more JSON string formats are configured, a series of json files will be generated, on a project-variant/components-variant pair basis. Generally each file will follow the shown format:
Additionally, a variables.json file will be generated that contains information about any variables used within the fetched text. The file has the following format:

Android XML

If android format is configured for an output, a series of .xml files will be generated, on a project-variant/components-variant pair basis. Generally each file will follow the shown format:

iOS Strings

If iOS Strings format is configured, a series of .strings files will be generated, on a project-variant/components-variant pair basis. Generally each file will follow the shown format:

iOS StringsDict

If iOS StringsDict format is configured, a series of .stringsdict files will be generated, on a project-variant/components-variant pair basis. Generally each file will follow the shown format:

Framework-specific Files

Within each output format, an optional framework can be provided. Frameworks come in two kinds:
  • i18next and vue-i18n generate the standard flat JSON strings files (see Format-specific Files above) plus additional driver files to assist with using those strings files with the corresponding library.
  • icu and arb don’t generate any additional files. Instead, they change the shape of the JSON string values themselves — using ICU message format syntax for pluralization and variable interpolation. See the JSON string format docs for the exact content shape each one produces.

i18next

Formats supported: JSON Supported Properties:

type: “commonjs” | “module” (default “commonjs”)

By default, additional javascript files will be generated using commonjs syntax. This property configures the output to use commonjs or module syntax in the generated files. Details: Generates an additional javascript file that imports the generated strings files, and exports an object with the json strings grouped by their variants. If included, components will always be applied last.

vue-i18n

Formats supported: JSON Functions very similarly and accepts all the same config properties as the i18next framework. The main difference is variable interpolation uses single brackets instead of double.

icu

Formats supported: JSON No additional properties are supported. Rather than generating an additional driver file, this framework changes the generated JSON string files to use ICU message format syntax for variable interpolation and pluralization, instead of the default flat JSON shape.
See ICU JSON for the full content shape, including how Map/List variables and plurals are represented.

arb

Formats supported: JSON No additional properties are supported. Generates ARB (Application Resource Bundle) files instead of the default flat JSON shape — the format used by Flutter’s intl package. Message text uses the same ICU message format syntax as the icu framework, plus @-prefixed metadata entries for variable placeholders and text item notes, and a top-level @@locale key when a base or variant locale is known.
See ARB JSON for the full content shape — including a note on why @@locale is the only thing identifying a generated ARB file’s language, and where to configure it.

Ditto-generated Files

iOS Locale Directories + Ditto.swift

If iosLocales is configured at the root level of the project config, a Ditto.swift file will be auto-generated in conjunction with the respective locale .lproj directories.
By default, Ditto.swift and the .lproj directories are placed at the root-level outDir, alongside any other configured outputs. Configuring iosLocalesOutDir sends them to a separate directory instead — useful since iOS output typically needs to live somewhere different in a codebase than other platforms’ output (e.g., inside an Xcode project’s source directory, rather than a general assets folder). Example:
The ios-strings output’s .lproj directories and Ditto.swift are written to ./MyApp/Localization (because of iosLocalesOutDir), while the unrelated android output still writes to the root-level outDir (./ditto).

Android Locale Directories

If androidLocales is configured at the root level of the project config, android-format XML files will be organized into the standard Android locale-qualified resource directories (values-<locale>/), instead of being written flat with a variant suffix. Unlike iOS, Android already has a default resource directory (values/, with no locale qualifier) that the platform falls back to automatically. Because of this, base text doesn’t need its own entry in androidLocales the way it does for iosLocales — it’s always written to values/ automatically. Only variants you want organized into a locale-specific directory need to be mapped. Example:
This configuration will generate:
Variants not mapped in androidLocales are written to the output directory with their variant suffix instead (e.g., my_project___german.xml), the same as unmapped variants with iosLocales. By default, the values/ and values-<locale>/ directories are placed at the root-level outDir, alongside any other configured outputs. Configuring androidLocalesOutDir sends them to a separate directory instead — useful since Android output typically needs to live somewhere different in a codebase than other platforms’ output (e.g., inside an Android module’s res/ directory). Example:
The android output’s values/ and values-<locale>/ directories are written to ./app/src/main/res (because of androidLocalesOutDir), while the unrelated ios-strings output still writes to the root-level outDir (./ditto).