Closed sangeren closed 5 years ago
所有文字内容都可以这样,不仅是关于中文版这里。
原理很简单:在编译 markdown 时把中英文对调并标上 translation-result 和 translation-origin 属性,用 css 隐藏 translation-origin。当用户点击 result 时就找到相应的 origin ,并显示它。
其实现代码都在 aio 分支下。代码可能也就一两百行吧。
另外,如果你的是 gitbook 书籍,可以使用 gitbook-plugin-translator,那是抽出的对照翻译核心。
我看了“关于中文版”,发现点击可以查看原文, 想问下这个是怎么实现的谢谢了!