Soft launchDialecto is still in testing, and details on this site may change as we finish it.

Apple / Swift

Dialecto edits .xcstrings String Catalogs the way it edits every other format: it splices each change into your file’s own bytes and opens a pull request, so a one-string edit is a one-line diff. Xcode’s key order, spacing and every untouched entry stay as they were.

Renaming keys

Renaming a key in the catalog changes the Swift code that reads it in the same pull request. You do not search your project for the old key.

  • Your CI scans. The workflow Dialecto generates runs a small Node script, dialecto-swift-usages.mjs, over your .swift files and sends only the calls that name a key: Text("home.title"), not the file around it. Dialecto never reads your Swift source.
  • Dialecto computes. For each call that reads the renamed key, Dialecto works out the exact bytes to replace.
  • Your repository applies. The dialecto-eu/source-rewrite@v1 action replaces those bytes on the pull request’s own branch. The action only changes a call whose bytes still match the scan.

The pull request lists every call it changed. A group rename moves every key under the prefix the same way.

Calls it changes

Form Example
String(localized:) String(localized: "export.button")
NSLocalizedString NSLocalizedString("export.title", comment: "")
LocalizedStringKey LocalizedStringKey("export.hint")
LocalizedStringResource LocalizedStringResource("export.res")
Text, Button, Label, Toggle Text("export.text")
Your own helper L("export.title")

A helper is a function of yours that takes the key as an argument. Name it in the workflow’s DIALECTO_SWIFT_HELPERS setting, for example L,LText; Tr:1 names a helper that takes the key as its second argument.

Calls it lists

Dialecto lists these in the pull request and leaves the line as it was:

  • a key built at run time, such as L("scene.\(id)"), which also blocks renaming any key the call could read;
  • a raw string (#"..."#) or a multi-line string;
  • a key the scan could not read as one literal, such as a variable.

The scan leaves some calls out altogether: a call with a tableName: other than the default, and Text("...") text that is not a key in your catalog, which is shown as written.

Keys Xcode extracts

Xcode adds a key to the catalog when it finds one in your code, and adds it back on its next sync while any call still uses it. Dialecto keeps such a key locked: change it in Xcode, or give the call a key of your own first.

Turning code changes off

Your organization can turn off source call editing. A rename then changes the catalog alone, the scan sends no calls, and the editor reminds you to change your Swift code. The setting is for the whole organization.

Requirements

  • A repository that runs Dialecto’s generated workflow, which carries the scan and the source-rewrite step.
  • Node on the CI runner, which GitHub-hosted runners have.

See Source call-site rewrite for how the halves split between Dialecto and your repository.