Socket
Socket
Sign inDemoInstall

@talend/i18n-scripts

Package Overview
Dependencies
100
Maintainers
2
Versions
68
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @talend/i18n-scripts

Set of scripts to ease i18n workflow


Version published
Weekly downloads
14
increased by40%
Maintainers
2
Created
Weekly downloads
 

Readme

Source

Talend i18n scripts

The i18n process has multiple steps

1- Extract and upload

2- Translation within the cloud system

3- Download and versionning to github

4- Download translated files to the bundle

The @talend/i18n-scripts module targets steps 1 - 2 - 3.

Installation

yarn global install @talend/i18n-scripts

or

npm install -g @talend/i18n-scripts

Now the cli talend-i18n is available.

Actions

There are 4 actions you can perform

talend-i18n extract
talend-i18n upload
talend-i18n download
talend-i18n deploy

Configuration

The scripts are based on a talend-i18n.json configuration file at project root.

Extract

This step will extract the i18n files from the project and create a zip.

All the files will be wrapped in a folder with your app extracted version. The version (major.minor) is taken from files at project root.

  • lerna.json
  • pom.xml
  • package.json

There are 4 methods of extraction

  • npm : run an npm script
  • yarn : same as npm but with yarn
  • files : get the files from a list of path
  • expression : get the files matching an expression, starting with a provided folder

Npm/Yarn

{
  "extract": {
    "method": "npm",
    "script": "extract-i18n",
    "target": "./i18n",
    "transform": "flatten"
  }
}
ConfigurationDescription
methodnpm or yarn
scriptThe npm script name
targetThe folder where the npm script will gather the translation files. This is used to create the zip file.
transformOptional. Transformation to apply to file hierarchy. For now only flatten is accepted, putting all file directly under the target language folder.

Files

{
  "extract": {
    "method": "files",
    "files": ["./src/i18n/translation.json", "./src/app/other.json"],
    "target": "./i18n"
  }
}
ConfigurationDescription
methodnpm or yarn
filesThe list of files to extract.
targetThe folder where the script will gather the translation files. This is used to create the zip file. Note that the files folder hierarchy is preserved.

Expression

{
  "extract": {
    "method": "expression",
    "rootPath": "./src",
    "expression": "message*.json",
    "target": "./i18n"
  }
}
ConfigurationDescription
methodexpression
rootPathThe folder to start the search.

Note that mvnModules is a special value, that will get the folders from pom.xml modules definition.
expressionExpression describing the files name.

It accepts glob format, you can use * as wildcard. message*.json means every files that start with message and end with .json (ex: message-errors.json, message.json, ...), whereas message.json matches only the message.json files.
targetThe folder where the script will gather the translation files. This is used to create the zip file. Note that the files folder hierarchy is preserved.

Upload/Download

You need to pass xtm information as environment variables

> XTM_API_URL=https://XXX \
  XTM_CUSTOMER_ID=YYY \
  XTM_TOKEN=ZZZ \
  talend-i18n <upload|download>
VariableDescription
XTM_API_URLThe XTM api url
XTM_CUSTOMER_IDThe XTM customer ID
XTM_TOKENThe XTM authentication token

Upload

This step will upload previously created i18n zip to XTM.

{
  "load": {
    "project": "UI"
  }
}
ConfigurationDescription
projectThe XTM project name.

Download

This step will download, unzip and transform files from XTM.

{
  "load": {
    "project": "UI"
  }
}
ConfigurationDescription
projectThe XTM project name.

It will download only the files corresponding to the current version of your project (version extracted). If no version is detected, all versions will be downloaded.

Deploy

This step will push downloaded i18n files to github. Files will be generated to create a npm or maven module. For now, no module is deployed on npm/mvn repositories.

You need to pass github credentials as environment variables.

> GITHUB_LOGIN=XXX \
  GITHUB_TOKEN=YYY \
  talend-i18n deploy
VariableDescription
GITHUB_LOGINGithub username that will be used to push to the locales repo
GITHUB_TOKENGithub token

talend-i18n.json configuration

{
  "github": {
    "url": "https://github.com/Talend/locales.git"
  },
  "module": {
    "type": "mvn",
    "private": true,
    "repository": {
        "id": "private-releases",
        "url": "https://mydomain.com/nexus/content/repositories/MyPrivateSourceRelease"
    }
  }
}
ConfigurationTypeDescription
github.urlstringThe https git url.
module.typestringThe module type to deploy (npm
module.privatebooleanIf the module should be private.
module.repositoryobjectThis will be set in pom.xml for mvn modules. It should reflect the repository this module should be released.
module.repository.idstringThe repository id.
module.repository.urlstringThe repository url.

The i18n files will be pushed to a branch {XTM_project}/{version}.

With this branch structure, the locales for your project can be downloaded from a defined url.

https://github.com/{github_org}/{repo_name}/archive/{XTM_project}/{version}.zip

In the example :

https://github.com/Talend/locales/archive/UI/1.10.zip

FAQs

Last updated on 22 Mar 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc