<h1 align="center">
<a href="https://prompts.chat">
A Python tool to interact with Phrase TMS with AI-powered translation capabilities.
Sign in to like and favorite skills
A Python tool to interact with Phrase TMS with AI-powered translation capabilities.
pip install -r requirements.txt
.env:PHRASETMS_USERNAME - Phrase username (not email address)PHRASETMS_PASSWORD - Phrase passwordPHRASETMS_USE_US_DATA_CENTER - Set to true to use the US data center. Set to false, leave empty or remove altogether to use the EU data center.PHRASETMS_TERM_BASE_UID - Term base UID of the term base in PhraseGOOGLE_SERVICE_ACCOUNT_EMAIL - Google Cloud service account emailGOOGLE_SERVICE_ACCOUNT_PRIVATE_KEY - Google Cloud service account private keyGOOGLE_CLOUD_PROJECT_ID - Google Cloud project IDGOOGLE_CLOUD_LOCATION_ID - Google Cloud location (e.g. us-central1)GOOGLE_DRIVE_JOBS_UPLOAD_FOLDER_ID - Google Drive folder ID into which project folders with job folders will be uploaded. This needs to be a folder that the service account has access to in a shared drive.prompt.txt - Create this file in the same directory as script.py with your translation promptstyle-guide.md - Optional - Create this file to include style guidelines that will be appended to the translation promptThe script will automatically detect and incorporate the style guide if present, enhancing translation quality and consistency. If it is not found, the script will continue running with just the base prompt.
Run the script:
python script.py
jobs/ - Directory containing all job files
job_id/ - Individual job directory
input.mxliff - Original downloaded fileinput_minified.mxliff - Minified version of the original file that is sent for translationoutput.mxliff - Translated file{1} => <x id="1"/> and {2>GitLab<2} => <g id="2">GitLab</g>)XLIFF_TRANS_UNIT_BATCH_SIZE constant)To run the tests for this project:
pip install -r requirements.txt pip install -r test-requirements.txt
pytest:python -m pytest test_script.py -v
When working with the
style-guide.md file, do not use Prettier for formatting as it adds unwanted spaces between Japanese and English characters. Instead, use markdownlint for proper formatting of Markdown files containing Japanese text.
If you're using Visual Studio Code, you'll be prompted to install the recommended markdownlint extension when opening this repository. This extension is configured as the default formatter for Markdown files in the project settings (
.vscode/settings.json).
The markdownlint extension preserves the correct spacing conventions for Japanese text, ensuring that no spaces are added between Japanese and English characters, which is critical for maintaining proper Japanese typography as outlined in the style guide.
The
style-guide.md Markdown file is converted to PDF format to be shared with linguists. This helps them understand the style guide in a more readable format.
This conversion is done using the
npm package using the following command:md-to-pdf
md-to-pdf style-guide.md --document-title="GitLab Japanese Tech Docs Style Guide"