The file structure of text pulled down via the CLI
./ditto
folder relative to the current working directory, but the location of the output files can be customized by setting the environment variable DITTO_TEXT_DIR
.
If a DITTO_TEXT_DIR
environment variable is specified, the config will still be read from a ./ditto
folder relative to the current working directory that the CLI is executing in.
./ditto
Directory./ditto/config.yml
) used by the CLI and is also the default write destination for any output files the CLI writes to disk.
If you run the CLI in a directory that does not contain a ditto/
folder, the folder and a default config.yml
file will be automatically created.
source_name
: the name of the source a given file holds data for
components__{folder_name}
{project-name}
variant_name
: the API ID of a variant or base
for files generated for non-variant textextension
: the file extension that corresponds to the configured format(s)-
and _
) removed.
See the section on iOS format-specific files for the only exception to these conventions.
index.js
driver file is generated to simplify the process of integrating Ditto into JavaScript apps.
If a package.json
file is detected with "type": "module"
, the driver file will be generated as an ESM module. Otherwise, it will be generated as a CommonJS module.
index.d.ts
file is also generated with type definitions for the driver file.
The generation of both the index.js
and index.d.ts
files can be disabled by specifying disableJsDriver: true
in your config.yml
file.
ios-strings
, ios-stringsdict
) are configured alongside the iosLocales property, iOS string files are grouped into localization bundles and a Ditto.swift
driver file is generated.
The string files will be structured as follows:
Ditto.swift
driver file will look like this:
.strings
and .stringsdict
files inside of the respective lproj
folders.Ditto.swift
driver are imported into Xcode, you can call methods from the Ditto
struct directly to get localized strings: