# 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

1. Open the app's **Keys** tab and press **Import** (**Import a file** when the app has no keys yet).
2. **Language of this file:** pick the language the texts are in.
3. **Namespace:** where the keys go, for example `common`. A new name makes a new namespace.
4. Choose the file (5 MB at most; split a bigger one by namespace).
5. 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.parse` would 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`, `build` and similar folders). It looks at `.json`, `.yml`/`.yaml`, `.xlf`/`.xliff` and `.properties` files named after one of the app's own languages, exactly: `en-US.json` is not `en`, 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](https://lefine.ai/en/docs/strings/connect/).
- **CLI:** `npx lefine strings push -p app_…` sends your JSON source file.

Source: https://lefine.ai/en/docs/strings/import/
