I've built a XLIFF transformer for Docusaurus i18n #10443
anatolykopyl
started this conversation in
Show and tell
Replies: 2 comments 3 replies
-
That looks like a really cool idea! I wonder if it can be supported by the Docusaurus MDX loader. |
Beta Was this translation helpful? Give feedback.
3 replies
-
That's a pretty cool technique, thanks for sharing it 👍 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
It's called mdx2xliff.
After countless problems with machine translation breaking MDX syntax, I've decided to go with an another approach, than the one described in the docs.
Instead of uploading whole files to Crowdin or any other translation service, I first split the file into two parts:
This is actually not an uncommon approach. Almost every translation service accepts XLIFF files, including Crowdin.
Now I hand the XLIFF file to whatever service is responsible for i18n (Crowdin for example). After the translation is done, I use my tool to do the reverse operation and reconstruct MDX files from existing skeleton files and translated XLIFFs.
The main benefit of this way of translating is that you never let the translation service touch any code, only the text that needs to be translated.
This has resulted in a completely bug-free translation pipeline. There is a drop in the quality of the translation, but I’d take it over having to fix hundreds of compile breaking errors any day.
For example, a file like this:
Will be split into a XLIFF file:
(simplified for brevity)
And a SKL file:
We feed the XLIFF into Crowdin and never have to deal with DeepL messing up our URL, for example.
Beta Was this translation helpful? Give feedback.
All reactions