Closed larihuttunen closed 2 years ago
Hi @larihuttunen what exactly do you mean by "top navigation". Navigation is handled by Hugo menu feature. I see some localization though where the type is used:
[whatsInThis]
other = "What's in this {{ .Type }}"
I understand this is problematic but is this what your ticket is about? And am I missing other locations it occurs?
Hi @regisphilibert, what I mean that Ananke theme is a blog theme consisting of posts, which are handled in a specific way in templating. Starting out I created a content directory for the English language content/en/post/
, which works as intended and rendered as posts in the top navigation. If I create a Finnish content directory content/fi/kirjoitukset
, this will be shown as kirjoituksets in top navigation where the templating adds an s to denote the plural.
What I would like to have is retain the content directory name as conten/fi/post
, but have the ability to localize how that is displayed for a given language. I was looking at layouts/index.html
and layouts/partial/site-navigation
but couldn't spot where this pularalization takes place.
So in summary, it would be nice if the content directory for blog posts in different languages could be retained as cc/post, but at the same time have the ability to localize the link text pointing to that directory in the navigational layout elements, such as the top navigation.
Hopefully this clarification helps understand what the problem is...
Yes I understand better how. I'll look into it. Thanks.
So this "plural" version is just the name of the section. So if you add an _index.md
file to content/fi/post
with a title, this is what will be printed on the home page.
# content/fi/post/_index.md
---
title: kirjoitukset
If you really need that directory name to be different than post
, you can do the following:
_index.md
to content/fi/kirjoitus
.post
so Ananke will using the proper post
templates. You can use cascade for this:
# content/fi/kirjoitus/_index.md
---
title: kirjoitukset
cascade:
type: post
---
kirjoitukset
(so its listed on the homepage)
mainSections:
- kirjoitus
@regisphilibert Thanks for looking into this. That really helps! In a sense it is just the user not understanding how to use the system kind of a problem. :)
i18n is missing the possibility to redefine the top navigation item post to something that makes sense in a given language because it assumes that a plural is formed by adding an "s" after the given term in singular.
EXAMPLE: post -> posts, which works in English. EXAMPLE: kirjoitus -> kirjoitukset in Finnish, which doesn't work with the current logic, since a plural is never formed by adding an "s" to the singular form in Uralic languages.
Even if you were to use a loan word from English, such as postaus in singular, the plural form in this case would be postaukset not postauss.
What I mean is that the URL part can be static for example /fi/post/article-name but the navigation item should be possible to translate in the WEB UI, where the top navigation would show Kirjoitukset for example for the Finnish translation instead of the default Posts. At present, a post content directory named kirjoitukset would be rendered as Kirjoituksets in the top navigation, which doesn't work.
Could this be fixed in templating, please?
My PR #493 sidesteps this issue to a point, but the top navigation item would need to be fixed as well. This is related to issue 496 as well.