Please note that this Connector is a paid product. For pricing information, please reach out to your Smartling Customer Success Manager.
Download the Repository Connector package and unpack it into the desired folder.
Prerequisites
Installation must be done by a user who is familiar with command line, JSON, RegEx, and git.
Adhere to all required parameters.
The application should be hosted on a server that is continuously available.
Java version 11 installed.
Enough space to clone your Git repositories, as well as 50 MB for the installation of the Repository Connector.
If GitHub or Smartling webhooks are to be used, the server needs to be publicly addressable.
Connect to Your Repository and Smartling
Configuration information for the Repository Connector is kept in two separate files. The first, repo-connector.conf, is part of the Repository Connector package and defines how the Repository Connector communicates with your repositories and with Smartling.
A second configuration file is placed in the repository, covering which files are uploaded to Smartling and the location of translated files in your repository. repo-connector.conf should be completed first.
Repo-connector uses HOCON format for configuration. By default, the repo-connector.conf file is located in [repository connector directory]/cfg and defines the necessary parameters for the Repository Connector to access your repositories and listen for callbacks.
At a minimum, you must define a URL, access credentials, and a related Smartling Project for each of your repositories. Edits to repo-connector.conf must be valid JSON.
Environment Variables
The repo-connector.conf file also supports the use of environment variables. You can use them as a value to any of the file's parameters by adding them in the format, for example;
Add env variables into repo-connector.conf:
{ "repositories": [ { "url": ${REPOSITORY_URL} "alias": "i18n", "alias": ${?REPOSITORY_ALIAS}, ...Define env variables and run repo-connector
$ export REPOSITORY_URL=http://test $ export REPOSITORY_ALIAS=my_i18n $ java -jar repo-connector-2.1.1.jar -start 2021-12-29 14:19:49,806 INFO [-] Repo connector version is 2.1.1 2021-12-29 14:19:49,812 INFO [-] Configuration is cfg 2021-12-29 14:19:52,884 INFO [-] Repository factory configuration are reading... 2021-12-29 14:19:52,886 INFO [-] Repository factory configuration are read successfully. There are 6 specific connectors 2021-12-29 14:19:52,893 INFO [-] Repository configurations are reading... 2021-12-29 14:19:52,931 INFO [-] Repository RepositoryKey[type=GIT,protocol=HTTP,host=test,path=,branch=<null>] are added, alias my_i18n, project 8999a0e9c, auth type USER_PASSWORD 2021-12-29 14:19:52,940 INFO [-] Repository configurations are read successfully. There are 1 repositories ...
Required Parameters
The package contains an annotated version of repo-connector.conf to help you set up the connector. The basic required parameters are as follows;
Repositories: Defines an array of source repositories. A repository cannot have more than one authentication attribute, and a public repository may have neither. Without authentication information, the connector will be able to get files from the repository but not download translated files from Smartling. Repositories have the following attributes:
url: The URL for the repository. Must be unique in the array.
alias: Alias for the repository. The alias is used in creating the file URI that is registered with Smartling for uploaded files. A unique alias value is recommended, but not required. The complete URI will be “alias/branch/file”, eg app1/translation/en_US.json
type: Repository type. Possible values are GIT and SVN.
smartlingProject: Defines your Smartling project credentials. You can find these in the Smartling Dashboard on the account-level API page. Note: This section was changed in version 1.5.0 and is not backwards compatible with previous versions.
projectId: Unique id for your project.
userIdentifier: The User Identifier for your Smartling v2 API Token.
tokenSecret: The token secret for your Smartling v2 API Token.
resourcesConfig: The path to the repository configuration file, if hosted in your code repository. Default is ‘smartling-config.json’
serverResourcesConfig: If you would prefer not to commit the repository configuration file to your code repository, you can host it on the Connector server. In this case, use serverResourcesConfig to define a path to the config file. You can define the absolute path or the relative path from the repo-connector.conf folder.
namespace: TRUE or FALSE (default). If TRUE, strings are unique to each file. See the namespace documentation for more details. If FALSE, strings are shared between all files. Repeated strings are translated only once in Smartling. If your file names contain version information, this setting will avoid having to retranslate entire files when you upload a new version. Warning: This property should not be edited after you start uploading content to Smartling.
branches: Regular expression for branch names to be checked for resources. If this is undefined, all branch names will be checked. (See JSON example below. The configuration will only monitor changes in branches that contain these words:
dev, develop, dev_active-booking, main, etc.)"branches": "(dev|main)"
Remember that \ is an escape character both for JSON and RegEx, so you need to double-escape special characters for your Regular Expressions to work.
cloneSingleBranch: (Optional) When set to
true, only the specified branch is cloned instead of all branches. This option reduces disk usage for repositories with many branches. The default value isfalse(all branches are cloned for backward compatibility).pollingSchedule: Cron expression defining how often the Repository Connector polls your repository for updates. We strongly recommend using this method to upload new translatable files and download translations. However, if you need new files to be uploaded with minimum latency, you can set up a webhook.
One of the following options should be used to define the authentication method and credentials the connector should use when connecting to the repository:
userPassword for username/password-based authentication. The username and password must be included in the configuration file or referenced via environment variables.
personalToken for personal access token-based authentication. The token must be included in the configuration file or referenced via an environment variable.
sshKey for SSH key-based authentication. The path to the key file and, if the key has one, the passphrase must be included in the configuration file or referenced via environment variables. For the supported key types and formats, see Supported SSH keys. If you connect to GitHub Enterprise Cloud with data residency, see GitHub Enterprise Cloud with data residency (GHE.com).
oauthToken for OAuth 2-based authentication. The client ID and client secret must be included in the configuration file or referenced via environment variables. In addition, for this authentication method, the connector needs to be able to open a browser window.
Scheduler. Defines a polling schedule for when the connector should check Smartling for completed translations.
Supported SSH keys
Repository Connector 2.1.1 and later supports the following SSH key types:
Ed25519 (recommended)
ECDSA
RSA
Keys can be in OpenSSH format (the file starts with -----BEGIN OPENSSH PRIVATE KEY-----) or PEM format, with or without a passphrase. To generate a recommended key, run ssh-keygen -t ed25519.
If you use RSA, GitHub requires new RSA keys to be 3072 bits or longer.
Earlier connector versions: Versions 2.1.0 and older accept only PEM-format RSA, DSA, and ECDSA keys, and sign RSA keys with SHA-1 only.
Important: GitHub stops accepting SHA-1 RSA signatures on January 13, 2027. If you use an RSA key to connect to GitHub over SSH, upgrade to Repository Connector 2.1.1 before that date. For upgrade steps, see How to upgrade the Repo Connector to a newer version.
GitHub Enterprise Cloud with data residency (GHE.com)
For repositories hosted on GitHub Enterprise Cloud with data residency (<subdomain>.ghe.com), the SSH user is your enterprise subdomain, not git. Set user to your subdomain in the sshKey block and use the subdomain as the user in the repository URL.
For example, for example-corp.ghe.com, set "user": "example-corp" and use this repository URL:
[email protected]:<owner>/<repo>.git
For more details, see GitHub's Network details for GHE.com.
Start the Repository Connector Application
To start the Repository Connector, execute:
java -jar repo-connector-2.1.1.jar -start
To stop the Repository Connector, execute:
java -jar repo-connector-2.1.1.jar -stop
If you have saved your configuration files in a folder other than the default (/cfg) add the parameter -configuration <folder_name> to the command.
To run as a daemon, execute:
java -jar repo-connector-2.1.1.jar -start&
Sending Content to Smartling
As part of configuring your repo connector, you will have defined a cron polling schedule that will check the repository for changes on a recurring basis and send any content changes to Smartling on the recurring basis defined. This is the simplest way to deal with sending new translations to Smartling and downloading translated files.
However, if it is vital to have new commits to your repository uploaded to Smartling with no latency, you can configure a webhook in your GitHub or Beanstalk repository. This will require additional technical resources and additional configuration to your Connector, outside Smartling.
Configuring Webhooks
Before you can get your webhooks working, you need to configure callbacks on your http listener settings in your repo-connector.conf file. It should look like this:
HTTP
"http": {
"host": "localhost",
"port": "5555",
"protocol": "http",
"callbackUrl": "http://callback.mydomain.com"
}
Parameters:
host: The host name, set by default to localhost. Public server may require value to be set to 0.0.0.0
port: The local port for the http listener. Any free port can be assigned.
protocol: Can be set to http or https depending on the requirements of your server.
callbackURL: URL for your instance of the Repository Connector. This is the URL that Smartling will send a callback to on completion of translation for a file.
Webhooks require your Connector to be publicly addressable. If you have set up the Connector behind a firewall, you may have difficulty getting your webhooks to work.
Currently, we support only GitHub and Beanstalk webhooks.
To configure a GitHub webhook, go to Settings > Webhooks for your repository and add a webhook. Required details are:
Payload URL: Your publicly addressable URL for the connector. Takes the form
https://{host}:{port}/github?resourcesConfig={path to config file}. Default resourcesConfig value is smartling-config.json. Your port value should match the one set in the http object in your repo-connector.conf file.Content type: Set to ‘application/json’.
Secret: Your Smartling API token secret.
Which events would you like to trigger this webhook?: Set ‘just the push event’.
For a Beanstalk repository, under Settings > Integration create a new webhook and set:
Name: Choose a name for the webhook.
URL: Your publicly addressable URL for the connector. Takes the form
HTTP
http{/s}://{host}:{port}/beanstalkapp?userIdentifier={userIdentifier}&resourcesConfig={path to config file}.
Default resourcesConfig value is smartling-config.json. userIdentifier is your Smartling API v2 user identifier. Your port value should match the one set in the http object in your repo-connector.conf file.
You do not need to make any changes to your repo-connector.conf file. If your webhook is set up correctly, any new push to the repository will trigger the connector to look for any changes to translatable files (or new files) to upload to Smartling.
Even if you set up callbacks, you must still provide a valid cron expression in the scheduler section of your repo-connector.conf.
Troubleshooting
Connecting to old SSH servers
By default, the connector uses only modern SSH algorithms. If your SSH server supports only old algorithms (for example, SHA-1, CBC ciphers, or DSA keys, as in OpenSSH versions older than 7.2), the connection fails with Algorithm negotiation fail. The error also names the algorithm type that failed: kex, server_host_key, cipher, or mac.
If you cannot upgrade the SSH server, you can allow old algorithms using one of the following methods.
Warning: These settings enable algorithms that are considered weak. Upgrade the SSH server instead whenever possible.
Option 1: JVM options
Start the connector with the JVM options below. If you run the connector in Docker, set them in the CUSTOM_JAVA_OPTS environment variable.
Each option replaces the default list, so it must list every algorithm you want to allow. The following profile adds all old algorithms to the modern defaults:
-Djsch.kex=mlkem768x25519-sha256,curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1 -Djsch.server_host_key=ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss -Djsch.client_pubkey=ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss [email protected],[email protected],aes128-ctr,aes192-ctr,aes256-ctr,aes128-cbc,aes192-cbc,aes256-cbc,3des-ctr,3des-cbc,blowfish-cbc [email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512,hmac-sha1,hmac-sha1-96,hmac-md5,hmac-md5-96
Option 2: Per-host settings in ~/.ssh/config
Alternatively, add per-host settings to the ~/.ssh/config file of the user who runs the connector, using KexAlgorithms, HostKeyAlgorithms, PubkeyAcceptedAlgorithms, Ciphers, and MACs. As with the JVM options, each setting needs the full list of allowed algorithms. The OpenSSH + and - prefixes are not supported.
Incorrect passphrase
If the passphrase in the sshKey block does not match the key, the connection fails immediately with Incorrect passphrase provided. Check the passphrase and try again.
Configure Your Translation Settings
Now that the Repository Connector is up and running, it’s time to set up how you will translate your project.
