Migration from i18n-ally

Convert i18n-ally settings, custom frameworks and reviews into an x18n config with x18n migrate i18n-ally.

x18n is a successor of i18n-ally. It reads the same kinds of projects, and it moves the logic out of VS Code, so it also runs in CI, in the browser and for agents. x18n migrate i18n-ally converts the i18n-ally settings of a project into an x18n config.

Run the migration

Run the command in the root of the project. First look at the result with --dry-run. It prints the files and writes nothing:

pnpx @x18n/cli migrate i18n-ally --dry-run
pnpx @x18n/cli migrate i18n-ally

The command reads:

  • the i18n-ally.* keys, the legacy vue-i18n-ally.* keys, and the i18n-ally-next.* keys of the i18n-ally-next fork, in .vscode/settings.json,
  • the settings of each *.code-workspace file in the root,
  • .vscode/i18n-ally-custom-framework.yml, or .vscode/i18n-ally-next-custom-framework.yml,
  • .vscode/i18n-ally-reviews.yml, or .vscode/i18n-ally-next-reviews.yml.

When a setting or file exists under both names, the i18n-ally-next one wins.

It writes:

FileWhen
x18n.config.tsAlways. --format yml or --format json writes x18n.config.yml or x18n.config.json instead.
x18n/custom.x18n-plugin.ymlWhen the settings hold regex scanners, scopes, refactor templates, locale flags, or a custom framework. The config lists it in plugins.
.vscode/settings.jsonWhen editor settings move to the x18n extension.
.x18n/reviews.ymlWhen i18n-ally reviews exist, and this file does not.

The command never deletes i18n-ally files or settings. At the end, it lists the i18n-ally settings that you can remove. If an x18n.config.* file exists, the command stops. Pass --force to replace it.

For a Vue project with these settings:

.vscode/settings.json
{
  "i18n-ally.localesPaths": ["lang"],
  "i18n-ally.namespace": true,
  "i18n-ally.pathMatcher": "{locale}/{namespaces}.json",
  "i18n-ally.enabledFrameworks": ["vue", "general"],
  "i18n-ally.sourceLanguage": "en",
  "i18n-ally.displayLanguage": "de",
  "i18n-ally.keysInUse": ["dynamic.*"],
  "i18n-ally.annotationInPlace": false,
  "i18n-ally.extract.keygenStyle": "snake_case"
}

the migration writes:

x18n.config.ts
import { defineConfig } from '@x18n/core'

// Migrated from i18n-ally by `x18n migrate i18n-ally`.
export default defineConfig({
  sourceLocale: 'en',
  presets: ['vue-i18n'],
  resources: [{ pattern: 'lang/{locale}/{namespaces}.json' }],
  usage: {
    keysInUse: ['dynamic.*'],
  },
  extract: {
    keyCase: 'snake',
  },
})

and adds "x18n.inPlace": false and "x18n.displayLocale": "de" to .vscode/settings.json.

In VS Code

When a folder has i18n-ally.* settings in .vscode/settings.json and no x18n.config.* file, the x18n extension offers to migrate it. It opens the files that it will write, and writes them only after you confirm. Then it restarts the language server. You can also run "x18n: Migrate from i18n-ally" from the command palette.

Settings map

i18n-allyx18n
localesPaths, pathMatcher, dirStructure, namespaceresources[].pattern. pathMatcher uses the same tokens. Without it, dirStructure picks {locale}.{ext} or {locale}/..., and namespace adds {namespaces}.
enabledFrameworkspresets. See Framework map.
enabledParsers, parsers.extendFileExtensionsformats
sourceLanguagesourceLocale
ignoredLocalesignoreLocales
keystylekeyStyle
disablePathParsingkeyStyle: 'flat'
defaultNamespacenamespace.default
keysInUseusage.keysInUse
usage.derivedKeyRulesusage.derivedKeys
usage.scanningIgnoreusage.exclude
sortKeys, sortComparewrite.sort: locale when sortCompare is locale, else binary
indent, tabStylewrite.indent
keepFulfilledwrite.keepFilled
extract.keygenStrategyextract.keygen
extract.keygenStyleextract.keyCase: camelCase, snake_case and kebab-case become camel, snake and kebab
extract.keyPrefix, extract.keyMaxLength, extract.autoDetectThe same names under extract
extract.ignored, extract.ignoredByFilesextract.ignore, extract.ignoreByFile
refactor.templatesextract.templates in the generated plugin. $1 becomes {key}.
regex.usageMatch, regex.usageMatchAppendscanners.regex in the generated plugin, for JS, TS, Vue, HTML and Svelte files
localeCountryMaplocaleInfo flags in the generated plugin
parsers.typescript.*execute: true on the JS and TS resource patterns. These resources are read-only.
annotations, annotationInPlace, annotationMaxLength, displayLanguageThe VS Code settings x18n.annotations, x18n.inPlace, x18n.annotationMaxLength and x18n.displayLocale

Framework map

i18n-ally frameworkx18n preset
vue, vue-sfc, vuexvue-i18n
nuxtnuxt-i18n
fluent-vue, fluent-vue-sfcfluent-vue
reactreact-intl
react-i18next, next-i18nextreact-i18next
i18nexti18next
i18next-shopifyi18next-shopify
next-intlnext-intl
next-internationalnext-international
next-translatenext-translate
sveltesvelte-i18n
ngx-translatengx-translate
translocotransloco
linguilingui
emberember-intl
polyglotpolyglot
globalizeglobalize
i18n-tagi18n-tag
i18n-jsi18n-js
ui5ui5
chrome-extchrome-extension
vscodevscode-extension
laravellaravel
php-joomlaphp-joomla
php-gettextphp-gettext
ruby-railsruby-rails
jekylljekyll
flutterflutter
general, customDropped. A custom framework becomes the generated plugin.

Every framework of i18n-ally has a preset. For an unknown framework id, the command prints a note and leaves it out.

Custom framework map

.vscode/i18n-ally-custom-framework.yml becomes x18n/custom.x18n-plugin.yml:

Custom frameworkYAML plugin
languageIdsscanners.regex[].extensions. Language ids become extensions, for example typescriptreact becomes tsx.
usageMatchRegexscanners.regex[].patterns, with {key} as it is
scopeRangeRegexscopes.regex
refactorTemplatesextract.templates. $1 becomes {key}.
monopoly: truepresets: [] in the config, so no built-in preset applies

What is dropped

  • translate.*: x18n calls no translation service. It writes translate prompts for an agent or an LLM instead. The command prints a note.
  • review.*: x18n does not read reviews yet. The command copies .vscode/i18n-ally-reviews.yml to .x18n/reviews.yml for later, and prints a note.
  • readonly, encoding, fullReloadOnChanged, includeSubfolders, ignoreFiles, editor.preferEditor, showFlags, annotationDelimiter, languageTagSystem, targetPickingStrategy and extract.targetPickingStrategy: the defaults of x18n handle them, or x18n has no such setting. The command prints a note for each one it finds. x18n uses locale codes as written, so it needs no languageTagSystem.

Settings that are not on this page are not migrated.

After the migration

  1. Run pnpx @x18n/cli doctor and make sure that x18n found your locale files and presets.
  2. Run pnpx @x18n/cli check.
  3. Install the x18n extension, and turn i18n-ally off for the workspace.
  4. Remove the i18n-ally settings that the command listed.