Skip to content

Add localization language support #403

Closed

Description

@macagua

Hi guys

Is possible to add localization language support? because the footer templates are in English, but my Sphinx project is about Spanish documentation

Here I see that the templates have i18n support, but it's don't have locales directory for localization, for example Spanish language
https://github.com/rtfd/sphinx_rtd_theme/blob/master/sphinx_rtd_theme/footer.html

Any idea ?

Activity

  1. ericholscher commented on Mar 24, 2017

    @ericholscher
    Member

    I'm not 100% sure how to actually translate Sphinx themes. I believe it should use the same i18n infrastructure as Sphinx itself, but haven't done the research on it. This would be a great place for contribution and having folks who care about keeping the theme translated as part of our core team, if you're curious of a good way to contribute!

  2. mitya57 commented on Mar 24, 2017

    @mitya57
    Contributor

    I can share the steps I was using in our project:

    • Install babel from PyPI.
    • Create file babel.cfg (in this repository) with this content:
      # Extraction from Jinja2 HTML templates
      [jinja2: **/**.html]
      encoding = utf-8
      ignore_tags = script,style
      include_attrs = alt title summary
    • Add this to setup.cfg:
      [extract_messages]
      mapping_file = babel.cfg
      output_file = sphinx-rtd-theme.pot
      keywords = _ l_ lazy_gettext
    • Run python setup.py extract_messages to generate sphinx-rtd-theme.pot.
    • Create the .po file for your language using msgmerge tool (I think you can use Babel if you prefer).
    • Translate it using your favourite application (i.e. gtranslator).
    • Place the translated .po file in your project as locale/$LANG/LC_MESSAGES/sphinx.po.
    • Add locale_dirs = ['locale/'] to your project’s conf.py.
  3. macagua commented on Mar 24, 2017

    @macagua
    ContributorAuthor

    @mitya57 you are the man really thanks! 🍺

  4. macagua commented on Mar 24, 2017

    @macagua
    ContributorAuthor

    @ericholscher then I fork this repo, add support for localization language following the @mitya57 guide and return this improvement via a pull request!!!

  5. Blendify commented on Mar 31, 2017

    @Blendify
    Member

    @macagua any update on this?

  6. macagua commented on Apr 1, 2017

    @macagua
    ContributorAuthor

    @Blendify yes, please check out #405

  7. added this to the milestone on Aug 7, 2017
  8. modified the milestones: v0.4.0, on Jun 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ImprovementMinor improvement to code

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions