Marcel needs to be built with multi-language websites in mind. Some things that need to be translated:
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:
http://mysite.com/posts/my-post
http://mysite.com/en/posts/my-post-in-english
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:
How does the filter look?
<a href='#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.)
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
contentfolder. 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
slugproperty).Generating permalinks for content
One idea from WordPress-land is to have urls in the form:
That is, the
defaultLanguagedoes 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:
languagefolder?)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
languagesobject that contains an array of all available languages.Should the
postobject be augmented with atranslationsproperty that holds the equivalent posts? (Full objects, so you have access totitle,content,permalinketc.)