Translation Alignment Processing Module
The Translation Alignment Processing module allows you to override Crowdin’s default alignment mechanism when uploading translations for non-key-value files (e.g., HTML, MD).
By default, Crowdin automatically aligns uploaded translations with existing source strings. When you use this module in your Crowdin app, you can intercept this process and apply your own custom alignment logic, for example, by using a third-party alignment service. This gives you full control over how translations are mapped to their corresponding source strings for complex document formats.
You can grant access to this module to one of the following user categories:
For Crowdin:
- Only me (i.e., project owner)
- Me, project managers and developers
- Selected users
For Crowdin Enterprise:
- Only organization admins
- Organization admins, project managers and developers
- Selected users
{ "modules": { "file-translations-alignment": [ { "key": "your-translations-alignment-module-key", "url": "/translations-alignment", "signaturePatterns": { "fileName": "^.+\\.html$", "fileContent": "<html.*>" } } ] }}key | Type: Required: yes Description: Module identifier within the Crowdin app. |
url | Type: Required: yes Description: The relative URL triggered on translation upload. |
signaturePatterns | Type: Description: Contains |
Communication between Translation Alignment App and Crowdin
Section titled “Communication between Translation Alignment App and Crowdin”When uploading a translation file for a non-key-value format, the system detects an appropriate translation alignment module using the signaturePatterns parameter. Crowdin then makes an HTTP request to the app’s URL ($baseUrl . $url).
This request contains two main arrays: sourceStrings (from the project) and translationStrings (parsed from the uploaded translation file). The app’s job is to process these two sets of strings, perform the alignment, and return a structured response that maps the translations to their correct source string identifiers.
Request payload example:
// max request payload - 5 MB// wait timeout - 2 minutes{ "jobType": "translation-alignment-file", "organization": { "id": 1, "domain": "{domain}", "baseUrl": "https://{domain}.crowdin.com", "apiBaseUrl": "https://{domain}.api.crowdin.com" }, "project": { "id": 1, "identifier": "your-project-identifier", "name": "Your Project Name", "userId": 1, "sourceLanguageId": "en", "targetLanguageIds": [ "ja", "uk", "et" ], "createdAt": "2030-01-15T07:00:00+00:00", "updatedAt": "2030-01-15T07:00:15+00:00", "lastActivity": "2030-01-15T10:12:13+00:00", "description": null, "url": "/project/your-project-identifier", "cname": null }, "sourceLanguage": { "id": "en", "name": "English", "editorCode": "en", "twoLettersCode": "en", "threeLettersCode": "eng", "locale": "en-US", "androidCode": "en-rUS", "osxCode": "en.lproj", "osxLocale": "en", "pluralCategoryNames": [ "one", "other" ], "pluralRules": "(n != 1)", "pluralExamples": [ "1", "0, 2-999; 1.2, 2.07..." ], "textDirection": "ltr", "dialectOf": null }, "targetLanguages": [ { // Language object for the translation being aligned. Has the same structure as sourceLanguage. } ], "file": { "id": 4219, "name": "en.html", "title": null, "path": "/en.html", "type": "html32", "isMultilingual": false, "status": "active", "revision": 1, "branchId": null, "directoryId": 0 }, "sourceStrings": [ { "id": 1234567, "text": "Welcome!", "context": "Document Title\\r\\nXPath: \\/html\\/head\\/title" } // other source strings ... ], "translationStrings": [ { "id": null, "text": "Ласкаво просимо!", "context": "Document Title\\r\\nXPath: \\/html\\/head\\/title" } // other translation strings ... ]}Properties:
jobType | Type: Value: Description: Specifies the action of the translation alignment module. |
file | Type: Description: Contains information about the source file in Crowdin to which the translations are being uploaded. |
targetLanguages | Type: Description: An array containing the language object of the translation file being uploaded and aligned. |
sourceStrings, sourceStringsUrl | Type(sourceStrings): Type(sourceStringsUrl): Description: Parameters used for source strings from the original file. |
translationStrings, translationStringsUrl | Type(translationStrings): Type(translationStringsUrl): Description: Parameters used for strings parsed from the uploaded translation file.
|
The app must perform its custom alignment and return a response containing a translations array. This array maps each translation text to its corresponding sourceStringId.
Response payload example:
// max response payload - 5 MB// wait timeout - 2 minutes{ "data": { "translations": [ { "sourceStringId": 1234567, "text": "Ласкаво просимо!" }, // other translation mappings... ], // or use translationsUrl for large payloads "translationsUrl": "https://app.example.com/jKe8ujs7a-aligned.ndjson" // new-line delimited json file with aligned translations }, "error": { "message": "Optional error message" }}Properties:
data.translations, data.translationsUrl | Type(data.translations): Type(data.translationsUrl): Description: Parameters used to pass the aligned translations.
|
data.translations.sourceStringId | Type: Description: The numeric identifier of the source string to which the translation should be applied. |
data.translations.text | Type: Description: The translation text to be applied. For plural strings, this must be an object
keyed by the target language’s plural category names (e.g., |
error.message | Type: Description: An error message that can be passed from the app to Crowdin and will be visible to a user in the UI. |