Hello, Transifex Chefs! Today, we’re cooking up a special script to supercharge your localization kitchen. This recipe will help you bulk download source files from your Transifex projects, seasoning your workflow with efficiency and precision. Grab your aprons—let’s start cooking!
Before we start mixing ingredients, ensure you have:
A valid Transifex API token—think of this as your secret sauce!
The slug of your Transifex organization—where all your projects live.
- (Optional)
Slugs of specific projects and resources—pick just the flavors you need!
Key Concepts
API Token: Your secret pass to authenticate and interact with the Transifex API. Ensure it’s valid and keep it secure.
Organization Slug: The unique identifier for your Transifex organization. You’ll need this to specify from which organization to download the source files.
Project Slug: (Optional) Unique identifiers for the projects you want to download files from. If not provided, the script can fetch files from all projects.
Resource Slug: (Optional) Unique identifiers for the resources within a project. If not provided, the script can fetch all resources.
How to Cook This Recipe
- Run the script: Execute the script from your terminal:
python recipe-source.py
- Provide required inputs: The script will prompt you to enter your API token, organization slug, and options to specify projects and resources. Example:
Please enter your API token: YOUR_API_TOKEN
Please enter your Organization slug: YOUR_ORG_SLUG
Do you want source files **for** [a]ll projects **or** [s]pecific ones? [a/s]: a
Do you want source files **for** [a]ll resources **or** [s]pecific resources? [a/s]: s
Please enter the resources slugs, separate them **with** a comma (,): resource1,resource2
- Download source files: The script will process your input and download the specified source files to a directory structured as:
organization_slug/project_slug/resource_filename.
Successful Outputs
Upon successful execution, you will see messages indicating the progress and completion of source file downloads:
- For each project:
Source-Download **for** Project PROJECT_SLUG started.
- For each resource within a project:
* - Source files **for** Resource: RESOURCE_NAME started.
* - Source files **for** Resource: RESOURCE_NAME completed.
- When all files for a project are downloaded:
Source-Files-Download **for** Project PROJECT_SLUG completed.
Error Kitchen Nightmares
If there’s a hiccup, such as a missing ingredient or a burnt file:
- If no resource is found to get i18n format:
No resource found to get l18n format
- If the source file fails to download:
The source file failed to be downloaded: ERROR_MESSAGE
Errors will be logged in app.log
in your script’s directory—like a recipe journal for troubleshooting!
Final Plating
With this script, your Transifex experience should be as smooth as your favorite gravy! If you encounter any snags, just consult the logs—they’re like your cookbook’s troubleshooting page.
Ready to get started? Dive into your Transifex projects with this handy tool, and taste the flavor of efficiency! Don’t forget to share your success stories or any questions in our community forum. Happy translating, and enjoy your efficient, new workflow in the Transifex kitchen!