Open srid opened 6 months ago
I have started trying, and it's working well, but there are still some feature I'm unsure how to fulfill.
Temporary preview: nix run github:brsvh/nixos.asia/l10n/zh-Hans#preview -- -o /zh-Hans
- How do I switch languages? I have looked at emanote and it appears to lack such a component, it seems we need to implement an additional language switching component.
- How should I go about localizing some UI interfaces? For example, the "Home" navigation in the sidebar, the "Links to this page" text in the area displaying all folgezettel links, and most of the tooltips.
I think this can be summarized as two other questions:
For the former, I want to try to make the default theme of emanote get better template generation capabilities based on language tags. I have created a discussion.
For the latter, I know that I can get them through the user's browser environment navigator.language
, navigator.browserLanguage
or system environment. It seems that it can be done by additional JS, but I'm not quite sure about doing it entirely in the template.
But in any case these problems do not affect the translation of existing articles.
It seems like we can't maintain a consistent directory structure across languages. I always catch duplicate errors for backlinks.
...
[Info#ema.generate] W /nix/store/xq8m44y0fprp8m9sa5xlfd8b4j80n8y0-emanote-static-website/en/tutorial.html
[Info#ema.generate] W /nix/store/xq8m44y0fprp8m9sa5xlfd8b4j80n8y0-emanote-static-website/en/tutorial/nixos-install.html
[Info#ema.generate] W /nix/store/xq8m44y0fprp8m9sa5xlfd8b4j80n8y0-emanote-static-website/en/configuration-as-flake.html
...
[Info#ema.generate] W /nix/store/xq8m44y0fprp8m9sa5xlfd8b4j80n8y0-emanote-static-website/zh-Hans/tutorial.html
[Info#ema.generate] W /nix/store/xq8m44y0fprp8m9sa5xlfd8b4j80n8y0-emanote-static-website/zh-Hans/tutorial/nixos-install.html
[Info#ema.generate] W /nix/store/xq8m44y0fprp8m9sa5xlfd8b4j80n8y0-emanote-static-website/zh-Hans/configuration-as-flake.html
...
[Warn#emanote] Ambiguous link: Left R[/en.md] -> URTWikiLink (WikiLinkBranch,[[tutorial]]) ambiguities: "en/tutorial" :| ["zh-Hans/tutorial"]
[Warn#emanote] Ambiguous link: Left R[/en/nixos.md] -> URTWikiLink (WikiLinkNormal,[[nixos-install]]) ambiguities: "en/tutorial/nixos-install" :| ["zh-Hans/tutorial/nixos-install"]
[Warn#emanote] Ambiguous link: Left R[/en/tutorial/nixos-install.md] -> URTWikiLink (WikiLinkEmbed,[[configuration-as-flake]]) ambiguities: "en/configuration-as-flake" :| ["zh-Hans/configuration-as-flake"]
[Warn#emanote] Ambiguous link: Left R[/zh-Hans.md] -> URTWikiLink (WikiLinkNormal,[[tutorial]]) ambiguities: "en/tutorial" :| ["zh-Hans/tutorial"]
[Error#emanote] Found 4 broken links! Emanote generated the site, but the generated site has broken links.
If I use the new directory structure (Chinese names), everything works fine.
tree zh-Hans
zh-Hans
├── 教程
│ ├── nixos-安装
│ │ └── 使用flake进行配置.md
│ └── nixos-安装.md
└── 教程.md
3 directories, 3 files
I think inconsistent naming with the original files is bad, do you have any suggestions?
@brsvh Yea, I noticed that as well. If you use [[tutorial]]
, it will be ambiguous due to multiple languages. You can resolve that using [[en/tutorial]]
- but I don't think that's a desirable solution. I think we may have to end up having to separate Emanote sites for each language folder (assuming no interlinking between them). Let me think about it.
I have an international trip to India later this week, so I'll be slow in responding. Feel free to join our Zulip as well for interactive conversation: https://nixos.zulipchat.com/
I think we may have to end up having to separate Emanote sites for each language folder (assuming no interlinking between them). Let me think about it.
Inclined to go with this for now: https://github.com/nixos-asia/website/pull/21
Later on, when Emanote itself gets native i18n support (https://github.com/srid/emanote/issues/486) we can figure out better integration of top-level language layers in an unified single Emanote site.
https://github.com/srid/emanote/pull/498 resolves ambiguous links more sensibly, which would allow us to go back to 'singe notebook' approach. So [[foo]]
would link to [[en/foo]]
if the linking note exists in en/
even if there is zh-Hans/foo.md
.
Basic support for translation is in place. English articles are in
en/
folder. For other languages, create a similar file structure in the corresponding language folder. Translations can already happen.But the website static site generation will need to be tweaked a bit, which I'll do.
cc @brsvh for past discussion on this at https://github.com/juspay/flakular.in/issues/11
Tasks