You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Marcel needs to be built with multi-language websites in mind. Some things that need to be translated:
the website's content
strings in templates
date formats
what else?
Configuring languages
In marcel.config.js:
languages: ['en','ro'],defaultLanguage: 'ro'
Translating content
Translations of content are linked together by sharing the same file name and location in the content folder. They are distinguished by separate language suffixes.
content
- my-post.ro.md
- my-post.en.md
These two refer to the same post. The language code suffix is ignored when generating the slug.
What if one of the languages needs a different slug? It can be overriden in the post's front matter (the slug property).
Generating permalinks for content
One idea from WordPress-land is to have urls in the form:
That is, the defaultLanguage does not include the language code in the URL, while others do.
Note: It should be possible to override the permalink scheme for multi-language content.
Translating strings
This will probably require two things:
a dictionary (keep separate files in a language folder?)
a filter in the nunjucks templates
How does the filter look?
<ahref='#next'>{{"Next" | translate}}</a>
If no string is found in the dictionary for the current language, the string is rendered as-is.
Links to translated content
The templates should have access to a languages object that contains an array of all available languages.
Should the post object be augmented with a translations property that holds the equivalent posts? (Full objects, so you have access to title, content, permalink etc.)
The text was updated successfully, but these errors were encountered:
Marcel needs to be built with multi-language websites in mind. Some things that need to be translated:
Configuring languages
In
marcel.config.js
:Translating content
Translations of content are linked together by sharing the same file name and location in the
content
folder. They are distinguished by separate language suffixes.These two refer to the same post. The language code suffix is ignored when generating the slug.
What if one of the languages needs a different slug? It can be overriden in the post's front matter (the
slug
property).Generating permalinks for content
One idea from WordPress-land is to have urls in the form:
That is, the
defaultLanguage
does not include the language code in the URL, while others do.Note: It should be possible to override the permalink scheme for multi-language content.
Translating strings
This will probably require two things:
language
folder?)How does the filter look?
If no string is found in the dictionary for the current language, the string is rendered as-is.
Links to translated content
The templates should have access to a
languages
object that contains an array of all available languages.Should the
post
object be augmented with atranslations
property that holds the equivalent posts? (Full objects, so you have access totitle
,content
,permalink
etc.)The text was updated successfully, but these errors were encountered: