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

Improve multi-language support #30

Closed
wants to merge 0 commits into from
Closed

Conversation

jaxter184
Copy link

Adds a language menu and fixes #18 (menu item behavior for non-default languages). Functionality and implementation roughly based on Papaya.

Fully backwards compatible. To fix #18, add trans_key = "abc" to the extra.after_dark_menu list and abc = "xxx" to each language's translations list.

@@ -5,7 +5,7 @@
{{ super() }}
{% endblock header %}

<h1>Tags</h1>
<h1>{% if config.extra.after_dark_multilingual %}{{ trans(key="tags", lang=lang) }}{% else %}Tags{% endif %}</h1>
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The config.extra.after_dark_multilingual flag is only here for backwards compatibility. If breaking existing configurations is OK, or if there is a way to check if a translation key exists, the flag can be removed.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you can just check config.language | length, if it's more than 1 then it's a multi-language site?

@jaxter184
Copy link
Author

Hmm, I thought it was backwards compatible, but it looks like its not, maybe because the current config has no default_language key? Not sure.

@Keats
Copy link
Collaborator

Keats commented Jul 4, 2022

Configs should always have a default_language set (or it's only in the next version of Zola, I'm not sure)

@jaxter184
Copy link
Author

Not sure what I did to close the fork 🙃

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multilingual menu
2 participants