-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Added localization language support #405
Conversation
macagua
commented
Apr 1, 2017
- Added i18n support using Babel
- Added Spanish translation
- Updated .gitignore file
Awesome IMO we should hold off on 0.2.5 until this gets merged. |
Once this gets merged I can talk to some of our translators and get the following translations:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Please do not include the binary
.mo
files in the repository. Storing the binary files in Git is a bad idea, and this file is (re-)created by Sphinx during build anyway. - The
.gitignore
changes seem unrelated.
Once this is merged, I will be happy to provide a Russian translation. I have it ready already :)
@mitya57 you are right about .gitignore file I revert this commit :-) |
It was better to rebase without that commit, rather than reverting. But I am not the maintainer so I have no voice here anyway :) |
@mitya57 please check out these improvements! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still adding the binary .mo
file. Also, left an inline comment for setup.py
changes.
setup.py
Outdated
'Sphinx>=1.4.1', | ||
], | ||
cmdclass = { | ||
'compile_catalog': babel.compile_catalog, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If babel was not imported, this would be an undefined variable access. You can see this failure on Travis.
In my opinion setup.py
modifications are not needed at all. This project is using setuptools, and babel is installing an entry point for setuptools, so these commands are available automatically.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mitya57 it is the problem :(
then remove the Babel Distutils/setuptools integration? I had to install Babel via pip install so I could extract the strings to translate and compile the mo file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When babel is installed, its setup.py commands should work automatically, without your changes to setup.py
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mitya57 An good alternative will be create a requeriments-devs.txt file with the Jinja2 and Babel dependencies or create a TRANSLATE file with this instructions.
… TRANSLATE file for more details about translate the package
@mitya57 done 👍 |
@mitya57 any update about this? |
@macagua As I said, I am not the maintainer here, so someone else should merge this. It looks good to me, though I would squash all commits into a single one to remove the useless changes (this can be done when merging though). |
LGTM |
@mitya57 thanks you!!! |
Yes, I spoke with them today and they will have a look mid next week.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noted some documentation changes, but otherwise I think this makes sense.
Our current workflow on RTD is to use Transifex. If there is anything here that competes with that, I'd rather update our process here to match.
README.rst
Outdated
============ | ||
|
||
You can help to translate the Read the Docs Sphinx Theme, | ||
please check out the ``TRANSLATE.rst`` file for more details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm -1 on littering the repo with these files, this should be in our documentation instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@agjohnson inside a docs directory with a Sphinx documentation format?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think inside the demo docs. Are general idea is to make them include more information about the theme.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TRANSLATE.rst
Outdated
Languages availables: | ||
|
||
- Spanish contributed by Leonardo J. Caballero G. | ||
- Your Language by YOUR NAME. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file should be moved into our docs. Also, I'm very happy to apply attribution, but putting author and translation status information in the docs is guaranteed to go stale. I'd rather avoid this and keep authors in another location.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@agjohnson @Blendify when you said "This file should be moved into our docs" are you refernce into the docs readthedocs.org? Or what kind of location are you preference? or what other location are you preference?
TRANSLATE.rst
Outdated
Installation | ||
============ | ||
|
||
For translate the Read the Docs Sphinx Theme you need install the following packages: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For translate
->For translating
you need install
->you will need to install
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@agjohnson done with commit 15d2198
TRANSLATE.rst
Outdated
|
||
.. code:: bash | ||
|
||
$ pip install babel Jinja2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jinja2 is a sphinx requirement and should already be present as part of development set up for this package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@agjohnson I agree with you, but it is not clear when downloading this package so at least I indicate that dependencies minimally require to generate the gettext files with the Babel library from this package.
Remember that when you install this package using the command python setup.py install does not install any dependencies, ie. does not install Sphinx package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@agjohnson Any news on this comment?
TRANSLATE.rst
Outdated
-------------- | ||
|
||
It is available the option to init catalog. | ||
More options please, check out http://babel.pocoo.org/en/latest/setup.html#update-catalog |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This disutils section doesn't seem to clarify anything. It can either be dropped completely, or updated to be a list of explicit steps an author will need to take to create a translation.
Wow |
@Blendify How can help to merge this improvements? |
Hello everybody, is anybody working on this merge request? I'd really appreciate to get this functionality. kind regards |
Hey Jörg,
I don't know anything about the current work on this, but it is possible to use this functionality right now. The folder
Where the If you want to use other folders than I used this technique, copied in large parts from this comment, successfully with my German Works like a charm. |
Hi derdennis,
Yes, I found that exact solution in the meantime, too. It works indeed like a charm for the time being. I can add a little bit of information: this solution also works well when using the latest sphinx-maven-plugin thank you again |
THE STATE OF THIS PULL REQUEST Hi guys, this improvement a time ago, it worked very well and it happened with the review of many guys here, in it moment, just a new Sphinx package release was needed to make merge into sphinx_rtd_theme theme, but the time pass and these changes dont work again because it is out of date with the base branch, then it will need to give it time and write the code for it can be accepted and merged, I hope in the next weeks dedicate time to this update this improvement. P.D .: Really I hope in this time, the imporvements can be pass and merge more faster that in the past. |
For me, the main problem holding this PR back is the documentation. Frankly, it's too dense of a guide for our package. I don't think we need this amount of depth in our own documentation. Here's Sphinx's contributor guide for comparison: I'd prefer if ours was similarly brief and easy to digest, otherwise folks won't know what to do with translations (myself included). I understand that maybe a guide that is sufficiently thorough is missing from the Babel community, but I don't think this package is the place to explain these concepts. Ultimately, Read the Docs uses Transifex for all of our translations, and we'll move this package into our Transifex pattern as soon as it's ready. This masks the need to know how gettext tooling works under the hood -- including We'll have more time scheduled towards this and Sphinx 2 compatibility next month, but I can say that I'm 👍 on babel usage and most of the changes here. For me, it's simply the documentation where I get lost at and a bit overwhelmed. If we can dial this PR back on docs, this PR will be about ready to merge. And thanks @macagua for sticking with this PR! I'm sorry this has been mostly off our roadmap for a long while, but we'll get back to guiding this a bit more as we focus on Sphinx 2 compatibility. |
This builds on top of #405, addressing the outstanding review feedback. It: * Moves workflow to our standard Transifex workflow, drops recommendation for running babel commands by hand * Configures Transifex * Moves all of the commands needed to maintain translations into Grunt * Sets up docs for translation testing * Covers installation in docs better * Drops recommendation for installation through submodules * Drops superfluous translation documentation * Cleans up some of the code * Updates a lot of related documentation * Updates files at Transifex and brings in full translations back to the translation files in the repository
This builds on top of #405, addressing the outstanding review feedback. It: * Moves workflow to our standard Transifex workflow, drops recommendation for running babel commands by hand * Configures Transifex * Moves all of the commands needed to maintain translations into Grunt * Sets up docs for translation testing * Covers installation in docs better * Drops recommendation for installation through submodules * Drops superfluous translation documentation * Cleans up some of the code * Updates a lot of related documentation * Updates files at Transifex and brings in full translations back to the translation files in the repository
This work was merged in #793 🎉 Thanks again to @macagua for the effort and guidance on this, I'm quite happy with the pattern and I think Babel finally makes sense to me. This is now also a reproducible pattern for some of our other packages. If you are interested in translating, be sure to visit https://www.transifex.com/readthedocs/sphinx-rtd-theme We're happy to have translators and reviewers added to teams there and the number of strings to translate is very manageable. |
How do I configure my project to use the translation feature mentioned in this issue? I have my It still shows up like this:
But I was expecting something like this:
However, some of the content is translated (I guess what is not in the theme but in Sphinx itself is being translated). Can someone help a poor soul? |
Hey, Nicolas, it seems my answer from May 2019 still holds true:
I guess it did not work with the theme part for you, because there is no Portuguese translation folder, neither Hope that helps! |