Custom Pre-Import Processor FreeBeta

ByAwesome CrowdinVerified Author

This application allows you to run custom code against any source file you upload.

Install

About

Copy link

This application allows you to process any file you upload with your own JavaScript code. It can be useful if you want to edit the file content before it's imported by Crowdin.

Coding

Copy link

JavaScript code is executed in a sandboxed environment with no access to I/O (file system, network) or external NPM modules.

This app will expose the following variables in the global environment:

  • content - is the content of the uploaded file;
  • fileName - the name of the uploaded file;
  • projectId - Crowdin project ID;
  • type - the ID of the Crowdin file importer that should handle the file;
  • error - the error message you want to return. If set, the import will be aborted and the error message will be shown to the user;

You can edit content and fileName to make the changes you need. Additionally, you can set the specific Crowdin file importer to handle the file import by changing the value of the type variable.

Example application

Copy link
content = content.replace("Test", "Check");
type = "html";
Categories
Development
File Formats
Tags
import
Works with
  • Crowdin Enterprise
  • crowdin.com
Details

Released on Sep 23, 2023

Updated on Sep 26, 2023

Published by Awesome Crowdin

Identifier:custom-pre-import-processor