Skip to content

Configuration

Options can be passed as CLI flags or defined in a config file. Config files are loaded via cosmiconfig:

  • loco.config.js (recommended)
  • .locorc.yaml
  • .locorc.json
  • .locorc.js

When the same option is set in both places, the CLI flag takes precedence over the config file. This lets you keep shared defaults in the config file and override them per invocation.

loco.config.js
/** @type {import('loco-cli/types').Config} */
module.exports = {
accessKey: '<loco-full-access-key>',
localesDir: 'src/app/i18n/locales',
namespaces: false,
push: {
'flag-new': 'provisional',
'tag-new': process.env.npm_package_version,
'delete-absent': false
}
};
Config keyCLI flagTypeDescription
accessKey-a, --access-key <key>stringThe API key from your Loco project. Find it under Developer Tools → API Keys → Full Access Key. An Export key works for pull-only usage.
localesDir-d, --locales-dir <path>stringFolder containing JSON translation files. Defaults to current directory.
namespaces-N, --namespacesbooleanOrganize translations into namespaces (default: false). When enabled, asset IDs are prefixed with <namespace>:.
maxFiles-m, --max-files <number>numberMaximum files to display in diff output (default: 20).
pushPushOptionsOptions for loco-cli push. See below.
pullPullOptionsOptions for loco-cli pull. See below.

Options passed to the Loco import API:

OptionDescription
experimentalPushAllUpload all locales in a single API request instead of one per locale. Significantly improves performance for projects with many locales.
ignore-newNew assets will NOT be added to the project
ignore-existingExisting assets will NOT be updated
ignore-blankBlank translations will NOT be imported
tag-newTag new assets with given tags (comma separated)
tag-allTag ALL assets in the file (comma separated)
untag-allRemove tags from matched assets (comma separated)
tag-updatedTag assets modified by this import
untag-updatedRemove tags from modified assets
tag-absentTag assets NOT found in the imported file
untag-absentRemove tags from assets NOT in the file
delete-absentPermanently delete assets NOT in the file (use with caution)
flag-newSet flag on new non-empty translations
flag-updatedSet flag on translations modified during import

Options passed to the Loco export API:

OptionDescription
filterFilter by tags. Match any with *, negate with ! prefix
fallbackFallback locale for untranslated assets (e.g., en or en_GB)
orderExport according to asset order
statusExport by status/flag. Negate with ! (e.g., translated, !fuzzy)
charsetPreferred character encoding
breaksForce platform-specific line endings (default: Unix LF)