API: Get approved string translations by identifier

Hi there,
I’m using the .NET library to access the Crowdin API.
In my scenario I need to fetch the current approved translation of a specific string. I would like to not store the Crowdin id of the string, as we already have the identifier.

My current approach:

  • API Call: List Strings, use filter to get the Crowdin ID for the string identifier
  • For each language
    • API Call: List Translation Approvals: With language code and ID from previous request
    • API Call: List String Translations: Get actual translated string with translation id from previous request.

This is quite a lot of calls, for a rather simple scenario. I need one request to get the id and then for each language two request just to get the translation.

In an ideal world, I would like to make one API request which will return the source text and all approved translations, by using the identifier, which I used to create the source text.
Is there any possibility to do this (maybe by using CroQL?) or any other way to simplify this process?

Thanks!

2 Likes

Hi Jonatan!

CroQL will help here for sure, but still it is needed for each language separately (one request per language)

We have this app here if you’d like to check Discover the right solution to enhance Crowdin experience
You may try with count of approvals > 0

1 Like

Hi Ira,
thank you, getting translations for each language separately seems to be okay.

However, I struggle with getting the translated text with CroQL.

This is my current approach with the List Strings endpoint:

identifier = "d79e005c-dd10-4ef8-a670-ce1d1238edad" and count of  translations where ( language = @language:"de" and count of approvals > 0 ) = 1

This works, as in I get the correct source string, but not the actual translation. Any idea how to include it?

1 Like

Jonatan,

Seems like you use List Strings. Could you please try List Language Translations?

1 Like

It doesn’t seem to be possible with the Language Translations endpoint to gather the translation by using the identifer.

identifier = "d79e005c-dd10-4ef8-a670-ce1d1238edad"

Results in

"message": "Invalid logic in CroQL. Identifier 'identifier' is undefined"
1 Like

Hello Jonatan,

At this moment, in CroQL context, for List Language Translations, there’s no information about the string and it can’t be used together with stringIds

The context can be expanded. We have some plans about improvements of CroQL and GraphQL, but they’re very long-term oriented

1 Like