On Tue, 6 Oct 2020 at 18:50, Anton Shepelev <[email protected]> wrote: > > Hello, all > > Since Nikola supports the maintenance of several parallel > translations of a website, most of its generated and fixed > text can be kept in several languages. But have not found a > way to translate tags and categories. Is it possible, for > example, always to specify categoties in English: > > category: cats > > but have them translated into specific languages, based on a > dictionary supplied in conf.py?
This is currently not supported, but you can implement something like this manually. 1. Put your translations in CATEGORY_TITLES. 2. Add the translations dictionary to GLOBAL_CONTEXT (eg. name it 'translated_categories') 3. When displaying tags on the post page (and in other places where you need the translation visible), instead of displaying the tag name directly, use translated_categories[category] This feature could also be implemented in nikola/plugins/task/tags.py, with a different implementation of get_classification_friendly_name. We could take a PR to make tags and categories translatable using this method and conf.py. (Note that this does not affect the URLs, that would require much more work.) -- Chris Warrick <https://chriswarrick.com/> PGP: 5EAAEA16 -- You received this message because you are subscribed to the Google Groups "nikola-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/nikola-discuss/CAMw%2Bj7KQW_Zrq%3Dx_Czq9qfWnWfKHM_jDPjKvT0ozzAwzM3DXZg%40mail.gmail.com.
