### SDK Setup and Initialization Source: https://help.smartling.com/hc/en-us/articles/4405992477979 Instructions on installing the SDK and initializing API clients. ```APIDOC ## SDK Installation To install the SDK, run the following command: ```bash npm install smartling-api-sdk-nodejs ``` ## SDK Initialization Import the necessary components and initialize the API client builder: ```javascript const { Logger, SmartlingApiClientBuilder, SmartlingJobsApi, SmartlingJobBatchesApi, SmartlingFilesApi } = require("smartling-api-sdk-nodejs"); const userId = "YOUR_USER_ID"; const userSecret = "YOUR_USER_SECRET"; const apiBuilder = new SmartlingApiClientBuilder() .setLogger(console) .setBaseSmartlingApiUrl("https://api.smartling.com") .authWithUserIdAndUserSecret(userId, userSecret); const jobsApi = apiBuilder.build(SmartlingJobsApi); const batchesApi = apiBuilder.build(SmartlingJobBatchesApi); const filesApi = apiBuilder.build(SmartlingFilesApi); ``` ``` -------------------------------- ### Example GET Callback Request URL Source: https://help.smartling.com/hc/en-us/articles/1260805504109-Smartling-Callbacks This is an example of a GET request URL used with a Files API callback. Note that the Smartling project ID is not included by default. ```url https://webhook.site/1e2d7a5d-94d5-4919-847e-b7bea01693bd?locale=fr-FR&publishStatus=published&fileUri=strings-1-5.txt&ts=1620744030201 ``` -------------------------------- ### Starting Repo Connector Instances Source: https://help.smartling.com/hc/en-us/articles/1260801649930-Customize-The-Repo-Connector-Configuration Command to start multiple Repo Connector instances with different configurations. Each instance requires a unique configuration folder path. ```bash java -jar repo-connector-1.5.0.jar -configuration ./cfg-en-DE -start ``` ```bash java -jar repo-connector-1.5.0.jar -configuration ./cfg-en-JP -start ``` ```bash java -jar repo-connector-1.5.0.jar -configuration ./cfg-en-NL -start ``` -------------------------------- ### Job Cancelled Callback (GET) Source: https://help.smartling.com/hc/en-us/articles/1260805504109-Smartling-Callbacks Example of a GET request query string for the 'Job cancelled' callback event. This event is invoked when a job is cancelled. ```http ?type=job.cancelled&translationJobUid=vacryeniyvlk ``` -------------------------------- ### Start Repository Connector with Custom Configuration Source: https://help.smartling.com/hc/en-us/articles/360008039014-Repository-Connector-Installation-and-Setup If your configuration files are not in the default '/cfg' directory, use this command to specify the configuration folder. ```bash java -jar repo-connector-1.5.5.jar -configuration -start ``` -------------------------------- ### Job Completed Callback (GET) Source: https://help.smartling.com/hc/en-us/articles/1260805504109-Smartling-Callbacks Example of a GET request URL for the 'Job completed' callback event. This event is triggered when all content in a job reaches the Published workflow step. ```http https://callback.handler.com?type=job.completed&translationJobUid=xm5rj2kmxtaj&ts=1644920029445 ``` -------------------------------- ### Start Repository Connector Source: https://help.smartling.com/hc/en-us/articles/360008039014 Execute this command to start the Repository Connector application. Use the -configuration parameter to specify a custom configuration folder. ```bash java -jar repo-connector-1.5.5.jar -start ``` ```bash java -jar repo-connector-1.5.5.jar -start -configuration ``` -------------------------------- ### Start the new Repository Connector version Source: https://help.smartling.com/hc/en-us/articles/22934648091035-How-to-upgrade-the-Repo-Connector-to-a-newer-version Execute this command to start the upgraded Repository Connector. Replace config files with your backed-up versions before starting. If your configuration files are in a non-default location, use the -configuration parameter. ```bash java -jar repo-connector-1.7.11.jar -start ``` ```bash java -jar repo-connector-1.7.11.jar -start -configuration ``` -------------------------------- ### File Prepublished Callback (GET) Source: https://help.smartling.com/hc/en-us/articles/1260805504109-Smartling-Callbacks Example of a GET request query string for the 'File prepublished' callback event. This event is invoked when content reaches the Published or prepublished step. ```http ?locale=ru-RU&publishStatus=prepublished&fileUri=example.properties&ts=1542138300048 ``` -------------------------------- ### File Published Callback (GET) Source: https://help.smartling.com/hc/en-us/articles/1260805504109-Smartling-Callbacks Example of a GET request query string for the 'File published' callback event. This event is invoked when content reaches the Published workflow step. ```http ?locale=ru-RU&publishStatus=published&fileUri=example.properties&ts=1542138000086 ``` -------------------------------- ### Basic iOS String Catalog Example Source: https://help.smartling.com/hc/en-us/articles/31159241673627-iOS-String-Catalog This example demonstrates a basic String Catalog file structure with translations for 'Hello world' and 'How are you doing?' in Ukrainian and French. ```json { "sourceLanguage" : "en", "strings" : { "Hello world" : { "localizations" : { "uk-UA" : { "stringUnit" : { "state" : "translated", "value" : "Привіт світ" } }, "fr-FR" : { "stringUnit" : { "state" : "translated", "value" : "Bonjour le monde" } } } }, "How are you doing?" : { "localizations" : { "uk-UA" : { "stringUnit" : { "state" : "translated", "value" : "Як справи?" } }, "fr-FR" : { "stringUnit" : { "state" : "translated", "value" : "Comment allez-vous?" } } } } } } ``` -------------------------------- ### Install Node.js SDK Source: https://help.smartling.com/hc/en-us/articles/4405992477979-Node-js-SDK Install the Smartling SDK for Node.js using npm. ```bash npm install smartling-api-sdk-nodejs ``` -------------------------------- ### Get Jobs Example Source: https://help.smartling.com/hc/en-us/articles/4412947322267 Retrieve a list of jobs, sorted by name in ascending order, with pagination. ```APIDOC ```python from smartlingApiSdk.Credentials import Credentials from smartlingApiSdk.api.JobsApi import JobsApi # Credentials expects the following environment variables to be defined: # SL_USER_IDENTIFIER, SL_USER_SECRET, SL_PROJECT_ID creds = Credentials() jobs_api = JobsApi(creds.MY_USER_IDENTIFIER, creds.MY_USER_SECRET, creds.MY_PROJECT_ID) resp, status = jobs_api.getJobsByProject(sortBy='jobName', sortDirection='ASC', offset=0, limit=50) for item in resp.data.items: print(item['jobName']) ``` ``` -------------------------------- ### Gettext String Instructions Example Source: https://help.smartling.com/hc/en-us/articles/360007894594-Gettext-PO-POT Demonstrates how comments starting with '#.' in Gettext files are treated as instructions for translators. ```gettext #. This is an instruction that is included in the file above a string. #. This is also an instruction that will be presented to translators. #: arch/linux/directory_reader.py:101 msgid “Original source string.” msgstr “” ``` -------------------------------- ### Start Repository Connector Application Source: https://help.smartling.com/hc/en-us/articles/360008039014-Repository-Connector-Installation-and-Setup Execute this command to start the Repository Connector application. Ensure the JAR file name is correct. ```bash java -jar repo-connector-1.5.5.jar -start ```