Skip to content

Transifex integration and the generation of .po files in the locale directory. #1303

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

Closed
carukc opened this issue May 28, 2015 · 5 comments
Closed

Comments

@carukc
Copy link

carukc commented May 28, 2015

Hello,

I have been trying to get Transifex integration working all week. After much trial and error and a review of other projects I've discovered that the tx (transifex-client) command relies on .po files that are stored in ../user_builds/checkouts/latest/docs//,lang>/LC_MESSAGES/ directory and indexed in a .tx/config file. The indexed entries in the config file are delineated by square brackets ([a.name]).

The .tx directory and config file are created using 'tx init' (in my case in the docs folder of my project). 'tx init' also creates a .transifexrc file in the project user's home directory and stores Transifex account info.

It looks like the initial 'tx push -s' command can be run from pretty much anywhere and will search for the .tx directory and config files.

So far so good... the questions are...

  • How are the .po files in locale/en/LC_MESSAGES/ generated? I'm able to build successfully but these files do not seem to appear.
  • Do the sections in the config file ([readthedocs-docs.api] for example) relate to a directory or are they related to a project within Transifex?
  • Does the config file need to be managed manually or is this done as part of the build?

Thanks for the help
Chris

+1 for the 'Simplify Translation Workflow #810' request. I think that integrating translations could definitely be streamlined.

@guokan-shang
Copy link

you can find some useful infos here to know how to generate LC_MESSAGES and integration withTransifex, About Translation Workflow #1280

@carukc
Copy link
Author

carukc commented May 29, 2015

Many Thanks! I'll take a look now.

I also found come code in RTD in fabfile.py in section def i18n_docs(): that runs 'sphinx-intl build' so it looks like at least part of this should be running as part of a build.

@carukc
Copy link
Author

carukc commented Jun 1, 2015

I'll answer my own question here just in case the information helps someone else.

Q. How are the .po files in locale/en/LC_MESSAGES/ generated? I'm able to build successfully but these files do not seem to appear.

A. There is a Makefile that if copied into a documentation project when you run the 'sphinx-quickstart' command. See here for more info: http://docs.readthedocs.org/en/latest/getting_started.html

If you 'make gettext' using that makefile it will generate a _build directory with the .pot files in it. The _build directory does not need to be retained so you can add it to your .gitignore file

After building, run 'sphinx-intl update -l en' to create the po files in locale/en/LC_MESSAGES/

I also create a symbolic link called pot in the locale directory that points to ../_build/locale .
From there run 'tx init' to setup the Transifex config files. This is also described on the Transifex site at: http://docs.transifex.com/client/init . MAKE SURE that you get the latest version of the tx client . Lots of things seem the changing at Transifex and the older clients just don't work.

Note that you then have to populate your own .tx/config file. I've written a python script that I'll put on github after I've fully debugged that generates a config that creates entries based on the .pot files in the locale/pot directory (that links into _build/locale .

Q. Do the sections in the config file ([readthedocs-docs.api] for example) relate to a directory or are they related to a project within Transifex?

A. Before the dot is your TRANSIFEX project name. After the dot is the file name without an extension.

Q. Does the config file need to be managed manually or is this done as part of the build?

A. Regrettably the config file needs to be built (and updated) by hand... Which is a pain if you have an ever growing number of files. The script really helped me and I'll make sure to get it up for all to use.

@carukc carukc closed this as completed Jun 1, 2015
@ericholscher
Copy link
Member

Would be great to document this in our official docs! If you send over a
pull request, would be happy to add it.

On Mon, Jun 1, 2015 at 2:05 PM, Christopher Caruk [email protected]
wrote:

Closed #1303 #1303.


Reply to this email directly or view it on GitHub
#1303 (comment).

Eric Holscher
Maker of the internet residing in Portland, Oregon
http://ericholscher.com

@carukc
Copy link
Author

carukc commented Jun 1, 2015

It would be my pleasure to do that.

I've not done much with GitHub so it will take me a couple days to get to it but I'll do when I set up the script project.

Am I correct in assuming that I fork, add the content and then send you the pull request?

Chris

On 1 Jun 2015, at 22:38, Eric Holscher <[email protected]mailto:[email protected]> wrote:

Would be great to document this in our official docs! If you send over a
pull request, would be happy to add it.

On Mon, Jun 1, 2015 at 2:05 PM, Christopher Caruk <[email protected]mailto:[email protected]>
wrote:

Closed #1303 #1303.

Reply to this email directly or view it on GitHub
#1303 (comment).

Eric Holscher
Maker of the internet residing in Portland, Oregon
http://ericholscher.com

Reply to this email directly or view it on GitHubhttps://github.com//issues/1303#issuecomment-107718559.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants