-
Notifications
You must be signed in to change notification settings - Fork 169
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
Translation #419
Comments
I am a Python developer myself, so I assume I would be able to contribute to the project, but I would like to have a better understanding of what is the best approach to take. |
I would like to be able to have in my index.md files values like: title: My album
title_ru: Мой албум I was able to translate my whole project this way, apart from the breadcrumb, for which I had to add a new property like this: def breadcrumb_albums(album: Album):
"""
Builds a breadcrumb list of (url, album_info) for the underlying album
"""
if album.path == '.':
return []
path = album.path
breadcrumb = [((album.url_ext or '.'), album)]
while True:
path = os.path.normpath(os.path.join(path, '..'))
if path == '.':
break
url = (url_from_path(os.path.relpath(path, album.path)) + '/' + album.url_ext)
breadcrumb.append((url, album.gallery.albums[path]))
breadcrumb.reverse()
return breadcrumb
def build_sigal():
Album.breadcrumb_albums = property(breadcrumb_albums)
gallery = Gallery(conf)
gallery.build() So I basically add a {% for url, parent in album.breadcrumb_albums %}
<a class="breadcrumb-link" href="{{ url }}">
<span class="translation translation-ru"> / {{ parent.title }}</span>
<span class="translation translation-en"> / {{ parent.meta.title_en | first }} </span>
</a>
{% endfor %} I hope this helps anyone else that would like to have his gallery translated |
Glad that you found a solution. I'm not sure exactly what should be done in sigal to support this better. It might be interesting to look at other projects like pelican, which has been a great inspiration when I started sigal. |
Well, I would say sigal almost supports in-browser translations already through the Jinja templates. The only thing I had to do is to create this |
Yes, passing the album object directly to the template seems a useful change. |
Hello dear all
This is kind of a feature request, but I am afraid I am not able to fully specify it, yet...
I would like to have my gallery supporting two languages. More precisely, if I want to have Russian language for example, I would like to be able to have in my
index.md
files values like:I imagine for every album there would be a file
index.html
and alsoindex_ru.html
I do not imagine yet how to enable switching the displayed language... Any idea would be appreciated.
The text was updated successfully, but these errors were encountered: