.source.json convention to separate the annotated source from the clean runtime file.
The .source.json convention
When you run lazylocales translate for the first time, the CLI automatically renames your source file:
en.json is generated automatically — stripped of all annotations and ready for your i18n library.
The clean
en.json is regenerated on every translate and push run. You should never edit it directly — always edit en.source.json instead.Why two files?
Most i18n libraries (i18next, next-intl, vue-i18n) expect a plain JSON file with only key-value pairs. Annotation keys like__context__ and __lock__ would cause warnings or unexpected behavior at runtime. The .source.json convention keeps your annotations in a separate file that only the CLI reads, while the generated en.json stays clean for your app.
Annotations
Annotations are special keys you add to your source file to control how the AI translates (or doesn’t translate) specific strings. They are always stripped from the generated output files.Context (__context__)
Provide translation context by adding a __context__ key next to any translation string. The key name format is __context__ followed by the sibling key name.
en.source.json
- Where the text appears in your UI
- Tone — formal, casual, technical, playful
- Constraints — character limits, line length, abbreviation rules
- Terminology — domain-specific terms, brand voice
en.source.json
Lock (__lock__)
Prevent a key from being translated by setting its __lock__ sibling to true or "true". Locked keys are copied verbatim from the source into every target locale file.
en.source.json
de.json, fr.json, etc.), brand will always be "LazyLocales" and product.name will always be "TranslateAI Pro" — they are never sent to the AI.
Lock annotations are useful for:
- Brand names and product names
- Technical terms that must stay in the source language
- Constants — error codes, identifiers, placeholder strings
- Legal text that requires exact wording
Combining annotations
You can use both__context__ and __lock__ on the same key. For example, you might lock a key now but leave context for future reference:
en.source.json
How annotations affect the diff
When you add, remove, or change a__context__ or __lock__ annotation, the CLI treats the associated key as modified — even if the value itself didn’t change. This means:
- Adding
__context__greetingwill re-translategreetingin all target locales (with the new context). - Adding
__lock__brandwill replace the translatedbrandwith the source value in all target locales. - Removing a
__lock__will cause the key to be translated by AI on the next run.
Full example
Here’s a realistic source file with mixed annotations:en.source.json
lazylocales translate, the generated de.json would look like:
de.json
appNameandnotFoundare locked — copied verbatim from the source.saveandgreetingare translated with their context hints.- All annotation keys are stripped — the output is clean JSON.