Skip to content

Reference

Configuration

One file at the root of your project, and the plugin takes the same object, so a setting means the same thing to your build and to the command line. Flags win over the file.

verbaly.config.mjs
export default {
  sourceLocale: 'es',
  locales: ['es', 'en', 'pt'],
};

Accepted names are verbaly.config.js, .mjs, .ts, .mts and .json, read in that order. A TypeScript config needs esbuild installed, and the tool says so if it is missing.

Every option

OptionDefaultWhat it does
sourceLocale'en'The language you write in
localesThe catalog files it findsYour languages. List them and the list is complete; leave it out and every JSON file in dir counts as one
dir'locales'Where the catalogs live
rootWhere you ran the commandThe project root every other path is resolved against
includesrc/**, app/**Which files are scanned for messages. [] turns scanning off, for a project whose catalogs are written by hand
excludenode_modules, distWhich files are skipped inside that
routingFollows your setupWhere the language lives in your addresses. See URL strategy
dts'verbaly.d.ts'Where the generated types are written, or false to write none. Astro and Nuxt place them in their own types folder without you setting this
bundleNothing excludedexclude: groups of messages that stay in the build and never reach the browser
renderOffThe pre-translated mirror for static sites. Its own options are below
translateClaudeEverything machine translation needs beyond the provider: model, batch size, glossary, instructions
icuYour catalogs decideForces the ICU parser to ship. Only for messages that reach your app after the build
relativeYour catalogs decideThe same, for relative time formatting

Inside render

Only for static sites that publish one address tree per language. Adding this section is what switches the mirror on.

OptionWhat it does
baseUrlYour public address. Alternates and the sitemap need it
siteThe built directory to mirror. Defaults to dist
sitemapWrites a per-language sitemap. A string names the file
excludePages to leave out of that sitemap, by path inside the build directory
hreflangReciprocal alternates on every page. On by default
redirectSends a first-time visitor to their language before the page paints
linksThe real addresses behind named links inside your messages
baseThe path prefix, if your site is not served from the root
attributeThe attribute to look for, if you renamed data-verbaly
inlineCatalogWrites into each page the messages it renders, so it downloads no others
cleanDrops language pages left over from an earlier build

Inside translate

Everything machine translation needs beyond the provider, so a run behaves the same for everyone on the project instead of depending on who typed the command.

OptionWhat it does
modelWhich model the built-in provider uses. --model overrides it for one run
batchSizeHow many messages go in one request, 20 by default. Lower it if long messages get cut off, raise it for short ones
concurrencyHow many requests are in flight at once, 4 by default. Lower it if your provider rate limits you
retriesHow many times a request that fails for a passing reason is tried again, 2 by default
instructionsAnything you would tell a human translator about your product: how formal to be, how short a button label has to stay, what your app is
glossaryHow a term has to come out. Give one wording for every language, which is how you say leave this alone, or one per language. Only the terms a batch actually contains are sent

A run survives a bad connection. Requests that fail for a passing reason are tried again, and if one still does not come back, everything else is written and the report names the messages it could not fill. Running translate again asks only for those, so a dropped connection never costs you the whole run twice. The command exits 1 when that happens, so a script notices.

Only in the plugin

failOnMissing: false lets a build finish with untranslated messages, which fall back to your source language. It never lets a broken translation through: one that lost a value or a plural case still stops the build, because it would render wrong.

to moveEnterto open
Copied to clipboard