getnikola / plugins

Extra plugins for Nikola
https://plugins.getnikola.com/
MIT License
56 stars 92 forks source link

[static_comments] localization messages #304

Open schlatterbeck opened 5 years ago

schlatterbeck commented 5 years ago

The documentation mentions that for static comments some localization messages are necessary:

"Finally, you need to add support for some additional messages."

but fails to mention how and where to add them. I also didn't find a pointer in the nikola handbook. My current solution was to remove the localization from the jinja template.

Otherwise: Thanks for the good work, I was able to convert an existing WP blog with all comments.

felixfontein commented 5 years ago

If you have your own custom theme, you can add the messages to the theme's translation files ($theme/messages/messages_XX.py). If you're not using your own theme, I think there was a way to directly add messages by creating a messages directory in your blog's source directory, but I've never used that feature and it doesn't seem to be documented. @Kwpolska does this feature actually exist?

Kwpolska commented 5 years ago

I think it looks in the theme only.

schlatterbeck commented 5 years ago

Is there an example somewhere in what format this needs to be added? A pointer to relevant Babel documentation (I see that the project is using Babel but have never used it myself) would be fine.

Thanks Ralf Schlatterbeck

felixfontein commented 5 years ago

The project doesn't use babel, or at least not for translations. Translations have to be available in the theme folder(s) in messages/messages_XXX.py, i.e. these must be valid Python files with XXX being the locale. See here for some examples: https://github.com/getnikola/nikola/tree/master/nikola/data/themes/base/messages

The easiest way to add translations is probably to create a "dummy" theme which inherits from the theme you're using, and add translations there (and add nothing else). You don't have to provide all translations, Nikola will go through the theme chain and load all missing translations from the themes lower in the chain...