Crowdin Query Language (CroQL)

Crowdin Query Language (CroQL) is a tool for Crowdin and Crowdin Enterprise API that allows you to retrieve needed localization resources based on specific conditions. Vha. CroQL kan kildestrenge og deres oversættelser filtreres ift. et bestemt målsprog.

You can use CroQL with the following API methods:

Operatorer

CroQL-hovedoperatorer er anført nedenfor. Benyt og kombinér dem for at opsætte særlige betingelser for at hente indhold fra Crowdin. Elementerne fra tabellerne nedenfor kan bruges til at danne CroQL-forespørgslen.

Aritmetiske operatorer

De aritmetiske operatorer bruges til at udføre matematiske operationer med enhver numeriske datatype.

Navn Symbol Eksempel
Addition + 1 + 9
Subtraktion - 11 - 1
Division / 20 / 2
Multiplikation * 2 * 5
Negation - -10

Sammenligningsoperatorer

Sammenligningsoperatorer bruges til at sammenligne værdier og returnere true eller false.

Navn Symbol Aliaser Eksempel
Mellem {{expression}} mellem {{expression}} og {{expression}} 5 mellem 1 og 10
Lig med = 10 = 10
Ikke lig med != 1 != 10; 1 ≠ 10
Større end > 10 > 1
Større end eller lig med >= 10 >= 1; 10 ≥ 1
Mindre end < 1 < 10
Mindre end eller lig med <= 1 <= 10; 1 ≤ 10;
Contains {{string}} contains {{string}} "Hello World" contains "Hello";
"Hello World" contains text;
text contains "Hello World";
context contains text;

Logiske operatorer

Logiske operatører bruges til at kombinere flere booleske udtryk/værdier og give et enkelt boolesk output.

Navn Symbol Eksempel
Og og 1 < 10 and 10 > 1
Eller eller 1 < 10 or 10 > 1
Xor xor 1 < 10 xor 10 > 1
Ikke ikke not 1 < 10

Filtreringsoperatorer

Filtreringsoperatorer anvendes til at filtrere objekter baseret på den angivne tilstand.

Navn Symbol Eksempel
Filter {{collection}} where {{predicate}} translations where (count of votes > 0)
Match {{object}} med {{predicate}} bruger med (login = "crowdin")

Betinget (ternær) 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.

Navn Symbol Eksempel
Ternær If {{condition}} then {{expression}} else {{expression}} If 1 < 10 then "less" else "greater"

Hent-operatorer

Hent-operatører bruges til at hente data fra objekterne.

Navn Symbol Eksempel
Nævn @user:{{string}}; @language:{{string}} @user:"crowdin"; @language:"en"
Medlem {{member}} of {{object}} antal af oversættelser
Identifikator {{identifier}} text; identifier

Skalaroperatorer

Skalaroperatorer bruges til at erklære værdier til videre behandling.

Navn Symbol Eksempel
Integer {{integer}} 10
Flydende {{float}} 10.01
Streng {{string}} “crowdin"
Datotid {{datetime}} 'i dag'; '2021-03-16 00:00:00'

Gruppeoperator

Gruppeoperatorer bruges til at fastlægge operatorers eksekveringssrækkefølge.

Navn Symbol Eksempel
Gruppér ( ) 1 < 10 and (20 > 10 or 10 > 5)

Forespørgselseksempler

For at hente en liste over strenge uden ukrainske oversættelser med godkendelser eller stemmer, kan forespørgslen se således ud:

count of translations where ( language = @language:"uk" and ( count of approvals > 0 or count of votes > 0 ) ) = 0

Use your query in the following endpoint in Crowdin:

GET https://api.crowdin.com/api/v2/projects/{projectId}/strings?croql={croql}

In Crowdin Enterprise:

GET https://{organization_domain}.api.crowdin.com/api/v2/projects/{projectId}/strings?croql={croql}
Note: Before executing the request, ensure to URL encode your CroQL expression.
{projectId}

Type: integer

Beskrivelse: Numerisk identifikator for Crowdin-projektet.

{croql}

Type: string

Beskrivelse: CroQL-udtryk.

To retrieve a list of strings that have only one translation, your query might look like this:

count of translations = 1

Use your query in the following endpoint in Crowdin:

GET https://api.crowdin.com/api/v2/projects/{projectId}/strings?croql={croql}

In Crowdin Enterprise:

GET https://{organization_domain}.api.crowdin.com/api/v2/projects/{projectId}/strings?croql={croql}
Note: Before executing the request, ensure to URL encode your CroQL expression.
{projectId}

Type: integer

Beskrivelse: Numerisk identifikator for Crowdin-projektet.

{croql}

Type: string

Beskrivelse: CroQL-udtryk.

To retrieve a list of strings that have translations from only one specific user, your query might look like this:

count of translations > 0 and count of translations = count of translations where (user = @user:"crowdin")

Use your query in the following endpoint in Crowdin:

GET https://api.crowdin.com/api/v2/projects/{projectId}/strings?croql={croql}

In Crowdin Enterprise:

GET https://{organization_domain}.api.crowdin.com/api/v2/projects/{projectId}/strings?croql={croql}
Note: Before executing the request, ensure to URL encode your CroQL expression.
{projectId}

Type: integer

Description: Numeric identifier of your Crowdin project.

{croql}

Type: string

Description: CroQL expression.

To retrieve a list of strings that have at least one translation not from specific users, your query might look like this:

count of translations where (user != @user:"crowdin") > 0

Use your query in the following endpoint in Crowdin:

GET https://api.crowdin.com/api/v2/projects/{projectId}/strings?croql={croql}

In Crowdin Enterprise:

GET https://{organization_domain}.api.crowdin.com/api/v2/projects/{projectId}/strings?croql={croql}
Note: Before executing the request, ensure to URL encode your CroQL expression.
{projectId}

Type: integer

Description: Numeric identifier of your Crowdin project.

{croql}

Type: string

Description: CroQL expression.

To retrieve a list of strings that have all translations not from specific users, your query might look like this:

count of translations > 0 and count of translations = count of translations where (user != @user:"crowdin")

Use your query in the following endpoint in Crowdin:

GET https://api.crowdin.com/api/v2/projects/{projectId}/strings?croql={croql}

In Crowdin Enterprise:

GET https://{organization_domain}.api.crowdin.com/api/v2/projects/{projectId}/strings?croql={croql}
Note: Before executing the request, ensure to URL encode your CroQL expression.
{projectId}

Type: integer

Description: Numeric identifier of your Crowdin project.

{croql}

Type: string

Description: CroQL expression.

For at hente oversættelser foretaget af brugere med et crowdin-brugernavn eller med ≥ 100 upvotes, kan forespørgslen se således ud:

user = @user:"crowdin" or count of votes where ( is up ) >= 100

Use your query in the following endpoint in Crowdin:

GET https://api.crowdin.com/api/v2/projects/{projectId}/languages/uk/translations?croql={croql}

In Crowdin Enterprise:

GET https://{organization_domain}.api.crowdin.com/api/v2/projects/{projectId}/languages/uk/translations?croql={croql}
Note: Before executing the request, ensure to URL encode your CroQL expression.
{projectId}

Type: integer

Description: Numeric identifier of your Crowdin project.

{croql}

Type: string

Description: CroQL expression.

To retrieve a list of strings filtered by identifier and numeric id of a file in your Crowdin project, your query might look like this:

identifier = "key" and id of file = 777

Use your query in the following endpoint in Crowdin:

GET https://api.crowdin.com/api/v2/projects/{projectId}/strings?croql={croql}

In Crowdin Enterprise:

GET https://{organization_domain}.api.crowdin.com/api/v2/projects/{projectId}/strings?croql={croql}
Note: Before executing the request, ensure to URL encode your CroQL expression.
{projectId}

Type: integer

Description: Numeric identifier of your Crowdin project.

{croql}

Type: string

Description: CroQL expression.

To retrieve a list of strings that have unresolved issues filtered by numeric id of a file in your Crowdin project, your query might look like this:

id of file = 777 and count of comments where (has unresolved issue) > 0

Use your query in the following endpoint in Crowdin:

GET https://api.crowdin.com/api/v2/projects/{projectId}/strings?croql={croql}

In Crowdin Enterprise:

GET https://{organization_domain}.api.crowdin.com/api/v2/projects/{projectId}/strings?croql={croql}
Note: Before executing the request, ensure to URL encode your CroQL expression.
{projectId}

Type: integer

Description: Numeric identifier of your Crowdin project.

{croql}

Type: string

Description: CroQL expression.

To retrieve a list of hidden strings that are not duplicates and have one or more translations, your query might look like this:

is hidden and not is duplicate and count of translations > 0

Use your query in the following endpoint in Crowdin:

GET https://api.crowdin.com/api/v2/projects/{projectId}/strings?croql={croql}

In Crowdin Enterprise:

GET https://{organization_domain}.api.crowdin.com/api/v2/projects/{projectId}/strings?croql={croql}
Note: Before executing the request, ensure to URL encode your CroQL expression.
{projectId}

Type: integer

Description: Numeric identifier of your Crowdin project.

{croql}

Type: string

Description: CroQL expression.

To retrieve translation memory segments containing at least one record used one or more times, your query might look like this:

count of records where (usageCount > 0) > 0

Use your query in the following endpoint in Crowdin:

GET https://api.crowdin.com/api/v2/tms/{tmId}/segments?croql={croql}

In Crowdin Enterprise:

GET https://{organization_domain}.api.crowdin.com/api/v2/tms/{tmId}/segments?croql={croql}
Note: Before executing the request, ensure to URL encode your CroQL expression.
{projectId}

Type: integer

Description: Numeric identifier of your Crowdin project.

{croql}

Type: string

Description: CroQL expression.

To retrieve translation memory segments containing at least one record created by the user with a crowdin username, your query might look like this:

count of records where (createdBy = @user:"crowdin") > 0

Use your query in the following endpoint in Crowdin:

GET https://api.crowdin.com/api/v2/tms/{tmId}/segments?croql={croql}

In Crowdin Enterprise:

GET https://{organization_domain}.api.crowdin.com/api/v2/tms/{tmId}/segments?croql={croql}
Note: Before executing the request, ensure to URL encode your CroQL expression.
{projectId}

Type: integer

Description: Numeric identifier of your Crowdin project.

{croql}

Type: string

Description: CroQL expression.

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.

Kildestrengskontekst

{
  "type is plain": true,
  "type is plural": false,
  "type is icu": false,
  "type is asset": false,
  "text": "Quick Start",
  "identifier": "quick_start",
  "context": "quick_start",
  "max length": 0,
  "is visible": true,
  "is hidden": false,
  "is duplicate": false,
  "file": {
    "id": 32,
    "name": "sample.csv",
    "title": "Sample",
    "type": "csv",
    "context": "Some useful context information"
  },
  "comments": [
    {
      "has issue": false,
      "has unresolved issue": false
    }
  ],
  "screenshots": [],
  "translations": [
    {
      "text": "Швидкий старт",
      "plural form": "none",
      "is pre translated": true,
      "provider": "tm",
      "language": "uk",
      "user": 1,
      "votes": [
        {
          "is up": true,
          "is down": false,
          "user": 2,
          "added": "2021-04-09 13:44:14"
        }
      ],
      "approvals": [
        {
          "user": 2,
          "added": "2021-04-09 13:44:14"
        }
      ],
      "updated": "2021-04-09 10:23:17"
    }
  ],
  "added": "2021-04-08 12:33:27",
  "updated": "2021-04-08 12:33:27"
}
type is plain

Type: boolean

Beskrivelse: Kildestreng med almindelig tekst.

type is plural

Type: boolean

Beskrivelse: Kildestreng med flertalsformer.

type is icu

Type: boolean

Beskrivelse: Kildestreng med ICU.

type is asset

Type: boolean

Beskrivelse: Kildestreng er et aktiv.

text

Type: string

Beskrivelse: Kildestrengstekst.

identifier

Type: string

Beskrivelse: Kildestrengidentifikator (nøgle).

context

Type: string

Beskrivelse: Kildestrengskontekst.

max length

Type: integer

Description: The source string max.length.

is visible

Type: boolean

Beskrivelse: Kildestreng er synlig.

is hidden

Type: boolean

Beskrivelse: Kildestreng er skjult.

is duplicate

Type: boolean

Description: The source string is duplicate.

file

Type: object

Description: The source string file.

comments

Type: array

Beskrivelse: Kildestrengskommentarer.

has issue

Type: boolean

Beskrivelse: Kildestreng med en problematik.

has unresolved issue

Type: boolean

Beskrivelse: Kildestreng med en uløst problematik.

screenshots

Type: array

Beskrivelse: Kildestrengsskærmfotos.

translations

Type: array

Oversættelse Kildestrengsoversættelse.

text

Type: string

Beskrivelse: Oversættelsestekst.

plural form

Type: string

Beskrivelse: Oversættelse i flertalsform.

is pre translated

Type: boolean

Description: Translation added via pre-translation.

provider

Type: string

Allowed values: tm, global_tm, google, google_automl, microsoft, crowdin, deepl, modernmt, amazon, watson, custom_mt

Description: Translation provided via translation memory or machine translation engine.

language

Type: string

Description: Language identifier specified as a string. Use the language codes, for example, "uk" for Ukrainian. To specify in queries, use the format: @language:"uk".

user

Type: integer

Description: Numeric identifier of the user who added a translation.

votes

Type: array

Beskrivelse: Rækken af stemmerne tilføjet oversættelsen.

is up

Type: boolean

Beskrivelse: Upvote.

is down

Type: boolean

Beskrivelse: Downvote.

user

Type: integer

Description: Numeric identifier of the user who added a vote for translation.

added

Type: datetime

Beskrivelse: Dato for, hvornår der blev stemt på en oversættelse.

approvals

Type: array

Beskrivelse: Rækken af de tilføjede oversættelsesgodkendelser.

user

Type: integer

Description: Numeric identifier of the user who approved a translation.

added

Type: datetime

Beskrivelse: Dato for, hvornår en oversættelse blev godkendt.

updated

Type: datetime

Beskrivelse: Dato for, hvornår en oversættelse blev opdateret.

added

Type: datetime

Beskrivelse: Dato for, hvornår en kildestreng blev tilføjet.

updated

Type: datetime

Beskrivelse: Dato for, hvornår en kildestreng blev opdateret.

Translation Context

{
  "text": "Швидкий старт",
  "plural form": "none",
  "is pre translated": true,
  "provider": "tm",
  "user": 1,
  "votes": [
    {
      "is up": true,
      "is down": false,
      "user": 2,
      "added": "2021-04-09 13:44:14"
    }
  ],
  "approvals": [
    {
      "user": 2,
      "added": "2021-04-09 13:44:14"
    }
  ],
  "updated": "2021-04-09 10:23:17"
}
text

Type: boolean

Beskrivelse: Oversættelsestekst.

plural form

Type: string

Beskrivelse: Oversættelse i flertalsform.

is pre translated

Type: boolean

Description: Translation added via pre-translation.

provider

Type: string

Allowed values: tm, global_tm, google, google_automl, microsoft, crowdin, deepl, modernmt, amazon, watson, custom_mt

Description: Translation provided via translation memory or machine translation engine.

user

Type: integer

Description: Numeric identifier of the user who added a translation.

votes

Type: array

Beskrivelse: Rækken af stemmerne tilføjet oversættelsen.

is up

Type: boolean

Beskrivelse: Upvote.

is down

Type: boolean

Beskrivelse: Downvote.

user

Type: integer

Description: Numeric identifier of the user who added a vote for translation.

added

Type: datetime

Beskrivelse: Dato for, hvornår der blev stemt på en oversættelse.

approvals

Type: array

Beskrivelse: Rækken af de tilføjede oversættelsesgodkendelser.

user

Type: integer

Description: Numeric identifier of the user who approved a translation.

added

Type: datetime

Beskrivelse: Dato for, hvornår en oversættelse blev godkendt.

updated

Type: datetime

Beskrivelse: Dato for, hvornår en oversættelse blev opdateret.

Translation Memory (TM) Segment Context

{
  "records": [
    {
      "id": 1,
      "text": "Перекладений текст",
      "usageCount": 77,
      "createdBy": 1,
      "updatedBy": 1,
      "createdAt": "2027-09-16T13:48:04+00:00",
      "updatedAt": "2027-09-16T13:48:04+00:00"
    }
  ]
}
records

Type: array

Description: Array of translation memory segment records.

id

Type: integer

Description: Numeric identifier of a record.

text

Type: string

Description: Translation text of a record.

usageCount

Type: integer

Description: The number of times a translation memory record has been used.

createdBy

Type: integer

Description: Numeric identifier of the user who created a translation memory record.

updatedBy

Type: integer

Description: Numeric identifier of the user who updated a translation memory record.

createdAt

Type: datetime

Description: Date when a translation memory record was created.

updatedAt

Type: datetime

Description: Date when a translation memory record was updated.

Var denne artikel nyttig?