Commands (Filesystem Connector)
- Laura White (Unlicensed)
- Kenny Teves
Run Enterprise's most popular actions right from your desktop (or server) with our command line tool, Enterprise Filesystem Connector.
Version
Current version: 1.1 (Help file is current for Filesystem Connector version 1.1)
Be sure you are running the latest version of Filesystem Connector. From the command prompt, run
pip install ltk --upgrade
Below, find each command, along with a description of the general idea behind the command.
- For help, type "--help" after ltk (or after any other command) in the command prompt.
- In the usage examples, arguments in brackets are optional.
For the most current descriptions, type "ltk --help" in the command line.
Usage: ltk [OPTIONS] COMMAND [ARGS]...
Commands
Options
--version | Show the version and exit |
-q | Show only warnings |
-v | Show API calls. Use -vv for API responses |
-h, --help | Show help files |
Tip: Some comparisons are made to the Git command line tool, which also synchronizes local files with remote repositories.
ltk
The ltk command line tool is used to sync documents and translations on Enterprise's system with local documents and translations on a specific computer (or server, for example). The local documents associated in the local database of the command line tool (the database being a JSON file named docs.json at .ltk/docs.json) may not be the same as those documents on Enterprise's system. Specific commands are used to sync the local documents with Enterprise.
Usage: ltk [OPTIONS] COMMAND [ARGS]...
Options:
--version Show the version and exit
-q Will only show warnings
-v Show API calls. Use -vv for API responses
--help Show this message and exit
ltk commands:
add Add files and folders
clean Clean up the associations between local documents and documents in Enterprise
clone Clone the original file structure for completed translations
config View or change local configuration
download Download specified translations
filters List, create, update, or delete Enterprise filters
import Import docs from Enterprise
init Connect to a local project to Enterprise
list Show docs, workflows, locales, formats, or filters
mv Move completed translations from one file directory to another.
pull Pull translations for all added documents (for all locales or by specified locales)
push Send updated content to Enterprise for documents that have been added
request Add targets to document(s) to start translation; defaults to the entire project. Use ltk list -l to see possible locales
rm Disassociate local doc(s) from Enterprise Cloud and delete the remote copy
status Get the status of a specific document or all documents
watch Watch local and remote files for updates
add
Add is for adding local documents to Enterprise's system, specified by file path. Adding a folder adds all documents in that folder, similar to git add.
Usage: ltk add [OPTIONS] FILE_NAMES...
Adds content. Could be one or more files specified by a Unix shell pattern
Options:
-d, --directory Only add directories, not files inside directories
-s, --srx PATH srx file
-l, --locale TEXT If source locale is different from the default configuration. Use ltk list -l to see possible locales
-f, --format TEXT Format of file; if not specified, will use extension to detect; defaults to plain text. Use ltk list -f to see possible formats. Files may not be added to Enterprise's system if not formatted correctly according to the specified format.
-s, --srx PATH srx file
-si, --srx_id TEXT srx id
-i, --its PATH its file
-ii, --its_id TEXT its id
-c, --charset TEXT file encoding
-ff, --fprm PATH fprm file
-fi, --fprm_id TEXT fprm id
-fs, --fprm_subfilter PATH fprm subfilter file
-fsi, --fprm_subfilter_id TEXT fprm subfilter id
-v, --vault_id TEXT Save-to TM vault id
-o, --overwrite Overwrite previously added file if the file has been modified
-e, --external_url TEXT Source url
Display Metadata
--note TEXT Note
--author_email TEXT Author email
--author_name TEXT Author name
--business_division TEXT Business division
--business_unit TEXT Business unit
--campaign_id TEXT Campaign ID
--campaign_rating TEXT Campaign rating
--channel TEXT Channel
--contact_email TEXT Contact email
--contact_name TEXT Contact name
--content_description TEXT Content description
--content_type TEXT Content type
--domain TEXT Domain
--due_date TEXT Due date (as Unix timestamp, in milliseconds)
--due_reason TEXT Reason for due date
--external_application_id TEXT External application ID
--external_document_id TEXT External document ID
--external_style_id TEXT External style ID
--purchase_order TEXT Purchase Order
--reference_url TEXT Reference URL
--region TEXT Region
--require_review TEXT Require review
--category_id TEXT Category ID
clean
Clean is used to make sure that there aren’t documents stored in the local database that aren’t actually in Enterprise's system. References to those documents that aren’t on Enterprise's system are removed from the database (not the documents themselves, unless the --force option is used).
Usage: ltk clean [OPTIONS] [FILE_PATHS]...
Cleans up the associations between local documents and documents in Enterprise. By default, checks that local documents and remote documents line up. Use different options for different use cases. Enter file or directory names to remove local associations of specific files or directories.
Options:
-a, --all Removes all associations between local and remote
-f, --force Deletes local documents that no longer exists in Enterprise
clone
Clone is used to copy the folder structure of translated folders for each target locale as specified in config. Folders are added to the locale folder specified if one has been specified, or by default a new folder will be created with the name of the locale. If only one root folder is being cloned, then the locale folder is used (instead of creating a new folder inside of the locale folder).
Options:
config
Config is used to display or change ltk’s configuration for the project. Simply entering ltk config with no options displays the config information, which is stored at the file .ltk/config. Config options are especially important when using the watch command.
Usage: ltk config [OPTIONS]
View or change local configuration
Options:
-l, --locale TEXT Change the default source locale for the project
-w, --workflow_id TEXT Change the default workflow id for the project
-c, --clone_option TEXT Toggle clone download option on and off.
- Turning clone on: Translations will be downloaded to a cloned folder structure, where the root folder for each locale is the locale folder specified in config or a locale folder inside of the default download folder. If a default download folder is not set, then translations will be downloaded to the directory where the project was initialized.
- Turning clone off: If a download folder is specified, downloaded translations will download to that folder, but not in a cloned folder structure. If no download folder is specified, downloaded translations will go to the same folder as their corresponding source files.
-d, --download_folder TEXT Specify a default folder for where downloaded translations should go.
Tip: Use --none to remove the download folder.
Using --none will cause downloaded translations to download to the same folder as their corresponding source files.
-f [on|off], --auto_format [on|off]
Set an "auto-format" tag to automatically apply formatting when pulling translations from the Enterprise TMS.
-t, --target_locales TEXT
Specify target locales that documents in watch_folder should be assigned; may either specify with multiple -t flags (ex: -t locale -t locale) or give a list separated by commas and no spaces (ex: -t locale,locale)
-p, --locale_folder TEXT...
For a specific locale, specify the root folder where downloaded translations should appear. Use --none for the path to clear the download folder for a specific locale. Example: -p fr_FR
translations/fr_FR
-r, --remove_locales Remove all locale folders and use the default download location instead.
-g, --git TEXT Toggle Git auto-commit option on and off
-gu, --git_credentials Open prompt for Git credentials for auto-fill ('none' to unset); only enabled for Mac and Linux
-a, --append_option TEXT Change the format of the default name given to documents on the Enterprise system.
Define file information to append to document names as none, full, number:+a number of folders down to include (e.g. number:2), or name:+a name of a directory to start after if found in file path (e.g. name:dir). Default option is none.
download
Download is used to download translations of local documents that are also on Enterprise's system. You can download specific locales. In the future it may be possible to download all locales for a specific document. See pull for downloading translations for all documents at once (for all locales or for specified locales).
Usage: ltk download [OPTIONS] LOCALES FILE_NAMES...
Downloads translated content specified by filename for specified locales.
For multiple locales give a list separated by commas and no spaces (ex: en_US,en_GB)
Options:
-a, --auto_format Flag to auto apply formatting during download
-l, --locales TEXT
Specify locales to download (defaults to all target locales for the document). For multiple locales give a list separated by commas and no spaces (ex: en_US,en_GB).
-e, --locale_ext
Specifies to add the name of the locale as an extension to the file name (ex: doc1.fr_FR.docx). This is the default unless the clone download option is active.
-n, --no_ext
Specifies to not add the name of the locale as an extension to the file name. This is the default if the clone download option is active.
-x, --xliff
Download xliff version of the specified translation.
filters
Use the filters command to list, create, update, or delete Enterprise filter configurations.
Usage: ltk filters [OPTIONS] COMMAND [ARGS]...
Commands:
add Create a filter configuration on Enterprise.
get Retrieve filter configuration contents from Enterprise.
list List default and custom filter configurations.
rm Remove filter configuration from Enterprise.
save Update filter configuration on Enterprise.
import
Import is used to download files that are on Enterprise's system for the project, while at the same time adding references to these documents to the local database.
Usage: ltk import [OPTIONS]
Import documents from Enterprise Cloud, by default downloading to the project's root folder
Options:
-a, --all Import all documents from Enterprise Cloud
-f, --force Overwrite existing documents without prompt
-p, --path PATH Import documents to a specified path
init
In order to start using ltk, init must be used in the directory that you wish to have your project on your computer, similar to git init. Most if not all production environments use the host myaccount.lingotek.com, which is the default host. The sandbox host (cms.lingotek.com) can be specified using the --host option. After authenticating with Enterprise through your browser (which is opened for you automatically) and selecting your community you can select a current project or create a new one.
After selecting your project, init creates a .ltk folder in the same directory where ltk init was used. The .ltk folder contains the config file, the docs.json database file, and a log file.
Usage: ltk init [OPTIONS]
Connects a local project to Enterprise
Options:
--access_token TEXT Your access token
--host [myaccount.lingotek.com|cms.lingotek.com] Environment: myaccount for production, cms for sandbox; the default is production
--client_id TEXT This is an advanced option that should only be used for clients that have been issued a specified client_id for analytics
--path PATH The path to the project directory to be initialized; defaults to the current directory
-n, --project_name TEXT The preferred project name, defaults to the current directory name
-w, --workflow_id TEXT The id of the workflow to use for this project; defaults to machine translate only
-b, --browserless Authorizes without opening a web browser, requires manual input of username and password
-l, --locale TEXT The default source locale for the project; defaults to en_US
-d, --delete Delete the current project remotely and re-initialize
--reset Reauthorize and reset any stored access tokens
list
List is used to show the files referenced in ltk’s local database, with the names or paths, IDs, and target locales. See status for displaying information for documents from Enterprise's system. List can also be used to list possible workflows, locales codes, file formats, and filters.
Usage: ltk list [OPTIONS]
Shows docs, workflows, locales, formats, or filters
Options:
-t, --title List document titles and folder paths from project root instead of relative file paths
-c, --hide_docs Collapse to list directories only (instead of both directories and documents).
-w, --workflows List available workflows
-l, --locales List supported locale codes
-f, --formats List supported formats
-r, --remote List all project documents on Enterprise Cloud
--filters List default and custom filters
mv
Mv is used to move the specified local document to a specified destination directory, moving both the file itself and file location stores in the local database. If SOURCE_PATH is a directory, all added files in the directory will be moved.
Usage: ltk mv [OPTIONS] SOURCE_PATH... DESTINATION_PATH
Options:
--help Show this message and exit.
pull
Pull is used to download the translations for all (or specific) locales for all local documents associated with Enterprise's system. Similar to git pull, this pulls any changes in the remote database. Translations are downloaded even if they are incomplete.
Usage: ltk pull [OPTIONS] [LOCALES]...
Pulls translations for all added documents for all locales or by specified locales
Options:
-a, --auto_format
Flag to auto apply formatting during download
-e, --locale_ext
Specifies to add the name of the locale as an extension to the file name (ex: doc1.fr_FR.docx). This is the default unless the clone download option is active.
-n, --no_ext
Specifies to not add the name of the locale as an extension to the file name. This is the default if the clone download option is active.
push
Similar to git push, ltk push submits changes to local documents to Enterprise's system, for those documents that have already been added. For those documents that are changed, this action brings the progress of translations back to 0% for all locales.
Usage: ltk push [OPTIONS]
Sends updated content to Enterprise for documents that have been added
Options:
--help Show this message and exit
request
Request requests target locales for all local documents in the project, or for specific files or directories if specified (only requesting locales for those documents already added). If an automatic workflow is setup on Enterprise, this will begin after the locale is requested.
Usage: ltk request [OPTIONS] LOCALES...
Add targets to document(s) to start translation; defaults to the entire project. Use ltk list -l to see possible locales
Options:
-n, --doc_name TEXT The name of the document; specify for one document
-p, --path PATH A file name or directory for which to request targets
-d, --delete Deletes a specified target locale
--due_date TEXT The due date of the translation
-w, --workflow TEXT The workflow of the translation (do "ltk list -w" to see available workflows)
rm
Rm is used to remove documents from Enterprise's system as well as local associations or references to local documents. Local documents are not deleted unless the --force option is used. The --id option can be used to remove documents on Enterprise's system that aren’t found locally. Use -ar to remove all remote documents on Enterprise's system.
Usage: ltk rm [OPTIONS] [FILE_NAMES]...
Disassociates local doc(s) from Enterprise Cloud and deletes the remote copy. If the remote copy should be kept, please use ltk clean.
Options:
-d, --directory Only remove directories, not files inside directories.
-i, --id Delete documents with the specified ids (instead of file names) on Enterprise Cloud.
-n, --name Delete documents with the specified names (instead of file names or paths) on Enterprise Cloud.
-a, --all Delete all documents from Enterprise Cloud that are found locally.
-r, --remote When used with -a, deletes all documents from Enterprise Cloud for the current project.
-f, --force Delete both local and remote documents. Can be used in association with --name to delete a specified document.
-l, --local Delete all documents locally, but not from the Enterprise Cloud. Can be used in association with --name to delete a specified document locally.
status
Status is used to list information for local documents, taking this information from Enterprise's system, whereas list shows information from the local database. Use --detailed to show the translation progress of each locale for each document, and --all to list all documents on Enterprise's system (even those not found locally).
Usage: ltk status [OPTIONS]
Gets the status of a specific document or all documents
Options:
-n, --doc_name TEXT Specific document name to get status of
-d, --detailed Detailed status of each locale for the document
-a, --all List all project documents on Enterprise Cloud
watch
Watch is used to watch local documents for changes and to download translations upon completion. If a specific watch directory is specified, any documents added to the watch folder will be added automatically. Specific file types can be ignored by using the --ignore option (for example, ltk watch --ignore .php would ignore any new files with the extension .php). Use ltk config --download_folder to specify where downloaded translations should appear, ltk config --watch_folder or ltk watch --path to specify a specific directory to watch, and ltk config --target_locales to specify target locales that should be requested automatically for newly added documents.
Usage: ltk watch [OPTIONS]
Watches local files added or imported by ltk and sends a PATCH when a document is changed. Also watches remote files and automatically downloads finished translations.
Options:
--ignore TEXT Specify types of files to ignore
--auto TEXT Automatically detects locale from the file name; specify locale delimiter
-t, --timeout INTEGER The amount of time watch will sleep between polls, in seconds. Defaults to 1 minute
-n, --no_folders Ignore files added to watch folders and only watch documents that have already been added
-f, --force_poll Force API calls to Enterprise system at every poll for every document