Skip to content

Commit

Permalink
Fix sidebars ablog translations (#80) (#161)
Browse files Browse the repository at this point in the history
Co-authored-by: Luís Henriques <[email protected]>
Co-authored-by: Nabil Freij <[email protected]>
  • Loading branch information
3 people authored Nov 15, 2022
1 parent 2d30658 commit 301bb0f
Show file tree
Hide file tree
Showing 5 changed files with 142 additions and 8 deletions.
6 changes: 5 additions & 1 deletion ablog/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

from sphinx.builders.html import StandaloneHTMLBuilder
from sphinx.jinja2glue import BuiltinTemplateLoader, SphinxFileSystemLoader
from sphinx.locale import get_translation

from .blog import CONFIG, Blog
from .post import (
Expand All @@ -27,6 +28,9 @@

PKGDIR = os.path.abspath(os.path.dirname(__file__))

# name used for the *.pot, *.po and *.mo files
MESSAGE_CATALOG_NAME = "sphinx"
_ = get_translation(MESSAGE_CATALOG_NAME)

__all__ = ["setup"]

Expand Down Expand Up @@ -148,5 +152,5 @@ def setup(app):
)
pkgdir = os.path.abspath(os.path.dirname(__file__))
locale_dir = os.path.join(pkgdir, "locales")
app.config.locale_dirs.append(locale_dir)
app.add_message_catalog(MESSAGE_CATALOG_NAME, locale_dir)
return {"version": __version__} # identifies the version of our extension
Binary file added ablog/locales/pt/LC_MESSAGES/sphinx.mo
Binary file not shown.
129 changes: 129 additions & 0 deletions ablog/locales/pt/LC_MESSAGES/sphinx.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
# Portuguese translations for ablog.
# Copyright (C) 2022 ORGANIZATION
# This file is distributed under the same license as the ablog project.
# Luís Henriques <[email protected]>, 2022.
#
msgid ""
msgstr ""
"Project-Id-Version: ablog 0.10.30.dev7+g9a43710e3a7d\n"
"Report-Msgid-Bugs-To: EMAIL@ADDRESS\n"
"POT-Creation-Date: 2022-10-02 20:41+0100\n"
"PO-Revision-Date: 2022-10-02 20:41+0100\n"
"Last-Translator: Luís Henriques <[email protected]>\n"
"Language: pt\n"
"Language-Team: pt <[email protected]>\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.10.3\n"

#: ablog/post.py:271
msgid "Updated on "
msgstr "Actualizado em "

#: ablog/post.py:563 ablog/templates/ablog/authors.html:3
#: ablog/templates/authors.html:4
msgid "Authors"
msgstr "Autores"

#: ablog/post.py:563 ablog/post.py:630
msgid "Posts by"
msgstr "Entradas por"

#: ablog/post.py:564 ablog/templates/ablog/locations.html:4
#: ablog/templates/locations.html:5
msgid "Locations"
msgstr "Localizações"

#: ablog/post.py:564 ablog/post.py:631
msgid "Posts from"
msgstr "Entradas de"

#: ablog/post.py:565 ablog/templates/ablog/languages.html:4
#: ablog/templates/languages.html:5
msgid "Languages"
msgstr "Linguagens"

#: ablog/post.py:565 ablog/post.py:566 ablog/post.py:632 ablog/post.py:633
msgid "Posts in"
msgstr "Entradas em"

#: ablog/post.py:566 ablog/templates/ablog/categories.html:4
#: ablog/templates/categories.html:5
msgid "Categories"
msgstr "Categorias"

#: ablog/post.py:567
msgid "All posts"
msgstr "Todas as entradas"

#: ablog/post.py:567 ablog/post.py:634
msgid "Posted in"
msgstr "Publicado em"

#: ablog/post.py:568 ablog/templates/ablog/postcard2.html:117
#: ablog/templates/ablog/tagcloud.html:3 ablog/templates/postcard2.html:118
#: ablog/templates/tagcloud.html:4
msgid "Tags"
msgstr "Etiquetas"

#: ablog/post.py:568 ablog/post.py:635
msgid "Posts tagged"
msgstr "Entradas com etiqueta"

#: ablog/post.py:593
msgid "All Posts"
msgstr "Todas as Entradas"

#: ablog/post.py:594
msgid "All"
msgstr "Todas"

#: ablog/post.py:602
msgid "Drafts"
msgstr "Rascunhos"

#: ablog/templates/ablog/archives.html:4 ablog/templates/archives.html:5
msgid "Archives"
msgstr "Arquivos"

#: ablog/templates/ablog/collection.html:56 ablog/templates/collection.html:57
msgid "Read more ..."
msgstr "Ler mais ..."

#: ablog/templates/ablog/postcard2.html:8 ablog/templates/postcard2.html:9
msgid "Update"
msgstr "Actualizado"

#: ablog/templates/ablog/postcard2.html:20 ablog/templates/postcard2.html:21
msgid "Author"
msgstr "Autor"

#: ablog/templates/ablog/postcard2.html:44 ablog/templates/postcard2.html:45
msgid "Location"
msgstr "Localização"

#: ablog/templates/ablog/postcard2.html:68 ablog/templates/postcard2.html:69
msgid "Language"
msgstr "Idioma"

#: ablog/templates/ablog/postcard2.html:92 ablog/templates/postcard2.html:93
msgid "Category"
msgstr "Categoria"

#: ablog/templates/ablog/postcard2.html:123 ablog/templates/postcard2.html:124
msgid "Tag"
msgstr "Etiqueta"

#: ablog/templates/ablog/postnavy.html:8 ablog/templates/postnavy.html:9
msgid "Previous"
msgstr "Anterior"

#: ablog/templates/ablog/postnavy.html:22 ablog/templates/postnavy.html:23
msgid "Next"
msgstr "Próximo"

#: ablog/templates/ablog/recentposts.html:4 ablog/templates/recentposts.html:5
msgid "Recent Posts"
msgstr "Entradas Recentes"
14 changes: 7 additions & 7 deletions docs/manual/ablog-i18n.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,34 +18,34 @@ Translation process involves the following steps:

Execute extract_messages_ each time a translatable message text is changed or added::

$ python setup.py extract_messages -o ablog/locale/sphinx.pot
$ python setup.py extract_messages -o ablog/locales/sphinx.pot
...

This will create or update :file:`ablog/locale/sphinx.pot` file, the central messages catalog used by the different translations.
This will create or update :file:`ablog/locales/sphinx.pot` file, the central messages catalog used by the different translations.

2.

a. Create new translation catalog:

Execute init_catalog_ once for each *new* language, e.g.::

$ python setup.py init_catalog -l de -i ablog/locale/sphinx.pot -o ablog/locale/de/LC_MESSAGES/sphinx.po
$ python setup.py init_catalog -l de -i ablog/locales/sphinx.pot -o ablog/locales/de/LC_MESSAGES/sphinx.po

This will create a file :file:`ablog/locale/de/LC_MESSAGES/sphinx.po` in which translations needs to be placed.
This will create a file :file:`ablog/locales/de/LC_MESSAGES/sphinx.po` in which translations needs to be placed.

b. Update translation catalog:

Execute update_catalog_ for each *existing* language, e.g.::

$ python setup.py update_catalog -l de -i ablog/locale/sphinx.pot -o ablog/locale/de/LC_MESSAGES/sphinx.po
$ python setup.py update_catalog -l de -i ablog/locales/sphinx.pot -o ablog/locales/de/LC_MESSAGES/sphinx.po

This will update file :file:`ablog/locale/de/LC_MESSAGES/sphinx.po` where translations of new text needs to be placed.
This will update file :file:`ablog/locales/de/LC_MESSAGES/sphinx.po` where translations of new text needs to be placed.

3. Compile catalogs:

Execute compile_catalog_ for each existing language, e.g::

$ python setup.py compile_catalog --directory ablog/locale/ --domain sphinx --locale de
$ python setup.py compile_catalog --directory ablog/locales/ --domain sphinx --locale de

.. _extract_messages: http://babel.edgewall.org/wiki/Documentation/setup.html#extract-messages
.. _init_catalog: http://babel.edgewall.org/wiki/Documentation/setup.html#init-catalog
Expand Down
1 change: 1 addition & 0 deletions docs/release/ablog-v0.10-released.rst
Original file line number Diff line number Diff line change
Expand Up @@ -392,3 +392,4 @@ ABlog v0.10.30 released
Pull Requests merged in:

`Sort Feed posts by date <https://github.com/sunpy/ablog/pull/172>`__.
`Fix sidebars ablog translations <https://github.com/sunpy/ablog/pull/161>`__.

0 comments on commit 301bb0f

Please sign in to comment.