Main menu

Collisions on source text keys

Direct collisions on non-unique keys are easy to imagine. Loco doesn't enforce unique source text (on purpose), so it's perfectly possible to have two translation pairs like this:

(id=1) "Collision" = "Eine Kollision"
(id=2) "Collision" = "Die Kollision"

Loco will always avoid exporting an invalid file. So (for example) a Gettext .po file will never contain both keys. Current behaviour is to ignore duplicates, rather than throw an error or produce corrupt output.

Tip: New API options give you more control over how this is handled. See the product notice.

Context disambiguation

It's common for text-indexed file formats (like Gettext) to support a disambiguating field. Loco adopts the terminology of Gettext, and calls this context. This allows identical source texts to be exported without collisions if the target format supports it. Duplicates are still possible, but more easily avoided.

Tip: If you disable asset IDs in your project settings, Loco will warn you if a source/context combination already exists.

Generic object schemas

Forcing generic key/value formats (like JSON or YAML) to use full text keys won't automatically use context disambiguation. Only schemas with a documented mechanism for disambiguation can use the context field. These schemas are often based on Gettext (such as Jed and angular-gettext), but worthy of note is ARB which is a JSON schema used in Dart.

None of Loco's supported YAML, or PHP formats have a context mechanism.

Other non-unique indexes

Loco supports custom aliases, which (like source text) are not guaranteed to be unique. However, the file exporter treats aliases like IDs, and falls back to the unique ID when an alias is empty. This means context disambiguation is not applied.

See also

Last updated by