Commands
Initialization
To get started in no time, the init command will walk you through the basic commands to help you set the string sources that you would like to connect to your codebase, and the output file location (existing or a newly created one).
To initialize the CLI, run the next command and follow the instructions:
$ frontitude initFor an existing .json output file, init can detect the variable syntax and save it as variableFormat. See Configuration file.
init cannot create a {prefix} setup (one file per key prefix), but it keeps an existing one. See Configuration file.
Connect to data source
Connecting string sources (Frontitude projects, project folders, or the copy library) to your codebase will let you to pull their latest copy into your codebase and stay up to date effortlessly.
To set the sources that you would like to connect to your codebase, run the next command and use the checkbox selection:
$ frontitude source setTo view the list of connected sources:
$ frontitude source listPull
After setting the sources that you would like to connect to your codebase, you will be able to pull their latest copy directly to the configured output file, that later can be consumed in your codebase using any i18n framework of your choice (e.g. i18next, react-i18next, etc.), or directly (using require/import).
To pull the latest copy from your connected sources:
Options:
--nested
false
Applicable for JSON format only. By default, content is pulled in a flat format. Setting this option to true will output the content in a nested structure, where keys are broken into namespaces according to the workspace key convention delimiter.
--status
all
Available statuses: draft/review/final/all.
--has-key
false
Use this flag to pull only content that has been assigned keys. By default, content without keys is assigned auto-generated, non-human-readable IDs.
--tags
''
Pull content by tags. Specify comma-separated tag names string to filter copy (AND relation).
--include-metadata
false
Wrap each text in an object carrying its tags, status, note, and source metadata. See Metadata fields below for the full list.
--include-translations
false
Include latest translations. Each locale is saved to a dedicated file, in the same location as the source file. The locale will be concatenated to the file’s name as part of the extension. E.g. ./strings-es.json
--dry-run
false
Display the results in the CLI without creating or updating any files.
--access-token
Authenticate the pull request using this access token, taking precedence over any other configured access token.
--pages
Filter content by Frontitude pages from your connected projects. Specify a comma-separated page names string to filter content (OR relation). Applicable only when the source is a project.
--screens
Filter content by Frontitude screens from your connected projects. Specify a comma-separated screen names string to filter content (OR relation). Applicable only when the source is a project.
--error-format
text
Print errors as a human-readable message (text) or as a machine-readable { error: { code, message } } object on stdout (json). Defaults to json when CI=true, otherwise text. Can also be set via the FRONTITUDE_ERROR_FORMAT environment variable. See Error handling for the full list of error codes and exit codes.
--variable-format
Variable syntax of your .json file, for example %{name}. Overrides variableFormat. See Variable and plural formats.
--plural-format
Plural style of your .json file: suffix or joined. Overrides the pluralFormat style. See Variable and plural formats.
If filePath uses {prefix}, pull writes one file for each key prefix. --has-key is then always on, --nested and --include-metadata are errors, and --include-translations needs {locale}. See One file per key prefix.
If a strings file has a lock file, pull keeps it up to date and lists on stderr the local edits that it replaced. See Pull and local edits.
Metadata fields
When --include-metadata is set, each text in the pulled JSON becomes an object instead of a bare string. The exact set of fields depends on the source the text was pulled from.
Texts pulled from a project or project folder
These texts are backed by a Figma design layer, so they carry the design-hierarchy and Figma identifiers. Every field below is always present; a field is null when the underlying source is empty (for example, a text that is not an instance of a library component has parentComponentId: null).
value
The source-locale string for this text.
isMixedStyle
true when the source text mixes inline styles in Figma (bold runs, links, colored spans); false otherwise.
tags
Array of tag names applied to the text in Frontitude.
status
Workflow status of the text: New, Draft, Review, or Final.
note
Free-text note attached to the text in Frontitude.
updatedAt
ISO timestamp of the most recent revision to the text.
lastEditedBy
Display name of the collaborator who authored the most recent revision.
frontitudeLink
Direct URL to open the text in the Frontitude editor.
mergedTextId
Identifier used to group duplicate texts in the merged JSON output. For instances of a library component, equals parentComponentId; for any other text, a unique value of its own.
projectId
Frontitude project the text belongs to.
figmaFileId
Figma file ID of the design file the project is linked to.
pageId
Frontitude page the source text layer sits on.
figmaPageId
Figma page ID of the page the source text layer sits on.
frameId
Frontitude frame the source text layer sits on.
figmaFrameId
Figma frame ID of the frame the source text layer sits on.
figmaTextNodeId
Figma node ID of the source text layer itself.
parentComponentId
ID of the Frontitude library component this text is an instance of, when the text is linked to a component.
Texts pulled from the copy library
Copy-library texts are not tied to a specific layer in a design, so they do not carry the Figma or design-hierarchy identifiers above. Instead they expose the library component's own identity.
id
ID of the library component.
name
Full path of the component in the copy library.
value
The source-locale string for this text.
uniqueKey
The component's key, when one is assigned.
tags
Array of tag names applied to the component.
status
Workflow status of the text: New, Draft, Review, or Final.
note
Free-text note attached to the component.
updatedAt
ISO timestamp of the most recent revision.
lastEditedBy
Display name of the collaborator who authored the most recent revision.
frontitudeLink
Direct URL to open the component in the Frontitude copy library.
pluralId
Plural form id of the text's selected form (zero/one/two/few/many/other); empty for non-plural texts.
Plural texts
In either shape, a plural text carries one additional field, plurals: an object mapping each plural form (zero, one, two, few, many, other) to its variant's value. The top-level value field holds the source/selected plural form's value.
Push
Push new strings from your local source-locale file into the Frontitude copy library. By default, push only creates components for keys that Frontitude does not have, and does not change existing components. With --update, push also updates the keys that you changed in code. See Update existing keys.
By default, the CLI shows a preview of what would be created and asks for confirmation before writing anything. To skip the prompt, pass --non-interactive or set CI=true in your environment.
To inspect what would be pushed without making any changes:
Options:
--dry-run
false
Inspect what would be pushed without writing anything, in Frontitude or in a lock file. Prints the list of new keys and the count of already-existing keys that would be skipped. With --update, it also lists updates, conflicts, stale keys and renames, and only counts unchanged keys.
--tag
Comma-separated tag names to apply to newly-created components (e.g. --tag onboarding,checkout). With --update, the tags also go on the components that push updates or renames. Without --update, existing components are not retagged. Tags are never removed.
--message
Attach a message to this push, visible in the Frontitude activity log. Use @<email> to notify a workspace teammate (e.g. --message "@alice@example.com please review").
--non-interactive
false
Skip the dry-run preview and confirmation prompt. Auto-detected when stdin is not a TTY or CI=true is set.
--access-token
Authenticate the push request using this access token, taking precedence over any other configured access token.
--error-format
text
Print errors as a human-readable message (text) or as a machine-readable { error: { code, message } } object on stdout (json). Defaults to json when CI=true, otherwise text. Can also be set via the FRONTITUDE_ERROR_FORMAT environment variable. See Error handling for the full list of error codes and exit codes.
--variable-format
Variable syntax of your .json file, for example %{name}. Overrides variableFormat. See Variable and plural formats.
--plural-format
Plural style of your .json file: suffix or joined. Overrides the pluralFormat style. See Variable and plural formats.
--update
false
Also update existing components whose text changed in code. Overrides update in frontituderc.json. --no-update turns it off. See Update existing keys.
--on-conflict
skip
What a run that cannot ask does with a conflict: skip, overwrite or fail. Needs --update. Overrides onConflict in frontituderc.json. See Conflicts.
--status
Status for the components that push creates or updates: new, draft, review or final. Works without --update. Overrides status in frontituderc.json.
--include-translations
false
Also push the translation files that pull --include-translations writes. Needs --update. Overrides includeTranslations in frontituderc.json. See Translations on push.
--rename
Rename a component from an old key to a new key, as old=new. Repeat the flag for more renames. Needs --update. See Renames.
--apply-renames
false
Apply the renames that push finds in a run that cannot ask. Needs --update. See Renames.
--verbose
false
List every entry in the preview. Without it, each section of the preview shows the first 25 entries.
If filePath uses {prefix}, push reads all the matching files and the fallback file. See One file per key prefix.
See Error handling for exit codes, --error-format details, and the full error code catalog.
Update existing keys
frontitude push --update also writes the new text of keys that you changed in code. It can also rename components and push translation files.
You can also set update in frontituderc.json.
How update works
For each key, push compares three texts: the text in your strings file, the text in Frontitude, and the text at the last sync, which the lock file records.
Changed since the last sync
Not changed since the last sync
Updates the component.
Not changed since the last sync
Changed since the last sync
Skips the key. The key is stale. Run frontitude pull to get the new text. No setting overwrites a stale key.
Same text as Frontitude
Same text as your file
Nothing to write. Push updates the lock file.
Key is not in Frontitude
Creates the component.
An update writes a revision with the note
Updated from CLI, or with your--message.The normal status rules apply: a
finaltext goes back todraft, andrevieworfinaltranslations go back tonew.Push adds the plural forms and the variables that Frontitude does not have. It never removes a form that your file does not have.
--status finalworks like setting the status in Frontitude: when AI translation is on in your workspace, it starts AI translation of those components and uses your AI translation quota.Only new components count against your component limit.
Keys that differ only in letter case never match. Push skips a new key that differs only in case from an existing key or from another key in the push (
KEY_CASE_CLASH), and pushes the rest. A push without--updateworks as before.An empty value stops the push before any request (
EMPTY_PUSH_VALUE). Keys that start withfrontitude-are reserved, and push skips them.
Lock files
Once you use --update, or set update to true in frontituderc.json, push and pull keep a lock file next to each strings file, also for translation files, for example strings/Checkout.json.frontitude-lock or fr.lproj/Localizable.strings.frontitude-lock. It holds hashes only, no text.
Commit the lock files. Do not add them to
.gitignore. Without them, push in CI cannot tell a code edit from a Frontitude edit.Do not let formatters change them. The CLI writes one line per key, with sorted keys, so git can merge the file, and it changes back what a formatter changes. Add this line to
.prettierignore, and to the ignore file of any other formatter or linter:If a lock file is not valid JSON (for example, an unresolved git merge conflict), has a newer version, or belongs to another locale, push and pull stop and name the file. See Update errors.
After you delete a lock file, the next run is a first run without a lock file. So run
push --update --dry-runand read the list first.Pull writes a lock file only when the strings file already has one, or when
updateistrueinfrontituderc.json.pull --nestedandpull --include-metadataleave the lock files as they are.Push without
--updatekeeps an existing lock file up to date for the keys that it creates.If push updated Frontitude but cannot save the lock file, it stops with
LOCK_NOT_SAVED.
Using it in CI
Commit the lock files after every push and pull that changes them. Otherwise CI compares with old lock entries: a key that CI pushed and a writer then edited is a conflict instead of stale, and with overwrite CI writes over the writer's text.
This command fails the job on open conflicts, and applies renames:
To fail the job when a push changed a lock file that is not committed, add this step after the push. Unlike
git diff --exit-code -- '*.frontitude-lock', it also catches new lock files:A script cannot read the conflicts that the default
skipleaves, and the job passes. See Conflicts.Outside a terminal (CI,
--non-interactiveor--dry-run), the CLI prints this line on stderr for a strings file without a lock file. It names up to three files and counts the rest. It never changes the exit code.Push has no JSON summary. Warnings, and the conflict list of
--on-conflict=fail, go to stderr. A rename that Frontitude refuses does not change the exit code. For exit codes and JSON errors, see Error handling.
First run without a lock file
The first push --update in a project with content in Frontitude has no lock file. Run frontitude push --update --dry-run first and read the list. For each key:
The key is not in Frontitude: push creates it.
Your file and Frontitude have the same text: nothing to write. Push adds the key to the lock file.
The texts differ: it is a conflict (
NO_BASELINE), whoever wrote last and whatever the status. You decide. See Conflicts.
Without a lock file, push cannot find renamed keys and creates them as new components, so use --rename old=new. And --on-conflict=overwrite writes your text over every key that differs, also over writers' edits.
Conflicts
A conflict is a key whose text changed in code and in Frontitude, or whose text differs and has no lock entry.
In a terminal, push shows your text, the Frontitude text, who edited it and when, and asks: overwrite, skip, overwrite all, or skip all. The answer is for the whole key, also for a plural key.
In CI (--non-interactive, or CI=true), --on-conflict or onConflict in frontituderc.json decides:
skip (default)
Push lists the conflicts and does not write them. Exit code 0.
overwrite
Push writes your text over the conflicts. Stale keys are still not written.
fail
Push stops with exit code 1 and writes nothing, for any key. It checks every chunk first.
In a terminal,
skipandoverwritedo not stop the questions. Onlyfailskips them.In a terminal, or with
fail, push checks that nothing changed in Frontitude since the preview. A terminal run skips and reports a changed text. Afailrun stops with exit code 1, or withPUSH_PARTIALLY_APPLIEDif an earlier chunk was already written. Runs withskiporoverwritethat cannot ask have no preview and no such check.A conflict with the reason
LOSSY_VARIABLES(Apple.strings) orUNSUPPORTED_MARKUP(Android XML) is never written, not even withoverwrite, and a terminal does not ask about it. Withfail, it still stops the run. Push says "push again with--on-conflict=overwrite" only when at least one skipped conflict is on another key. All forms of a key with one of these reasons do not count. ForLOSSY_VARIABLES, see Formats. ForUNSUPPORTED_MARKUP, see Android XML.
What skip leaves behind. A skipped conflict changes nothing, not even the lock file. It comes back on every run until someone resolves it, but the CI job passes. To resolve a key:
Keep your text: push again with
--on-conflict=overwrite, or answer overwrite in a terminal.overwritewrites every conflict of that run, so read the list first.Keep the Frontitude text: run
frontitude pull.Or make both texts the same by hand. Push then records the key in the lock file.
Renames
When you rename a key in code, push can rename the component in Frontitude. The component keeps its id, its instances, Figma links, translations and history.
Renames that push finds. Push looks for a key that is in the lock file but gone from the strings file, and a new key with exactly the same text. In a terminal, it asks about each one. If two keys have the same text, push proposes nothing and warns. A rename that also changes the text is not found, so use
--rename.--apply-renamesin CI. A run that cannot ask applies a found rename only with--apply-renames. Without it, push creates the new key as a new component, and the old component stays. That makes a duplicate. The summary says so. A--dry-runshows found renames as not applied, unless you pass--apply-renames.--rename old=newnames a rename yourself. It works without a lock file, and in CI without--apply-renames. Use the key as Frontitude shows it, and the base key for a plural (Cart.items, notCart.items_one). The text can change in the same push: push renames first, then compares the text as usual.A
--renamevalue that cannot be used stops the push before any request. SeeINVALID_RENAME.A
--renamethat was already applied is skipped with an info line and exit code 0. So it is safe to repeat a run, or to keep the flag in a CI script.Frontitude refuses a rename when no component has the old key, another component has the new key, or a strings file still has the old key. The preview lists it under "Not renamed" with the reason, and the push continues. Push never merges two components.
Rename the key in the translation files too. Otherwise an explicit
--renamestops before any request, and a rename that push finds is not applied: push warns and creates the new key as a new component.If a rename moves a key to another
{prefix}file, keep the old file, even as{}, until the push has run. Push needs its lock file. Otherwise the rename is a conflict without a lock entry, and push skips it by default.
Translations on push
frontitude push --update --include-translations also pushes the translation files that pull --include-translations writes, from the same paths, also with {locale} in filePath. You can also set includeTranslations in frontituderc.json.
Push compares and writes a translation under the same rules as source text.
A written translation gets the status that a Frontitude edit gives:
neworfinalbecomesdraft, anddraftandreviewstay.--statusoverrides this.If the source text of the key also changed, push writes the source first, which resets approved translations to
new. A translation that you also changed is written after that, and ends asdraft.Push never adds a language. It ignores, with no message, a translation file of a locale that your workspace does not have. Add the language in Frontitude first.
Push never creates a component from a translation. It skips a translation of a key that has no source text (
ORPHAN_TRANSLATION), unless it creates the source key in the same run.
Formats
Update works for .json, XLIFF (1.2 and 2.0), Android .xml and Apple .strings files. .properties files are not supported. After a pull, a push --update with no edit changes nothing, in every format.
JSON. Push ignores a byte order mark at the start of the file.
variableFormatandpluralFormatdo not change the lock file.XLIFF. In a translation file, push reads
<target>, not<source>. The target language of the file must match the locale in the file name, or push stops. Push skips units with inline elements. See XLIFF.Android XML. Push reads the escapes that pull writes (
\',\",\\,\@,\?,\n,\t). Pull writes a-in a key as_, so push cannot match such a key. It creates a new component and never updates it. See Android XML for styling markup and for elements other than<string>and<plurals>.Apple
.strings. Push can read keys that end in_zero,_one,_two,_few,_manyor_otheras plural forms. See Apple Strings for the rule. When you edit a text, push gives the variables their names back by position, if the number of placeholders is the same. If you add or remove a placeholder, the key is a conflict with the reasonLOSSY_VARIABLES, and no policy writes it. Fix the variables in Frontitude, then runfrontitude pull. The translation paths changed in CLI version 2.0.0. See Translation paths.
Pull and local edits
pull still writes the Frontitude text over your file. If a lock file exists, pull (also with --dry-run) lists on stderr the local edits that it replaced: the key, your old text and the new text. Use git diff to see them, or git checkout to get them back.
Pull cannot report a key that has no entry in the lock file, or a key that it moves to another
{prefix}file.Pull only changes the lock entries of the keys that it writes. A filtered pull (
--tags,--status) leaves the other entries as they are.
Large pushes
A push request carries at most 7,000 forms. Push splits a larger push into chunks, also without
--update. All forms of one key go in the same chunk.If a chunk fails after earlier chunks were saved, push stops with
PUSH_PARTIALLY_APPLIED.Run
push --updatetwice with no change in between, and the second run writes nothing.
Using command aliases
To make it easier to run long commands in web projects, you can use the scripts section in your package.json.
Here’s an example of a command you can add:
This allows you to run the following command to fetch content from Frontitude:
Last updated