Custom Bundle Generator FreeBeta

ByAwesome CrowdinVerified Author

The app allows you to generate a resource files out of translate Crowdin strings.

Install

About

Copy link

This app allows you to create your own simple bundle generator using JavaScript.

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 application will expose the following variables in the global environment:

  • strings - an array of objects containing all strings that Crowdin has identified as translatable. Please refer to the Developer Portal to learn more about the data structures.
  • projectId - the Crowdin project ID;
  • languageId' - target language Crowdin ID;
  • error - the error message to return. If set, the import will be aborted and the error message will be shown to the user;
  • code - this variable should contain the content (string) of the file to be exported after your code is executed;

Example application

Copy link
const result = strings.map(s => {
    return {
        id: s.identifier,
        text: s.translations[languageId].text
    }
})

content = JSON.stringify(result);

This code exports strings as JSON, an array of objects with two properties, id' and text'.

Screenshot

Copy link

Screenshot

Categories
Development
File Formats
Works with
  • Crowdin Enterprise
  • crowdin.com
Details

Released on Sep 23, 2023

Updated on Sep 26, 2023

Published by Awesome Crowdin

Identifier:custom-bundle-generator