Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[static_comments] localization messages #304

Open
schlatterbeck opened this Issue Apr 14, 2019 · 4 comments

Comments

Projects
None yet
3 participants
@schlatterbeck
Copy link

schlatterbeck commented Apr 14, 2019

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

This comment has been minimized.

Copy link
Contributor

felixfontein commented Apr 14, 2019

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

This comment has been minimized.

Copy link
Member

Kwpolska commented Apr 14, 2019

I think it looks in the theme only.

@schlatterbeck

This comment has been minimized.

Copy link
Author

schlatterbeck commented Apr 15, 2019

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

This comment has been minimized.

Copy link
Contributor

felixfontein commented Apr 15, 2019

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.