Replies: 1 comment 4 replies
-
Here's a solution I shared previously: #9947 (comment) I use it on my own website and plan to provide first-class feature for this in the future: https://thisweekinreact.com/fr/newsletter/187 The implementation is a bit weird atm but here's what's working for me: {
markdown: {
parseFrontMatter: async (params) => {
// Reuse the default parser
const result = await params.defaultParseFrontMatter(params);
const isPartial =
params.filePath.includes("/_") || params.filePath.includes("\\_");
if (isPartial) {
return result;
}
// TODO fix weird undefined case!
const isDefaultLocale =
process.env.DOCUSAURUS_CURRENT_LOCALE === "undefined" ||
typeof process.env.DOCUSAURUS_CURRENT_LOCALE === "undefined" ||
process.env.DOCUSAURUS_CURRENT_LOCALE === "en";
const isI18n = params.filePath.includes("/i18n/");
if (isDefaultLocale) {
result.frontMatter.isTranslationMissing = false;
} else {
result.frontMatter.isTranslationMissing = !isI18n;
}
return result;
},
}, |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In Docusarurus, i18n pages that are not yet translated (and without the corresponding file) are filled with the content of the default language. I'd like to know if it is possible to display a banner ("Under translation") on the top of the page in such situations, probably with swizzling.
Beta Was this translation helpful? Give feedback.
All reactions