Crowdin Query Language (CroQL)
Crowdin Query Language (CroQL) is a tool for Crowdin Editor and Crowdin Enterprise Editor and Crowdin and Crowdin Enterprise API that allows you to retrieve needed localization resources based on specific conditions. Using CroQL, you can filter source strings and their translations for a specific target language, as well as TM segments.
You can use CroQL with the following API methods:
- List Strings
- List Strings String-based
- List Language Translations
- List Language Translations String-based
- List TM Segments
- List TM Segments String-based
- List Strings
- List Strings String-based
- List Language Translations
- List Language Translations String-based
- List TM Segments
- List TM Segments String-based
Operators
Main CroQL operators are listed below. Use and combine them to set specific conditions for retrieving the needed content from Crowdin. To form your CroQL query, you can use the elements from the tables below.
Arithmetic Operators
The arithmetic operators are used to perform mathematic operations with any numeric data types.
Name | Symbol | Example |
---|---|---|
Addition | + | 1 + 9 |
Subtraction | - | 11 - 1 |
Division | / | 20 / 2 |
Multiplication | * | 2 * 5 |
Negation | - | -10 |
Comparison Operators
The comparison operators are used to compare values and return true
or false
.
Name | Symbol | Aliases | Example |
---|---|---|---|
Between | {{expression}} between {{expression}} and {{expression}} | 5 between 1 and 10 | |
Equal | = | 10 = 10 | |
Not equal | != | ≠ | 1 != 10; 1 ≠ 10 |
Greater | > | 10 > 1 | |
Greater or equal | >= | ≥ | 10 >= 1; 10 ≥ 1 |
Less | < | 1 < 10 | |
Less or equal | <= | ≤ | 1 <= 10; 1 ≤ 10 |
Contains | {{string}} contains {{string}} | "Hello World" contains "Hello" ; "Hello World" contains text ; text contains "Hello World" ; context contains text |
Logical Operators
The logical operators are used to combine multiple boolean expressions or values and provide a single boolean output.
Name | Symbol | Example |
---|---|---|
And | and | 1 < 10 and 10 > 1 |
Or | or | 1 < 10 or 10 > 1 |
Xor | xor | 1 < 10 xor 10 > 1 |
Not | not | not 1 < 10 |
Filtration Operators
The filtration operators are used to filter the objects based on the specified condition.
Name | Symbol | Example |
---|---|---|
Filter | {{collection}} where {{predicate}} | translations where (count of votes > 0) |
Match | {{object}} with {{predicate}} | user with (login = "crowdin") |
Conditional (Ternary) Operator
The ternary operator is used to check a condition specified in the first value, and if it’s true
it returns the second value, but if it’s false
it returns the third value.
Name | Symbol | Example |
---|---|---|
Ternary | If {{condition}} then {{expression}} else {{expression}} | If 1 < 10 then "less" else "greater" |
Fetch Operators
The fetch operators are used for retrieving data from the objects.
Name | Symbol | Example |
---|---|---|
Mention | @user:{{string}} ; @language:{{string}} | @user:"crowdin" ; @language:"en" |
Member | {{member}} of {{object}} | count of translations |
Identifier | {{identifier}} | text ; identifier |
Scalar Operators
The scalar operators are used to declare values for further processing.
Name | Symbol | Example |
---|---|---|
Integer | {{integer}} | 10 |
Float | {{float}} | 10.01 |
String | {{string}} | ”crowdin” |
Datetime | {{datetime}} | ’today’; ‘2021-03-16 00:00:00’ |
Group Operator
The group operator is used to determine the execution order of operators.
Name | Symbol | Example |
---|---|---|
Group | ( ) | 1 < 10 and (20 > 10 or 10 > 5) |
CroQL Query Examples
In this section, you can find practical examples of CroQL queries that will help you understand and use the querying capabilities within Crowdin. These examples can help you learn how to create your own queries to retrieve specific sets of data based on various criteria, such as translation status, user activity, and string properties.
Strings Queries
These queries are used to retrieve information about source strings.
-
Strings that have no Ukrainian translations with approvals or votes:
-
Strings that have only one translation:
-
Strings that have translations from only one specific user:
-
Strings that have at least one translation not from specific users:
-
Strings that have all translations not from specific users:
-
Strings filtered by identifier and numeric id of a file in your Crowdin project:
-
Strings that have unresolved issues filtered by numeric id of a file in your Crowdin project:
-
Hidden strings that are not duplicates and have one or more translations:
-
Strings that have one or more approvals:
-
Strings that have comments made by the user with a
crowdin
username: -
Strings that contain “ABC” in the source text but don’t contain “ABC” in their translations:
Using String Queries in Crowdin API
Use your query in the following Crowdin API endpoints:
Parameter | Details |
---|---|
{projectId} | Type: integer Description: Numeric identifier of your Crowdin project. |
{croql} | Type: string Description: CroQL expression. |
Translation Queries
These queries are used to retrieve information about translations.
- Translations made by the user with a
crowdin
username or ones with ≥ 100 upvotes:
Using Translation Queries in Crowdin API
Use your query in the following Crowdin API endpoints:
Parameter | Details |
---|---|
{projectId} | Type: integer Description: Numeric identifier of your Crowdin project. |
{croql} | Type: string Description: CroQL expression. |
Translation Memory Segment Queries
These queries are used to retrieve information about TM segments.
-
Translation memory segments containing at least one record used one or more times:
-
Translation memory segments containing at least one record created by the user with a
crowdin
username:
Using Translation Memory Segment Queries in Crowdin API
Use your query in the following Crowdin API endpoints:
Parameter | Details |
---|---|
{projectId} | Type: integer Description: Numeric identifier of your Crowdin project. |
{croql} | Type: string Description: CroQL expression. |
Examples based on the Editor Advanced Filter Options
Strings
- Strings added:
- Strings updated:
- String Type:
- Comments:
- Screenshots:
- QA Issues:
Translations
- Untranslated:
- Partially translated (plurals):
- Translated:
- Translated by:
- Not Translated by:
- Same as source string:
- Modified source String:
- Translations updated:
- Votes:
Duplicates
- Master strings:
- Duplicates only:
- Duplicates with shared translations:
- Duplicates with own translations:
Approvals
- Translated, not approved:
- Partially approved (plurals):
- Approved:
- Approved by:
- Not Approved by:
- Has translations after approval:
TM and MT
- Translated by MT:
- Translated by TM:
- Translated by TM or MT:
Other
- Pre translation:
- Used: Not available
- Not used: Not available
- Sort by: Not available
- Verbal Expressions: Not available
- Verbal Expression Scope: Not available
Context
CroQL can be used in the following contexts: source string context, translation context, and translation memory (TM) segment context. Use the following examples as a basis for building your CroQL queries.
Source String Context
type is plain | Type: Description: The source string with plain text. |
type is plural | Type: Description: The source string with plural forms. |
type is icu | Type: Description: The source string with ICU. |
type is asset | Type: Description: The source string is an asset. |
text | Type: Description: The source string text. |
identifier | Type: Description: The source string identifier (key). |
context | Type: Description: The source string context. |
max length | Type: Description: The source string max.length. |
is visible | Type: Description: The source string is visible. |
is hidden | Type: Description: The source string is hidden. |
is duplicate | Type: Description: The source string is duplicate. |
isPassedWorkflow | Type: Description: Crowdin Enterprise only. The source string passed through a project workflow. |
file | Type: Description: The source string file. |
comments | Type: Description: The source string comments. |
has issue | Type: Description: The source string has an issue. |
has unresolved issue | Type: Description: The source string has an unresolved issue. |
user | Type: Description: Numeric identifier of the user who added a comment. |
screenshots | Type: Description: The source string screenshots. |
translations | Type: Description: Translations of the source string. |
text | Type: Description: Translation text. |
plural form | Type: Description: Translation plural form. |
is pre translated | Type: Description: Translation added via pre-translation. |
provider | Type: Allowed values: Description: Translation provided via translation memory or machine translation engine. |
language | Type: Description: Language identifier specified as a string. Use the language codes, for example, |
user | Type: Description: Numeric identifier of the user who added a translation. |
votes | Type: Description: Array of the votes added to the translation. |
is up | Type: Description: Upvote. |
is down | Type: Description: Downvote. |
user | Type: Description: Numeric identifier of the user who added a vote for translation. |
added | Type: Description: Date when a vote for translation was added. |
approvals | Type: Description: Array of the added translation approvals. |
user | Type: Description: Numeric identifier of the user who approved a translation. |
added | Type: Description: Date when a translation approval was added. |
updated | Type: Description: Date when a translation was updated. |
languages summary | Type: Description: The source string top translations (the translations with the highest priority). |
language | Type: Description: Language identifier specified as a string. Use the language codes, for example, |
is translated | Type: Description: The source string is translated. |
is partially translated | Type: Description: The source string is partially translated. |
is approved | Type: Description: The source string is approved. |
is partially approved | Type: Description: The source string is partially approved. |
translation updated | Type: Description: The source string translation is updated. |
is auto translated | Type: Description: The source string is translated by TM or MT. |
is translated by tm | Type: Description: The source string is translated by TM. |
is translated by mt | Type: Description: The source string is translated by MT. |
is source changed after translation | Type: Description: The source string changed after translation. |
has translation as source | Type: Description: The source string has translation equal to source text. |
has translation after approval | Type: Description: The source string has translation after approval. |
has shared translation | Type: Description: The source string duplicate has shared translations from a master string. |
has qa issues | Type: Description: The source string has QA issues. |
has empty translation qa issues | Type: Description: The source string has empty translation QA issues. |
has translation length qa issues | Type: Description: The source string has translation length QA issues. |
has tags mismatch qa issues | Type: Description: The source string has tags mismatch QA issues. |
has spaces mismatch qa issues | Type: Description: The source string has spaces mismatch QA issues. |
has variables mismatch qa issues | Type: Description: The source string has variables mismatch QA issues. |
has punctuation mismatch qa issues | Type: Description: The source string has punctuation mismatch QA issues. |
has character case mismatch qa issues | Type: Description: The source string has character case mismatch QA issues. |
has special characters mismatch qa issues | Type: Description: The source string has special characters mismatch QA issues. |
has incorrect translation qa issues | Type: Description: The source string has incorrect translation QA issues. |
has spelling qa issues | Type: Description: The source string has spelling QA issues. |
has icu syntax qa issues | Type: Description: The source string has ICU syntax QA issues. |
has terms qa issues | Type: Description: The source string has terms QA issues. |
has duplicate translation qa issues | Type: Description: The source string has duplicate translation QA issues. |
has ftl syntax qa issues | Type: Description: The source string has FTL syntax QA issues. |
has android syntax qa issues | Type: Description: The source string has Android syntax QA issues. |
has custom qa issues | Type: Description: The source string has Custom QA issues. |
rating | Type: Description: The source string translation rating. |
approvalsCount | Type: Description: The number of translation approvals. |
labels | Type: Description: The source string labels. |
id | Type: Description: Numeric identifier of the label. |
title | Type: Description: Label title. |
is system | Type: Description: System label (label with source file name that is automatically added to strings in string-based projects). |
added | Type: Description: Date when a source string was added. |
updated | Type: Description: Date when a source string was updated. |
Translation Context
text | Type: Description: Translation text. |
plural form | Type: Description: Translation plural form. |
is pre translated | Type: Description: Translation added via pre-translation. |
provider | Type: Allowed values: Description: Translation provided via translation memory or machine translation engine. |
user | Type: Description: Numeric identifier of the user who added a translation. |
votes | Type: Description: Array of the votes added to the translation. |
is up | Type: Description: Upvote. |
is down | Type: Description: Downvote. |
user | Type: Description: Numeric identifier of the user who added a vote for translation. |
added | Type: Description: Date when a vote for translation was added. |
approvals | Type: Description: Array of the added translation approvals. |
user | Type: Description: Numeric identifier of the user who approved a translation. |
added | Type: Description: Date when a translation approval was added. |
updated | Type: Description: Date when a translation was updated. |
Translation Memory (TM) Segment Context
records | Type: Description: Array of translation memory segment records. |
id | Type: Description: Numeric identifier of a record. |
text | Type: Description: Translation text of a record. |
usageCount | Type: Description: The number of times a translation memory record has been used. |
createdBy | Type: Description: Numeric identifier of the user who created a translation memory record. |
updatedBy | Type: Description: Numeric identifier of the user who updated a translation memory record. |
createdAt | Type: Description: Date when a translation memory record was created. |
updatedAt | Type: Description: Date when a translation memory record was updated. |