What would be the recommended implementation for internationalization #28
-
Looking at implementing this, but we leverage Next's built in internationalization support - so when creating content for a blog, would need to be able to specify the locale End result is the ability to publish English articles to the US locale, French to the FR locale. Any ideas on how that might be possible with the existing implementation? |
Beta Was this translation helpful? Give feedback.
Replies: 7 comments 16 replies
-
Hi @tiniscule, For now there's no support for i18n, and I haven't given much thought about how to implement it. But here are a couple of quick suggestions:
The project is still in its infancy and there are a lot of features on the roadmap. Internationalization should come at some point in the near future. |
Beta Was this translation helpful? Give feedback.
-
We used to use Netlify CMS. However, we have migrated to Vercel since and are looking for alternatives. Outstatic looks great, but we need i18n support. Setup
OST_LOCALES=en,pl # Specify supported locales with a comma-separated list. If empty, localization is not supported.
Changes in the UI
|
Beta Was this translation helpful? Give feedback.
-
Hi @DCzajkowski thanks for the suggestions. I am not familiar with Netlify CMS, but should definitely check it out to try getting some ideas. The concept you are proposing is cool, although I have a couple of concerns. First, I think i18n is something a minority of users will require. And for this reason, the feature and UI changes, should only be available to those who decide to add the Second, as of now, we don't have pagination/sorting inside the dashboard, which is something I definitely want to add in the future. As for the side-by-side editor. I think this one would be tricky to implement and would require some decent refactoring of how our editor currently works, but it could be done. That being said, what I ideally would like to do with Outstatic, is to create an architecture that would allow extensions/plugins. So that these features can be added on a per install basis and not be part of the core system. These are my 2 cents. Let me know what you think. |
Beta Was this translation helpful? Give feedback.
-
I think one of my concerns with the Netlify approach is that it assumes translation instead of localization a bit (one-to-one posts across languages). I'd also be a bit concerned with impact to the existing interface - though I don't necessarily agree that it's a small use case. It always seems that way until you hit it, which is why you'll notice Next advertises it first class on their features. The approach i was thinking was something along the lines of:
The thinking here is that all of this fails gracefully when not in use, but is available when needed. Also shares the majority of the arch you'd expect for something like tags or other filters down the road. |
Beta Was this translation helpful? Give feedback.
-
I think you've got a solid idea w/ the filesystem as the source of truth and agree that's probably beyond the current scope. Plus, once the content is no longer readable / editable text files, the value of outstatic living in GitHub is diminished.
To @tiniscule's comment, the least prescriptive solution is likely just subfolder support. We even have that proposed with It also means developers are free to opt in to Next's locale support or control the experience manually. |
Beta Was this translation helpful? Give feedback.
-
Hey all, chatted a bit with @avitorio about how we get to i18n, and wanted to share the current thinking with everyone. This will be a bit of a long reply since it includes what you can do today, some of the prerequisite technology & features we need for a seamless i18n experience, and some thoughts about how it will hypothetically work once some of the other infrastructure is in place. The today case: 1 Collection Per LanguageThis is the original proposal by avitorio in this discussion. It's not an ideal solution, but it is forward compatible. Using this method, you will only be able to have a single content "type", but you can begin using it today for internationalization if your goal is an i18n-backed blog or other single-content-type.
The remainder of this post is about the path forward, so for those who need a quick answer, you're set. 🎉 Looking ForwardOutstatic's strength is the limited primitives that exist. At it's core, Outstatic is a filesystem CMS backed by git and GitHub and with Using these terms, internationalization isn't a folder structure, it's metadata about a file. In a given collection, this post happens to be in french For each of these steps, there's also a bulleted list of the kinds of things you can do w/ each feature in addition to the eventual goal of i18n content. Feature: Custom Fields (near future)Custom fields allow you to add additional structured data to a post's frontmatter. The current thinking is that each collection has an optional
avitorio's been working on this, and it also happens to be a good first step towards i18n. Using even these basic primitives, we can express what locale a post is written for by adding a Feature: Metadata "DB" (future)Metadata in individual posts is great, but it isn't useful at scale for querying. With even a few dozen files, reading each off the FS and doing a yaml parse on the frontmatter (per lambda) becomes very cumbersome. Categories, tags, and even i18n benefit from a queryable data store. Instead, it's useful on save to sync the post's frontmatter into some DB-like solution and provide a queryable interface that can be used in
Because post files remain the source of truth, this db-like metadata system is altered, regenerated, or rebuilt on saves and commits. Ideally it's a single file or a single file per collection, following the custom fields design. Adding this when custom fields are done will make a "true" i18n design possible since custom metadata (ie Feature: Lifecycle Hooks & Plugins (far far future... like v2 future)This isn't a hard requirement for i18n, as we can get a basic i18n implementation with the above two features. However, avitorio would love to eventually support plugins, and I agree; the ability to quickly add 3rd party comment systems such as disqus or webmentions, trackbacks, contact forms, etc is incredibly powerful. However, if we'd like to maintain relations between a primary post and its secondary translated posts, we'd want a more modular way to do this
Existing outstatic features that are currently hardcoded can be added to these lifecycle hooks or even swapped out if someone has a custom install that needs really elaborate things. It would also allow us to split i18n off into a dedicated plugin which folks could enable (adding a required Getting ThereOf course, in addition to these 2-3 features, we also need to improve our testing infrastructure, add some CI/CD work, and have confidence that these features won't break or corrupt existing installs. That's where everyone can truly help. avitorio will have a pinned issue soon with some roadmap work, and I know that testing is top of mind for him. If you can identify areas where we can add tests and build robustness into outstatic, those PRs would be massively appreciated. ❤️ |
Beta Was this translation helpful? Give feedback.
-
Hello everyone, The answer from @jakobo is really promising, but I feel we are forgetting about i18n for Outstatic itself, not just the content. This is also related to #54 because we need to identify and properly separate logic from what is presented in the UI. Some sites may not be multilingual, but may be in another language different than English, so Outstatic should be able to be configured to display all the functionality in that language. We should also consider that the UI may be in a multilingual site and the how that affects the interface. Should an English content mantainer only see English content in the English UI, i think not. That should be the default, but someone may need to update some external link in all language versions for the same collection entry. And not force that user to press Spanish buttons for the Spanish UI. Has someone experience in that kind of i18n? |
Beta Was this translation helpful? Give feedback.
Hey all, chatted a bit with @avitorio about how we get to i18n, and wanted to share the current thinking with everyone. This will be a bit of a long reply since it includes what you can do today, some of the prerequisite technology & features we need for a seamless i18n experience, and some thoughts about how it will hypothetically work once some of the other infrastructure is in place.
The today case: 1 Collection Per Language
This is the original proposal by avitorio in this discussion. It's not an ideal solution, but it is forward compatible. Using this method, you will only be able to have a single content "type", but you can begin using it today for internationalization if your goal …