Adding translations
Some formats and frameworks (e.g., gettext/PO or XLIFF) don’t allow adding translation IDs manually. They rely on extractors that regenerate files and would overwrite IDs you add by hand on the next run.
There are three ways to add new translation IDs to your project:
Adding an ID manually
Click Add ID or use one of these keyboard shortcuts:
- Windows: CTRL+N
- macOS: ⌘+N
This opens a dialog where you can enter the new ID. If you’ve selected a branch in the Translation ID tree on the left, the branch path is pre-filled so you only need to enter the final segment.
You can also use this dialog to jump to an existing ID. Enter the ID and BabelEdit opens it in the center view.
Use the Extract from source code… button to add IDs found in your code (requires a configured Source Code View and isn’t available for all project types).
Extracting IDs from the source code
Requires a configured Source Code View and isn’t available for all project types. You can open it from the Add IDs dialog, the menu, or via shortcut:
- Windows: CTRL+ALT+N
- macOS: ⌘+⌥+N
On the left side, you see all IDs that are not yet part of your translation files. Selecting an ID shows its use in your source code on the right side.
Some IDs may show a warning sign, meaning they can’t be added to the project.
This is usually due to conflicting names (e.g., main.title can’t be added to a project that already contains
the ID main).
Add the selected IDs to your project with the Add selected button. You can also select all IDs at once.
You can ignore specific IDs so they won’t show up next time. Use the small Reset ignore list action to unhide them later.
The extractor uses regular expressions on your source code and has limitations (for example, it doesn’t detect IDs inside comments).
The extraction is supported by the following frameworks:
| Framework | Comment |
|---|---|
| Angular (Transloco) | does not support namespaces using read |
| Angular (ngx-translate) | yes |
| Ember (json + yaml) | yes |
| React (i18next) | does not support namespaces |
| Laravel (json + php) | yes |
| React (react-intl/formatjs) | yes |
| Svelte (svelte-i18n) | yes |
| Vue (vue-i18n) | yes |
Using an extractor provided by the framework
Some frameworks provide command-line extractors that scan your source code for new IDs and update your localization files.
BabelEdit detects these changes and reloads the files. Make sure to save your changes in BabelEdit before running the extraction tool.