Docs menuStrings / Upload files
Upload files
Bring texts in from a locale file: JSON, YAML, Android XML, XLIFF or .properties. You see what changes before anything is written.
Upload one locale file per language. Lefine shows what it would create, update, skip and drop, then imports it. Nothing is dropped without a reason.
Upload a file
- Open the app's Keys tab and press Import (Import a file when the app has no keys yet).
- Language of this file: pick the language the texts are in.
- Namespace: where the keys go, for example
common. A new name makes a new namespace. - Choose the file (5 MB at most; split a bigger one by namespace).
- Check the preview: In file, Created, Updated, Skipped, Dropped. Then press Import.
Keys that exist get the new text. New keys are created. The same file a second time writes nothing: Lefine says Already imported.
Formats
The format comes from the file name.
| File | What Lefine reads |
|---|---|
.json | Flat ("home.title": "…") or nested ({ "home": { "title": "…" } }). Nested keys are joined with . |
.yaml, .yml | A map of keys to texts. A file wrapped in its locale (en: with every key under it, as in Rails) is read from inside |
.xml with <resources> | Android strings.xml: each <string name> |
.xlf, .xliff (or .xml with <xliff>) | XLIFF 1.2 <trans-unit> and 2.x <unit>: the target when it has text, else the source. The key is resname, else id |
.properties | Java's rules: key=text (or : or a space), # and ! comments, \uXXXX escapes, a trailing \ joins lines |
What is not imported, and why
Every entry Lefine cannot bring in is listed with its reason. For example:
- A key written twice in one file: the first one is kept, the second is reported. (A plain
JSON.parsewould keep the last one without a word.) - Android
<plurals>and<string-array>: not supported yet; use one<string>per item. - Android strings marked
translatable="false". - YAML aliases (
*name): write the text out. - A key longer than 256 characters, or a text longer than 10,000 characters.
From a repo or the CLI
- GitHub: the Sync tab finds locale files at any depth (not in
node_modules,dist,buildand similar folders). It looks at.json,.yml/.yaml,.xlf/.xliffand.propertiesfiles named after one of the app's own languages, exactly:en-US.jsonis noten, it is shown as a hint. Android XML is not found in a repo; upload it here. Only JSON is written back in pull requests. See Connect GitHub or the CLI. - CLI:
npx lefine strings push -p app_…sends your JSON source file.