Identifying assets uniquely by source text
Some platforms use source language translations as unique identifiers. Loco uses unique Asset IDs to identify translatable items, but you can work completely without IDs if that's how your platform works. Most commonly this is how Gettext is used.
Source text is not an Asset ID
It's important to note first of all that "source text" is not the same thing as an Asset ID.
- The source text of an individual asset is a "translation" in your source language. This is often English, but can be any language.
- Loco's unique IDs are additional to your source texts. You can disable them in your project settings or simply ignore them.
Uniqueness and context
Loco provides a context field to disambiguate identical assets. This allows you to have different translations for multiple instances of the same source text. The uniqueness of this combination in not enforced, but Loco will warn you if you create a duplicate when Asset IDs are disabled.
Importing from file
When importing translations you must tell Loco that your file maps one language to another. This ensures that entries in the file are matched to existing assets by the their source text and context and not by their Asset ID. This is the default for some platforms (like Gettext), but you can specify it for any file format. If Asset IDs are disabled, this is always the default.
If the importer is unable to match the asset it will create a new one instead, so be careful not to alter source text outside of Loco. Fuzzy matching is not yet supported in file imports, so any changes in source text could result in matching failures.
Exporting to file
When exporting translations you can specify that the file is indexed by text. This is the default for some platforms (like Gettext), but you can specify it for any file format. If Asset IDs are disabled, this is always the default.
When exporting by text there is no guarantee that each string in your file is unique. (A common mistake is exporting multiple empty strings). Some platforms may complain when this happens, others may just cause you problems silently.
Addressing assets via the API
If you're working with the API (other than just for imports and exports) you must reference assets by their ID even if your platform is only concerned with source text keys. Only Loco Asset IDs are guaranteed to be unique, so the API won't attempt asset lookups via source text or context.