-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate Transifex with CircleCI #4463
Comments
I wonder if I can help with this, currently I am thinking of adopting the similar workflow in my company as well. |
Actually you can do that in travis https://docs.travis-ci.com/user/conditional-builds-stages-jobs/ Also, I just saw this https://docs.travis-ci.com/user/deployment/transifex/ (not sure if it's updated) |
good to know that they have deployment script. |
but we also need to pull the translated contents as well. |
I provided a travis-ci YAML file in the above PR, but i was told RTD is now using circle-ci. Having that said, Also, here is an untested job description to be used in .circleci/config.yml:
TRANSIFEX_API_TOKEN is the variable containing the API token to be used by If a test returns the error saying that only (Transifex) project maintainer can push source strings, it is a great progress! While a similar set of statements works on TravisCI (see PR!), I wasn't able to test it on CircleCI ( because of some obstacles in CircleCI, I mentioned in the PR). Anyone willing to test it? EDIT: Bumped Python version to 3.8 in my suggestion, as the same happened in the .circleci/config.yml. |
This is great, thanks @rffontenelle! Sounds like we have a few things to coordinate on our side to test |
Were we able to move forward on this? It would be awesome to have strings updated on Transifex after 3 years. :-) |
Originally posted by @Daltz333 in #8605 (comment) |
@astrojuanlu In regards to the workflow we use at frc-docs. It's a two repository fully automated process. We use two repositories as to avoid several scenarios.
frc-docs-translations has a submodule of frc-docs. We have a scheduled GitHub action that does the following:
This is how the repository works at a high level overview. The actual commands themselves are a bit more complex due to the requirement of On the ReadTheDocs side, we create a new project for every translation, set the language, then in the main project (frc-docs) we set our other projects as translations. This doesn't affect RTD servers as much as the on every commit solution because its a scheduled service instead of on-demand. You could use workflow triggers to make this on-demand but I really don't see it as necessary. Translators usually aren't translating within 5minutes of a resource getting updated. Relevant Scripts:
The "sphinx" project itself just "imports" the submodules conf.py. This breaks on locally hosted extensions (not on pypi), you'll have to add extensions in the submodule manually to the translation repo conf.py too. Another note: This system (and any other system I can reasonably think of) requires trust of your translators or translator maintainers. If an inappropriate translation comes through, we won't see it until late. There is no good solution to this besides well-trained language reviewers (or paying somebody and having accountability in the process). |
I'd be happy to set up a Proof of Concept of this process using ReadTheDocs (using ReadTheDocs as a submodule). In terms of better documenting how to automate translations, it may be better to just have a "canned" translation repo template that people can use for now until R&D work can get done on the RTD side. |
I figured I could also document our update.sh a bit. Breaking down !/bin/sh
# update transifex pot and local po files
set -ex
LANG_TO_PULL=${1:-'fr_CA,es_MX,zh_CN,tr_TR,he_IL,pt'}
LANG_MAP='es_MX: es, fr_CA: fr, he_IL: he, tr_TR: tr'
MAINPROJECT=frc-docs
# Set working directory to repo root
cd `dirname $0`/..
# Create POT Files
sphinx-build -T -b gettext $MAINPROJECT/source locale/pot
# Update .tx/config
rm .tx/config
sphinx-intl create-txconfig
echo "lang_map = ${LANG_MAP}" >> .tx/config
sphinx-intl update-txconfig-resources -p locale/pot -d locale --transifex-project-name $MAINPROJECT
# Push and pull from Transifex. It is important to push then pull!
# If you pull then push, the PO files will contain out of date strings.
if [ "$CI" = true ]
then
tx push --source --no-interactive --skip
fi
tx pull -l $LANG_TO_PULL --mode onlyreviewed --use-git-timestamps
First, we declare the language codes we want to pull from transifex.
then we map these to codes that ReadTheDocs accepts and declare the name of our project as it shown in our submodule (what the name of the submodule directory is)
Now we go ahead and build out updated strings
this text does a variety of things. We delete our transifex-client config and recreate it (transifex-client will try to update the config and it usually is terrible, so we just recreate). Then we regenerate the config and override the language codes in
this last part pushes our new strings from our updated submodule and then pulls the updated translation from transifex. The order here is important. |
@Daltz333 have you considered adding |
Parallel actually makes us hit transifex rate limit for when we pull 1500+ resources... Our project is huge and over 200k strings over 200 articles. 200 articles between 8ish languages is a lot. Remember that we are both pushing and pulling. We often hit the 5000 requests per 5 minutes limit with parallel. Plus CI time is cheap |
@Daltz333 I also notice the |
It will also work if you have a TX_TOKEN environment variable. |
Thanks for the overview @Daltz333 ! I think we'll be affected by similar issues when we go to automate the process, though our source translations are pretty minor in comparison. The superfluous commits will probably be a small hurdle, as we have some additional process around our application releases and branching. |
Today I was asked via support why some things were translated and some other strings were not in the flyout. I raised this in Slack and I arrived at this issue. After reading the issue, it seems the main complicate thing is to make it work automatically on particular merges to avoid running it too frequently. So, I think we can do the push & pull commands part of the release process we already have |
Just a heads-up: The Python transifex-client uses Transifex API v2, which going away in November 30, 2022. The new transifex/cli is going to be the new thing, using the API v3. Since the new client is written in Go lang, it won't be installable via Python's requirements.txt. For more info: https://community.transifex.com/t/postponing-api-2-0-2-5-and-transifex-client-sunset-date/2759 @Daltz333 noticed that sphinx-intl uses API v2, so this is another point of issue. See sphinx-doc/sphinx-intl#60 |
This integration is done already. We integrated the update for translation strings into our release process, so they will be updated with the same frequency as we release a new version of Read the Docs. We did a small initial test and it did work 👍🏼 Note that we are not using CircleCI or any CI to do this, it's just an extra step into our release scripts. They will call I'm closing this issue now. Expect to have more translated string in the Read the Docs application! Thanks to all the people involved into this issue and also to all the translators for their hard work ❤️ Feel free to comment here or open a new issue if you think there is something wrong with the process we developed. |
@humitos Just curious: I saw that readthedocs project in Transifex (i.e. translation of the software itself) was updated twice after your last comment above but i had the impression this and readthedocs-docs project (i.e. translation of the docs) would update at the same time. Are they suppose to be auto updated at the same time? |
@rffontenelle Hi! I didn't work on updating |
That's awkward. I had this impression this issue was about |
I also assumed this was about |
We also don't have any translations set up in our docs (e.g, https://docs.readthedocs.io/es/stable/), so this is probably another issue (if we should enable translations for our docs). |
Started a new issue ☝, since this one is, i mean, was about application translation. |
We do a bad job of keeping translation files up to date. Let's automate it!
Docs here:
https://docs.transifex.com/integrations/github/#integrating-the-client-with-travis-ci
The problem is that these docs are bad. This would result in every PR pushing up translations. This is bad, we probably only want this on pushes to
master
. That's cool, lets just make a contrib script or something that emulates the steps in the Travis config in the example above and just check formaster
branch before pushing.The text was updated successfully, but these errors were encountered: