Map JSON, YAML, and Laravel PHP locale files
Map source and target locale files in Transglot Community and understand what its translation checks preserve.
Community maps each source file to the equivalent path under a target locale. Open Projects → Import folder → Detect files and inspect the suggested mappings in Preview import.
| Format | Supported content | Example mapping |
|---|---|---|
| JSON | Flat or nested objects with string leaves, including arrays of strings inside an object. | locales/{locale}/**/*.json |
| YAML | YAML 1.2 maps with string values, nested maps, and sequences with string leaves. | translations/{locale}/**/*.yaml |
| Laravel PHP | Files that return literal, string-keyed arrays. | lang/{locale}/**/*.php |
Add a custom file pattern
If detection misses a layout such as messages/en.json, open Use a custom file pattern. Enter messages/{locale}.json, choose JSON, and preview again. Here, the same rule maps messages/en.json to messages/fr.json for French. Include the exact extension when using a file name pattern.
Treat a locale prefix inside the file as part of its keys. If an English YAML file wraps messages under en:, Community treats en as a key and does not rename it to fr:. Use files whose translation maps share the same root shape.
Keep keys, placeholders, and plurals intact
Community translates string values. Source files, unknown target keys, and non-string values are preserved. It checks placeholders, supported ICU message structures, plural selectors, HTML tags, and glossary rules. Review the wording and rendering in your application before shipping.
YAML aliases, anchors, and explicit tags are rejected. Community reads literal Laravel PHP arrays without executing PHP. You can find the full syntax rules and validation limits in the Community format guide.