Setup & Configuration
Can the Repository Connector work behind a firewall?
In short, yes, but some extra work is required. First, your firewall needs to allow outbound connections both to Smartling and to your Repository. You will need to set up two rules in your Firewall configuration.
For Smartling API:
- Protocol: TCP
- Local ports: all ports
- Remote ports: 443
- Remote hosts: api.smartling.com
For your Git repository:
- Protocol: TCP
- Local ports: all ports
- Remote ports: 443
- Remote hosts: {host of your git repository}
These outbound rules will allow the connector to work with Cron scheduling but will not allow the neccessary inbound connections for accepting callbacks from Smartling or Webhooks from your repository. For these you will need to create inbound rules for Smartling callbacks:
- Protocol: TCP
- Local ports: all ports
- Remote ports: 443
- Remote hosts: 184.73.255.141
Or for your Repository:
- Protocol: TCP
- Local ports: all ports
- Remote ports: 443
- Remote hosts: {ip address used by your repository provider for webhooks}
Can the Connector work from behind a proxy?
Yes. From version 1.5.1 onward, the Connector can work with a proxy. The following arguments need to be passed to the Connector on start:
- http.proxyHost
- http.proxyPort
- http.proxyPassword
- http.proxyUsername
Your startup command should look something like this:
Javajava -Dhttp.proxyHost=localhost -Dhttp.proxyPort=3128 -Dhttp.proxyUsername=testuser -Dhttp.proxyPassword=password -jar repo-connector-1.5.1.jar -start
If you are having trouble connecting, try using curl to test your proxy connection with Smartling independently of the Repository Connector.
What size AWS ec2 instance is appropriate for deploying?
Space requirements for the Repository Connector are not high. For most use cases, a micro instance will be sufficient.
How much memory do I need to allocate?
On average, memory consumption for an instance of the Repository Connector is around 40M. We recommend having at least 64M available. You can define maximum memory allocation for the connector by starting with the -Xmx flag on startup. For example, to set the max memory to 64M: java -Xmx64M -jar repo-connector-1.4.2.jar -start
How do I control the size of my logs?
The Repository Connector uses logback. You can configure the length of history and the file size of your logs by editing the logback.xml file in the cfg directory. See the Logback documentation for full options.
Can I map one locale in Smartling to multiple locales in my repository?
No. All locale mappings are 1:1. If you have two similar locales, like es and es-ES best practice is to create both locales in Smartling and use Cross-Country Leverage to share translations.
Can I see a complete configuration example with all optional parameters?
Sure! Download this complete repo-connector.conf example file, see comments for how each optional parameter is used. Recommended for advanced users only. If you use this file as a template to fill in your own information, remember to rename the file to repo-connector.conf.
Why am I getting ‘repository not found’ or ‘cannot connect to git’ errors?
Repository Not Found errors are either caused by a network issue or by incorrect repository name/credentials. One way to check your credentials is to use the same name and credentials you use for the Repository Connector to try to clone your repository from the command line.
For example, with a username/password credential set:git clone https://<user>:<password>@github.com/Company/test-repo.git
or with a personal access token:git clone https://user:<personal access token>@github.com/Company/test-repo.git
If this action succeeds make sure that you have only one set of credentials in your repo-connector.conf. The example file comes with multiple possible credential configurations, commented out with # symbols. One of these may have been uncommented by mistake. Try deleting all credential sets except the one you are using.
If your credentials are correct it is likely that the server you host your Repository Connector on is not allowing outbound connections. You may have firewall issues.
Can I automate uploads when I make a commit to my repository?
Yes, see the Configuring Webhooks section of Repository Connector Installation and Setup.
Can I alter the configuration files while the Repository Connector is running?
You can alter the translation configuration file while the connector is running. If it is hosted in your code repository, any new commit to this file will trigger an automatic update to the Smartling dashboard. However, changes to the repo-connector.conf file require a restart.
How do I troubleshoot SSH key errors with GitHub repository?
GitHub may not accept your SSH key with the following error message
You're using an RSA key with SHA-1, which is no longer allowed. Please use a newer client or a different key type.
Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.
To resolve this, you should re-generate the key with the following command:
ssh-keygen -t ecdsa -b 256 -C"your_email@example.com"
The command will generate a key with ECDSA encryption method. Currently, repo-connector (JGit library) doesn't accept other encryption methods (including ED25519).
Content
We have different source content for each region, which are stored in different locations. Can I set up the connector to handle different source content?
Yes, for example:
/site/themes/templates/en-DE/* -> /site/themes/templates/de-DE/
/site/themes/templates/en-ES/* -> /site/themes/templates/es-ES/
Why aren't my source files being imported into Smartling?
The most common cause of this problem is an incorrect value in your smartling-config.json forresourceSets.pathRegex. You can validate your regular expression using an online tool such as RegexPlanet. Type your regular expression - make sure to remove the double-escaping required by JSON, so use only a single \ instead of \. Then provide some inputs of paths you want to match or not match and click ‘test’.
Once you have your Regular Expression working as you want inside RegexPlanet, make sure you restore the double escaping (\) needed to put your Regular Expression in a JSON file.
Why are my translated files being re-uploaded to the Dashboard as original files?
The Repository Connector cannot automatically distinguish between an original file and a translated file in the repository. The Connector uploads files based on the value of resourceSets.pathRegex in your translation configuration file. If your regular expression makes use of wildcards or your translated files are downloaded to the same folder as your original files, it may be that both original and translated files will match the regular expression.
To avoid this problem, consider altering the structure and location of the original and translated resource files in your repository, or update your regular expression to make sure it only uploads resource files in the your project’s original language to Smartling.
Can I upload/download resource files from all branches except my main (master) branch?
Sure. If you’d rather control your main branch via pull requests, you can set up the Repository Connector not to check the main branch. In the repo-connector.conf file, write your branches regular expression like this, to exclude your main branch:
"branches": "^(?!main).\\\*",
I deleted a file in Smartling that was uploaded by the Repository Connector. Now the connector is showing errors: The file {fileUril} could not be found. What do I do?
As of version 1.5.3, deleting a file in Smartling that the Repository Connector is tracking will no longer cause failure. However, it’s still a good idea to keep your smartling-config.json up to date. If you want to delete a file in Smartling that is tracked by the Connector, follow these steps:
- Stop the connector with:
Javajava -jar repo-connector-{version}.jar -stop
- Edit your smartling-config.json file. Adjust the regular expression in the appropriate resourceSets entry so it doesn’t match the file you need to delete.
- Reset the connector by deleting the following folders from its directory:
SHcfg/activemq-data
cfg/db-data
cfg/repository-data - Delete the file in the Smartling Dashboard.
- Restart the connector.
What should I do after I add new target locales to my Smartling project?
If you add locales to your project, you will need to update your translation configuration file (smartling-config.json) and add the new locales to the array. When the configuration file is uploaded, the Repository Connector will automatically update files in the Smartling dashboard based on your new settings.
Translation Delivery
Why aren't my translated files appearing in my repository?
There are a few reasons translated files might not be appearing in your repository:
- If your scheduler is set to update less frequently, it’s possible that you might just need to wait for the Repository Connector to check for new translations. You can update the scheduler in your repo-connector.conf.
- By default the Repository Connector will only download a file when all translations are published. You can choose a less restrictive setting. For example, you can download the file once there are saved translations for all strings in a file.
- For a public repository, you may not have specified credentials. This would allow you to get source files from the repository but not push translations back. Make sure you have provided commit credentials for your repository in your repo-connector.conf
Finally, you must provide a value for translationPathExpression for each resource set in your smartling-config.json, or translated files cannot be returned to your repository. See the previous answer for help tuning your Regular Expression.
Why was my file delivered back to my repo when the translations are not complete in Smartling?
By default, the repo connector will deliver the translated file when all authorized strings from the file are published for the locale. If you prefer the connector to deliver the file only when the entire file is fully translated (i.e., all strings from the file are published) please reach out to your Solutions Architect or contact Support.
What are my options for downloading translated files?
Smartling gives you a few advanced options for configuring how you get your translated files back from Smartling. To set these up, you need to add a downloadTranslations node on repository level to the repo-connector.conf file. The downloadTranslations node can contain the following parameters:
- trigger - COMPLETED or ONCHANGE - determines when to download translated files from Smartling. COMPLETED downloads files only when all translations are complete. ONCHANGE downloads translated files whenever they are updated. Default is COMPLETED.
- retrievalType - Sets type of translation for downloaded files. Allowed values are PUBLISHED (default), PENDING, and PSEUDO.
- IncludeOriginalStrings - If FALSE, Smartling returns the original string if there is no translations available. If TRUE, Smartling returns a blank string if there is no translations. Defaults to FALSE. This parameter is supported only for Gettext, java properties, custom XML, Android XML and JSON files.
- By default, the connector will deliver the translated file when all authorized strings from the file are published for the locale. If you would like the connector to only deliver the translated file when the entire file is fully translated (i.e., all strings from the file are published) please reach out to your Solution Architect or contact Support.
Can I configure callbacks for completed translations instead of using the cron checker?
Yes, see the Configuring Webhooks section of Repository Connector Installation and Setup.
SSL Issues
What do I do if the Repo Connector cannot start because of the following SSL error: WARN Repository RepositoryKey[type=GIT,protocol=HTTP,host=git.ent.mycompany.com,path=ios-app.git,branch=<null>] isn't working, error: javax.net.ssl.SSLException: hostname in certificate didn't match: <api.smartling.com> != <*.portal.bazaarvoice.com> OR <*.portal.bazaarvoice.com> OR <portal.bazaarvoice.com>
Answer
The above error means that the Repo Connector tried to establish secure connection to api.smartling.com and could not validate received SSL certificate. Below troubleshooting steps which can help to find root cause
Validate IP address
View IP address of api.smartling.com
$ ping api.smartling.com PING sl-apigateway.elasticbeanstalk.com (52.4.240.163) 56(84) bytes of data.
Get information for api.smartling.com host from DNS
$ dig api.smartling.com ; <<>> DiG 9.8.2rc1-RedHat-9.8.2-0.37.rc1.45.amzn1 <<>> api.smartling.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 5377 ;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 4, ADDITIONAL: 4 ;; QUESTION SECTION: ;api.smartling.com. IN A ;; ANSWER SECTION: api.smartling.com. 46 IN CNAME sl-apigateway.elasticbeanstalk.com. sl-apigateway.elasticbeanstalk.com. 46 IN A 54.86.167.99 sl-apigateway.elasticbeanstalk.com. 46 IN A 52.203.135.116
You can notice that IP address from the 1st step (52.4.240.163) is different from the 2nd step. There is an issue, the Repo Connector sends a request to the wrong address, gets the wrong SSL certificate and fails on validation.
Solution:
- Reset DNS cash
- Check if you use proxy and it has specific configuration
Validate certificate
Request SSL certificate and you must see something like below
$ openssl s_client -showcerts -connect api.smartling.com:443 | grep smartling depth=3 C = US, O = "The Go Daddy Group, Inc.", OU = Go Daddy Class 2 Certification Authority verify return:1 depth=2 C = US, ST = Arizona, L = Scottsdale, O = "GoDaddy.com, Inc.", CN = Go Daddy Root Certificate Authority - G2 verify return:1 depth=1 C = US, ST = Arizona, L = Scottsdale, O = "GoDaddy.com, Inc.", OU = http://certs.godaddy.com/repository/, CN = Go Daddy Secure Certificate Authority - G2 verify return:1 depth=0 OU = Domain Control Validated, CN = *.smartling.com verify return:1 0 s:/OU=Domain Control Validated/CN=*.smartling.com subject=/OU=Domain Control Validated/CN=*.smartling.com
Install certificate
It's not recommended workaround, better to update root CA certificates.
- Download certificate
openssl s_client -servername api.smartling.com -connect api.smartling.com:443 </dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/smartling.crt
- Install certificate
keytool -keystore keystore -importcert -alias smartling -file /tmp/smartling.crt
What do I do if the Repo Connector cannot start because of the following SSL error: org.eclipse.jgit.api.errors.TransportException: https://xxxxx.git: cannot open git-upload-pack
...
Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.ssl.Alerts.getSSLException(Unknown Source) ~[na:1.8.0_91]
Answer
The problem you are facing is connected with https SSL certificate. The Repo Connector is a Java application.
Java does not recognize the root certificate authority, so you must import the required certificate.
Certificates usually located in '%java_folder%/lib/security/cacerts'
for example: ./jdk1.6.0_24/jre/lib/security/cacerts
The path may depend on java version you are using.
- First, you can make a copy of the file with certificates
cp /jdk1.6.0_24/jre/lib/security/cacerts /jdk1.6.0_24/jre/lib/security/cacerts.original
- (optional step). You may make sure that file with certificates does not contain the required certificate by running command and exploring result file:
keytool -list -v -keystore /path/to/cacerts > java_cacerts.txt
Enter keystore password: changeit
- You should get the file with certificate (option: Export certificate from browser)
Let's call it example.der - Import the file:
keytool -import -alias example -keystore /path/to/cacerts -file example.der
You will be prompted for a password, use 'changeit' and respond "yes" on whether to trust this key.
- (optional step). You may make sure that file with certificates contain the required certificate by running command from step 2.
- Now you can run the Repo Connector, and the issue should be gone.