Greetings, culinary code connoisseurs! Today, we’re whipping up a Python recipe for adding users to your Transifex organization in bulk. This dish will help you seamlessly build a team with specific roles, allowing you to manage your localization projects with ease. Let’s get our aprons on and start cooking!
Kitchen Prep: Ingredients You’ll Need
Before diving in, make sure you have everything ready:
- Download the "Add users to your organization in bulk" recipe from the Transifex Developer Hub.
- Install Python on your computer.
- Prepare a CSV file with the user details (structure explained below).
- Transifex API Token for authentication.
- Users already signed up on Transifex.
Pro Tip: Use UTF-8 encoding for your CSV file to avoid errors. Google Sheets does this automatically, but if you’re using Excel, double-check your encoding settings when saving.
Structuring Your CSV File
Your CSV file should be set up with each row representing a user and columns for the necessary details:
Column | Description |
---|---|
username | Required; exact username of the user in Transifex. |
role | Required; role to assign (e.g., project maintainer , team manager , translator , reviewer , etc.). |
project_slug | Optional; slug for the project (needed if adding a project maintainer). |
team_slug | Optional; slug for the team (needed for roles like team manager or translator). |
language_code | Optional; code for the language (needed for language-specific roles like translator). |
CSV Example
Here’s an example of how your CSV file might look:
username | role | project_slug | team_slug | language_code |
---|---|---|---|---|
user1 | project maintainer | proj_123 | ||
user2 | team manager | team_123 | ||
user3 | language coordinator | team_456 | es_MX | |
user4 | translator | team_456 | es_MX |
Note: If you’re adding translators or reviewers, make sure a language coordinator is already set up for that language team.
Cooking Instructions: Running the Recipe
-
Open Your Terminal
Navigate to the directory where your Python script (recipe.py
) and CSV file (users.csv
) are located. -
Run the Command:
python recipe.py users.csv
-
Enter Your API Token and Organization Slug
The script will prompt you to enter your API token and organization slug. Here’s what you’ll see:Please enter your API token:
Please enter your Organization slug:
-
Sit Back and Watch
The script will read through your CSV file and start adding users. For each user, it will display success messages based on their role:SUCCESSFUL ADDITION: user1 was added to your project proj_123 as project maintainer SUCCESSFUL ADDITION: user2 was added to your team team_123 as team manager SUCCESSFUL ADDITION: user3 was added to your team team_456 as coordinator in language es_MX SUCCESSFUL ADDITION: user4 was added to your team team_456 as translator in language es_MX
Troubleshooting Errors
If any issues arise during the process, a file called app.log
will be generated in the same directory. This log file will record any errors encountered, such as incorrect role assignments, invalid slugs, or encoding problems.
Savor the Success
With your team all set up, you’re ready to tackle your localization projects like a pro. Bon appétit, and happy translating!