-
-
Notifications
You must be signed in to change notification settings - Fork 82
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
Enhancement: Support for subfolders for locale content #756
Comments
I'd recommend that the locale codes be configurable rather than hard wired into Front Matter as I've found that different tools and deployment environments will use slightly different locale codes. Also a given project may only wish to support a limited list of languages and locales. |
Internationalization/multilingual content has been on the list for a long time; also a discussion was created a while ago: #527 The biggest challenge is that we will have an opinion on how this content needs to be created in separate folders or linking pages in the front matter are my preferred options. In Astro, the following structure is used for internationalized content:
The default content is created on the root of the How it could work in Front Matter CMSConfigurationFirst, on the page folder level, I'm thinking of adding a new property that allows you to define the root locale folder and content: {
"frontMatter.content.pageFolders": [
{
"title": "posts",
"path": "[[workspace]]/src/content/posts",
"defaultLocale": true
}
]
} For the other languages, the easiest option is to add a new setting where you can define the locales: {
"frontMatter.content.i18n": [
{
"title": "German",
"locale": "de",
"folder": "de"
},
{
"title": "Nederlands",
"locale": "nl",
"folder": "nl"
}
]
} In this setting, you can define any locale like you suggested (the How it worksOnce you've configured it, the flow will be as follows:
What do you think about this approach? |
Todo
|
I suspect other Front Matters users will wish to make different choices on i18n folder structure to the one recently added by Astro. In my case, I've built a multi-lingual site that needs to put translated content in Another important reason I can't put are I use Front Matter to edit .mdx and .md files structured like so ...
|
@tohagan this will be supported. There will be a global i18n setting (as defined above), or you can define it on page folder level. Here is an example I'm currenlty testing: {
"frontMatter.content.pageFolders": [
{
"title": "EN post",
"path": "[[workspace]]/src/content/posts/en",
"contentTypes": [
"simple"
],
"defaultLocale": "en",
"locales": [
{
"title": "English",
"locale": "en"
},
{
"title": "German",
"locale": "de",
"path": "../de"
},
{
"title": "Nederlands",
"locale": "nl",
"path": "../nl"
}
]
}
]
} |
That will also be the goal. Have the ability to see all or just one language. |
Awesome! I have a non-tech volunteer assisting my current project. Front Matter will be extremely useful to help him contribute and not get lost in the Astro jungle. You might even inspire me to open source the auto-translation engine I've developed that incrementally translates |
I think you'd want it to be part of the filter (Option B) as that gives the user the most feature richest solution. In my case, I'd want to combine a filter of Language + Type when selecting the initial post to edit. Now .. once you've selected and opened a post in the markdown editor; I think you then want a way to switch languages without having to go back to the filtered cards. To support side by side review/editing, a user could open side-by-side panels in VSCode but the downside of that is that you'd then need to repeatedly find and select the same post in each of the two panels which you'd want to avoid. One idea I had was that editor included dropdown list of languages that supported multi-selection (or limit to 1, 2 maybe 3 selections). Drop down label needs to hint at this so it's discoverable. You might come up with something better. Finally a translation reviewer/editor would likely want to preview all the filtered posts from the editor. To do this, the editor toolbar might have |
In the latest beta, the multilingual features are now available. Information on how you can configure and use it can be found in the beta version of the docs: https://beta.frontmatter.codes/docs/content-creation/multilingual In case of questions, feel free to reach out. |
I have another suggestion that would simply the paths. If you make the path default to "./locale" then you can use this configuration that sets the root path to be For my case I now no longer need to set the For the the one added by Astro, most locale folders will be correct with the exception of English which would have path "." . For the example in your docs ...
|
The translation engine I've built supports multiple translation APIs. I've added Google and Azure APIs but if I was doing European languages then I'd add DeepL of course. Google Translation has the downside that you're required to include attribution and is twice the price of Azure. I have rules to parse MD and MDX files and selectively translate front matter YAML attributes + I have a couple of custom components related to my specific needs that are locale aware. |
As you suggested, I changed the logic of the paths. The documentation has been updated. |
Azure Translation Service is also on the list, not yet sure if it will make it into the current release. DeepL is used as the first integration sample, can be expanded in the future or with custom scripts. |
I was waiting for this moment for a looooong Time... I am use GitLocalize for my new projects.. And 5 days ago sync your CMS with Obsidian, and its working well (with frontmatter plugins and excalidraw). Thank you for awesome work!! |
Is your feature request related to a problem? Please describe.
I'm creating web sites that will support content translation with posts and other content types that each have a subfolder for each locale supported. For example ...
content/posts/en
content/posts/de
content/posts/de_CH
Describe the solution you'd like
I like to be able to specify that a Front Matter
pageFolder
contains locale specific subfolders. I'd like to then select a locale in the Dashboard to list, create and edit content in corresponding locale subfolders.Describe alternatives you've considered
I know there is some support for subfolders but after the reading the documentation I'm a bit confused about how this might be used for this common scenario. If that can be used instead then perhaps it needs a recipe in the documentation.
The text was updated successfully, but these errors were encountered: