Manage Glossaries
Glossaries Management
Lara’s Glossaries feature gives you full control over domain-specific terminology to ensure consistent and accurate translations across your content. With this feature, you can:
- List existing glossaries to manage your translation assets.
- Create new glossaries tailored to specific projects or clients.
- Update glossary names to keep your workspace organized.
- Delete glossaries that are no longer needed.
- Import terms via CSV, making it easy to onboard large sets of terminology.
- Check the status of your imports to ensure smooth uploads.
- Export glossaries for backup or use in other systems.
This functionality empowers you to customize Lara’s translations with precision and efficiency. All glossary functionalities can be accessed via the same Translator (lara in the example) object created to translate.
Glossary object
Field | Type | Description |
---|---|---|
id | String | Unique ID of the glossary. Format: gls_xyz123 |
name | String | Custom name of the glossary; it can be any string, including spaces, special characters, and non-Latin alphabets. Max length: 250 characters. |
created_at | DateTime | When the glossary is created |
updated_at | DateTime | When the glossary is last updated (equal to created_at with no updates) |
owner_id | String | User who owns the glossary. Format: acc_123xyz |
List Glossaries
Lists all glossaries available to the user
# List all glossaries available to the user
glossaries = lara.glossaries.list()
// List all glossaries available to the user
const glossaries = await lara.glossaries.list();
// List all memories available to the user
List<Glossary> glossaries = lara.glossaries.list();
// List all glossaries available to the user
$glossaries = $lara->glossaries->getAll();
Create new Glossary
Creates a new glossary with a custom name.
# Create a new empty glossary with name 'Glossary 1'
glossary = lara.glossaries.create('Glossary 1')
// Create a new empty glossary with name 'Glossary 1'
const glossary = await lara.glossaries.create('Glossary 1');
// Create a new empty glossary with name 'Glossary 1'
Glossary glossary = lara.glossaries.create("Glossary 1");
// Create a new empty glossary with name 'Glossary 1'
$glossary = $lara->glossaries->create('Glossary 1');
Field | Type | Required | Default | Description |
---|---|---|---|---|
name | String | Yes | The name of the new glossary |
Update Glossary Name
Updates the name of a specific glossary
# Update glossary name
updated_glossary = lara.glossaries.update('gls_1...', 'New Name for my glossary')
// Update glossary name
const updatedGlossary = await lara.glossaries.update('gls_1...', 'New Name for my glossary');
// Update glossary name
Glossary updatedGlossary = lara.glossaries.update("gls_1...", "New Name for my glossary");
// Update glossary name
$updatedGlossary = $lara->glossaries->update('gls_1...', 'New Name for my glossary');
Field | Type | Required | Default | Description |
---|---|---|---|---|
id | String | Yes | The unique identifier of the glossary to update. | |
name | String | Yes | The new name for the glossary |
Delete Glossary
Deletes a specific glossary
# Delete a glossary
deleted_glossary = lara.glossaries.delete('gls_1...')
// Delete a glossary
const deletedGlossary = await lara.glossaries.delete('gls_1...');
// Delete a glossary
Glossary deletedGlossary = lara.glossaries.delete("gls_1...");
// Delete a glossary
$deletedGlossary = $lara->glossaries->delete('gls_1...');
Field | Type | Required | Default | Description |
---|---|---|---|---|
id | String | Yes | The unique identifier of the glossary to delete. |
Import CSV to Glossary
You can import a CSV file into an existing glossary to bulk upload terms. Currently, Lara supports only unidirectional glossaries.
A unidirectional glossary unit consists of a list of glossary terms that work in one direction only — from a defined source term to one or more target terms. The first column defines the source language, and all other columns are target languages.
Unidirectional entries are uniquely identified by the combination of the source language and the source term. That tuple acts as the key.
Lara CSV Glossary Format Specification
Header Row
The first row of your CSV must contain valid language codes (e.g., en, es, fr, en-US, it-IT). These codes indicate the source and target languages:
- The first column is always the source language.
- All other columns are target languages.
For the full list of supported language codes, see here
Column structure
The first column defines the source language. All other columns define target languages. A Lara glossary is mono-directional and multilingual, that means:
- The system will match from source → target(s)
- The system will not match:
- target → source
- target → target
Other requirements
- Each row must include a source term and at least one target term. If the file contains rows that don't meet this requirement, it will be rejected.
- Empty cells are allowed for missing target terms, but at least one target term per row is required.
Need a ready-to-use example? Download the Lara CSV Glossary Format Template
Example
en-US | fr-FR | it-IT |
---|---|---|
apple | pomme | mela |
This entry allows:
apple
→pomme
(French)apple
→mela
(Italian)
However, it does not allow:
pomme
→apple
mela
→apple
This glossary can be defined in a CSV file with this content:
en-US,fr-FR,it-IT
apple,pomme,mela
# Import a local csv file to an existing glossary
import_job = lara.glossaries.import_csv('gls_1...', 'file/to/path')
/*
NODE
*/
import * as fs from 'fs';
// Import a local csv file to an existing glossary
const stream = fs.createReadStream('path/to/csv');
const importJob = await lara.glossaries.importCsv('gls_1...', stream);
// Import a local compressed csv file to an existing glossary
const streamGzip = fs.createReadStream('path/to/csv.gz');
const importJobGzip = await lara.glossaries.importCsv('gls_1...', streamGzip, true)
/*
BROWSER
*/
// replace with your input id
const fileInput = document.getElementById("fileInput");
const file = fileInput.files[0];
const importJob = await lara.glossaries.importCsv(GLOSSARY_ID, file, true/false);
// Import a local csv file to an existing glossary
GlossaryImport import = lara.glossaries.importCsv("mem_1...", new File("file/to/path"));
// Import a local csv file to an existing glossary
$importResult = $lara->glossaries->importCsv('gls_1...', 'file/to/path');
Field | Type | Required | Default | Description |
---|---|---|---|---|
id | String | Yes | The unique identifier of the glossary to update. | |
csv | File | | Yes | The CSV file to upload | |
gzip | Boolean | No | False | Indicates if the file is a compressed |
Check Import Status
Checks the status of an ongoing glossary import using the unique import_job
id returned in the “Import CSV” method
# Check the status of an import job
import_job = lara.glossaries.get_import_status('imp_1...')
// Check the status of an import job
const importJob = await lara.glossaries.getImportStatus('imp_1...');
// Check the status of an import job
GlossaryImport importJob = lara.glossaries.getImportStatus("gls_1...");
// Check the status of an import job
$importJob = $lara->glossaries->getImportStatus('gls_1...');
Field | Type | Required | Default | Description |
---|---|---|---|---|
id | String | Yes | The ID of the import job |
The import status is an object containing:
Field | Type | Description |
---|---|---|
id | String | The ID of the import job |
progress | Number | The current status of the import job. If it is = 1, it means the import is complete. If < 1, it means the import is still in progress. |
Get counts
The counts object gives information about the content of a glossary.
Field | Type | Description |
---|---|---|
unidirectional | Record<string, number> | The object is a field for each source language of the glossary, and its value represents the number of elements defined for that language |
# Get the counts for a glossary
counts = lara.glossaries.counts('gls_1...')
// Get the counts for a glossary
const counts = await lara.glossaries.counts('gls_1...');
// Get the counts for a glossary
GlossaryCounts counts = lara.glossaries.counts("gls_1...");
// Get the counts for a glossary
$counts = $lara->glossaries->counts("gls_1...");
Field | Type | Required | Default | Description |
---|---|---|---|---|
id | String | Yes | The ID of the glossary |
Export glossary
You can export a glossary as a CSV file, formatted according to the Lara CSV Glossary Format.
# export a glossary
glossaryContent = lara.glossaries.export('gls_1...', 'csv/table-uni', 'en-US')
// export a glossary
const glossaryContent = await lara.glossaries.export('gls_1...', 'csv/table-uni', 'en-US');
// Export a glossary
String glossaryContent = lara.glossaries.export("gls_1...", Glossary.Type.CSV_TABLE_UNI, "en-US");
// Export a glossary
$glossary = $lara->glossaries->export("gls_1...", "csv/table-uni", "en-US");
Field | Type | Required | Default | Description |
---|---|---|---|---|
id | String | Yes | The ID of the glossary | |
contentType | String | Yes | Currently, only "csv/table-uni" is supported | |
source | String | Yes | The source language of the glossary |
Availability of Glossaries in SDKs
Starting from the following SDK versions, the Glossary feature is available:
- Python: v1.4.0
- Node.js (TypeScript/JavaScript): v1.6.0
- Java: v1.4.0
- PHP: v1.2.0
For more details on implementation, refer to the SDK-specific documentation.
Updated about 23 hours ago