Sep 20, 2014 Schlagwort: Ablog

More on ABlog Internationalization

Let me explain that Per Page Internationalization for ABlog proposal a bit more.

Bemerkung: This post is marked as :language: de in the post directive on purpose just to demonstrate that the builtin Sphinx text constants are translated to german in this case. Therefore you see “Schnellsuche” instead of “Quick Search” in the sidebar.

Geändert am Sep 27, 2014: :language: de is now given in the document metadata

Let me explain that Per Page Internationalization for ABlog proposal a bit more.

The basic level is the default: Sphinx does no translation at all. It simply uses the builtin english text snippets like “Search”, “Next”, “Previous” and so on.

The next level is: You tell Sphinx to use a translation of those snippets. You do so by adding - for example - language=de to the settings in That’s great, but you can only specify one language which will then be applied to all pages and all posts. What if only some pages and some posts have a different language?

Level three: The proposed additions aim at solving this problem. And they shouldn’t affect standard behaviour otherwise. We are adding the feature: Translate builtin text constants to another language on a “per post” or “per page” basis.

Posts: This post has german text snippets in the sidebar because the post directive has option :language: de. You may want to inspect the page source?

Pages: Other pages in this project I want to be in german. But they aren’t posts. That’s where Sphinx’s ability to handle file-wide metadata comes in. Look at page Über and watch the source. The sidebar text snippets are german because :language: de is given in the page source prior to the document title. That’s the way file-wide metadata is set up.

“Level four” of translation abilities would have something to do with translating the contents of posts and pages. That would be more than I need at the moment and I don’t have a clue yet of how it should work. But noticing configuration option gettext_compact tells me that others already do exactly that.

Vorheriges Thema

Per Page Internationalization for ABlog

Nächstes Thema

Strict Standards Trouble




Neue Einträge

Diese Seite