Closed amindWalker closed 1 year ago
This is impressive work! Though I wonder if it would be best to keep translations in separate repositories... Otherwise it might be hard for the maintainers to keep the official docs up to date, and the codebase can get crowded (especially if more languages are added).
Also, as far as I can tell, Mdbook doesn't have multilingual support yet, so the most user-friendly option we have is probably deploying a separate book for each language (otherwise, how will the users navigate it?).
@rMazeiks Yeah, I asked myself the same question but I didn't find a solution, yet. So I did translate everything to leverage my excitement haha.
But I made a research and found a few options:
mdBook
support multiple languages (don't know how long this would take)docusaurus
(probably that's what the fellows at Yew.rs are using but this approach would lose many benefits of the mdBook
)mdBook
file as @rMazeiks suggested, one for the standard guide and one for the reference guide.The last one seems the most doable right now, but I think the disadvantage would be losing the ability to diff
each new commit
to documentation adequately. Translation crates seems plausible but that's another crate to depend on.
I would definitely go for the last option if there is a green light for it. Later when mdBook
adds multiple languages support I'll redo and review all translations again.
Suggestions, toughts?
Wait for mdBook support multiple languages (don't know how long this would take)
The issue is from 2015, and the last comments (a month ago) seem to indicate that not much progress has been made. So I think self-driving cars will come first, and then i18n support for mdbook.
Use docusaurus (probably that's what the fellows at Yew.rs are using but this approach would lose many benefits of the mdBook)
The main benefits of mdBook I can think of are
Are there others? Though I personally prefer mdbook, it might indeed make sense to switch to something else to get i18n if these 4 are all we lose.
I would definitely go for the last option if there is a green light for it
Agreed, I'm curious to hear what the maintainers think.
It looks like there's already a separate website for Chinese docs (linked from the Chinese Readme), though there are some differences (look&feel, domain) โ it might be nice to introduce some consistency.
I should add that - apart I'm translating to PT-BR - I'm trying to solve translations in general for every language so it's easier for everybody to do their own translation effort.
I could translate to other languages as well, but let's solve this first.
Thank you so much for this! We've got some simple Chinese support but it hasn't been mainlined into Dioxus yet.
This is all community maintained (though the maintainer is a maintainer in the Dioxus project, it's not an official Dioxus project).
https://github.com/DioxusChina/website
My only concern is that as the docs evolve, our translations won't, and we'll need to somewhat frequently ping the original authors to get updates.
I think it would make a lot of sense to have a "translations" folder in our docs repo with different mdbooks for each language. The guide would be a bit different for each translation, but that's better than not being able to update the docs without coordinating a big effort among all the language maintainers.
There's another big docs pr open in #486 that would heavily conflict with this PR if we weren't careful with how we separated things out.
My proposal:
Eventually I'd like to build our own mdbook/docusaurs library that handles both landing page generation and docs/guidebook generation, much in the same way that docusaurus works. I have many projects I'd like to build docusaurus books for but haven't really wanted to dip back too much in the JS ecosystem.
Edit: do you mind rebasing so the merge conflicts go away? #486 has been merged, so it would make sense to pull out all the pt-br docs into their own mdbook and then drop it in a translations folder. Alongside the overhaul of dioxuslabs.com, we'll make sure to feature it prominently on the main landing page, in the guide, and on github.
Hi @jkelleyrtp ... great! @rMazeiks made a nice work! I guess we're all in accordance with the approach of merging everything in one place should be easier or at least the best option for now. I took one step further and added additional features and some fixes:
Added a README section to PT-BR language in the original README.
Unrelated to docs
files, like the README, can be placed in a translations
folder in the project's root for easy access.
Added the ability to change the Documentation's language (an ๐ icon in this case) now it's easier for everyone to add their own translations. The method consists in a custom build of a unmerged
mdbook feature from this mdBook PR: https://github.com/rust-lang/mdBook/pull/1306
The translated content should be in a folder named pt-br
, es
, en
, cn
... that goes within the src
folder of docs
. A new section must be added to the book.toml
file using this pattern: [language.cn]
or [language.pt-br]
. This will generate a book for each language in the output book folder. So if someone accidentally stumbles on Dioxus, like me ๐, and wants to translate to, let's say, Korean it would be necessary to just duplicate the en
folder, rename it to kr
and start translating.
I structured in this way trying to make it easier for newcomers (and current ones) to access and edit files. I tested some translation crates and IMO this was the easier way to solve translations for everybody.
I've found some errors related to the examples/*.rs
mdBook's pre-process like this:
2022-07-07 19:43:41 [ERROR] (mdbook::preprocess::links):
Error updating "{{#include ../../examples/anti_patterns.rs:iter_keys}}",
Could not read file for link {{#include ../../examples/anti_patterns.rs:iter_keys}} (../../examples/anti_patterns.rs)
But the HTML documentation compiles just fine.
Unfortunately, I haven't found a workaround for the default language beside defining an en
folder and [language.en]
property as well, duplicating files in the process to make it work with mdbook build
. Would it be bad if the default documentation lives within the en
folder? And by consequence delete the other files outside their correspondent folder names?
The only question left is if this whole process applies to the router
docs as well?
Hi @jkelleyrtp ... great! @rMazeiks made a nice work! I guess we're all in accordance with the approach of merging everything in one place should be easier or at least the best option for now. I took one step further and added additional features and some fixes:
- Added a README section to PT-BR language in the original README.
- Unrelated to
docs
files, like the README, can be placed in atranslations
folder in the project's root for easy access.- Added the ability to change the Documentation's language (an ๐ icon in this case) now it's easier for everyone to add their own translations. The method consists in a custom build of a
unmerged
mdbook feature from this mdBook PR: Add option to localize books in multiple languagesย rust-lang/mdBook#1306The translated content should be in a folder named
pt-br
,es
,en
,cn
... that goes within thesrc
folder ofdocs
. A new section must be added to thebook.toml
file using this pattern:[language.cn]
or[language.pt-br]
. This will generate a book for each language in the output book folder. So if someone accidentally stumbles on Dioxus, like me ๐, and wants to translate to, let's say, Korean it would be necessary to just duplicate theen
folder, rename it tokr
and start translating.I structured in this way trying to make it easier for newcomers (and current ones) to access and edit files. I tested some translation crates and IMO this was the easier way to solve translations for everybody.
I've found some errors related to the
examples/*.rs
mdBook's pre-process like this:2022-07-07 19:43:41 [ERROR] (mdbook::preprocess::links): Error updating "{{#include ../../examples/anti_patterns.rs:iter_keys}}", Could not read file for link {{#include ../../examples/anti_patterns.rs:iter_keys}} (../../examples/anti_patterns.rs)
But the HTML documentation compiles just fine.
Unfortunately, I haven't found a workaround for the default language beside defining an
en
folder and[language.en]
property as well, duplicating files in the process to make it work withmdbook build
. Would it be bad if the default documentation lives within theen
folder? And by consequence delete the other files outside their correspondent folder names?The only question left is if this whole process applies to the
router
docs as well?
Moving documentation to an "en" folder is completely fine. I think git might be smart enough to correlate the move so we won't lose history.
Don't worry about the router right now, its docs need updating before we should think about translating.
This is great! We can keep using that fork of mdBook for the forseeable future... IMO mdbook is basically "done" and just missing translation support, so using a fork is not a big deal.
Hi @jkelleyrtp ... great! @rMazeiks made a nice work! I guess we're all in accordance with the approach of merging everything in one place should be easier or at least the best option for now. I took one step further and added additional features and some fixes:
- Added a README section to PT-BR language in the original README.
- Unrelated to
docs
files, like the README, can be placed in atranslations
folder in the project's root for easy access.- Added the ability to change the Documentation's language (an earth_americas icon in this case) now it's easier for everyone to add their own translations. The method consists in a custom build of a
unmerged
mdbook feature from this mdBook PR: Add option to localize books in multiple languagesย rust-lang/mdBook#1306The translated content should be in a folder named
pt-br
,es
,en
,cn
... that goes within thesrc
folder ofdocs
. A new section must be added to thebook.toml
file using this pattern:[language.cn]
or[language.pt-br]
. This will generate a book for each language in the output book folder. So if someone accidentally stumbles on Dioxus, like me laughing, and wants to translate to, let's say, Korean it would be necessary to just duplicate theen
folder, rename it tokr
and start translating.I structured in this way trying to make it easier for newcomers (and current ones) to access and edit files. I tested some translation crates and IMO this was the easier way to solve translations for everybody. I've found some errors related to the
examples/*.rs
mdBook's pre-process like this:2022-07-07 19:43:41 [ERROR] (mdbook::preprocess::links): Error updating "{{#include ../../examples/anti_patterns.rs:iter_keys}}", Could not read file for link {{#include ../../examples/anti_patterns.rs:iter_keys}} (../../examples/anti_patterns.rs)
But the HTML documentation compiles just fine. Unfortunately, I haven't found a workaround for the default language beside defining an
en
folder and[language.en]
property as well, duplicating files in the process to make it work withmdbook build
. Would it be bad if the default documentation lives within theen
folder? And by consequence delete the other files outside their correspondent folder names? The only question left is if this whole process applies to therouter
docs as well?Moving documentation to an "en" folder is completely fine. I think git might be smart enough to correlate the move so we won't lose history.
Don't worry about the router right now, its docs need updating before we should think about translating.
This is great! We can keep using that fork of mdBook for the forseeable future... IMO mdbook is basically "done" and just missing translation support, so using a fork is not a big deal.
Perfect! I think the same about mdBook docs. It is indeed awesome, probably the best documentation tool I've ever used, it just needed this localization feature to be complete.
So I guess we're in good shape now. Marked as ready already.
Hmmm, for whatever reason git did not pick up that the files were moved from src
to en
, so in this PR the docs have lost their commit history.
I made a PR that does the internationalization changes in a way that preserves the git history here:
https://github.com/DioxusLabs/dioxus/pull/494
I need to do a slight bit more tweaking, so you'll need to rebase on top of it (or git will figure it out automatically)
Edit: for your rebase, update the book.toml if you can and SUMMARY, index, and roadmap since those are duplicated. Edit Edit: I need to update the fork of mdbook to support included folders
Rebase done. I guess it's good to go, but let me know if I missed something and I'll gladly fix it.
Yeah, sure. I'm in for more on the long run, just need to get good at Dioxus first then I'll deep dive with Mobile+WebAssembly (my main interest in Dioxus) โ
Hi there, I'm building a Rust Knowledge Base Center and I'm using Rust for both backend and frontend.
I was using Yew.rs before I discovered about Dioxus 2 days ago while I was googling Yew's documentation... and I have to say, that was the best find of the day! Dioxus is so much more elegant than Yew imo. I'll build my frontend with Dioxus now!
I got really excited and I wanna help to spreadย the word and the fastest way for me right now is by translating (PT-BR in this case) all the documentation. I wish I could help with code but you know... I'm still learning Dioxus๐ . But later, after enough hacking with Dioxus, I'm planning to help with examples and with code as well.
I don't know which Markdown files are used for the mdbooks so I decided to translate every one of them with relevant content in it.
I've forked the project to
diff
with my translated files. For every translated file I appended "_pt-br.md"ย for easy tracking.I've made a progress table summary:
Repo Description README
Guide
Guide Section
## Advanced Guides | Original | Brazilian Portuguese | Translated | | :--------------------: | :--------------------------: | :--------: | | 00-index.md | 00-index_pt-br.md | โ | | 06-subscription-api.md | 06-subscription-api_pt-br.md | โ | | 10-concurrent-mode.md | 10-concurrent-mode_pt-br.md | โ | | 11-arena-memo.md | 11-arena-memo_pt-br.md | โ | | 12-signals copy.md' | 12-signals.md | โ | | 13-subtrees.md | 13-subtrees_pt-br.md | โ | | custom-renderer.md | custom-renderer_pt-br.md | โ | | liveview.md | liveview_pt-br.md | โ | | rsx_in_depth.md | rsx_in_depth_pt-br.md | โ | | rsx.md | rsx_pt-br.md | โ | | testing.md | testing_pt-br.md | โ | ## Async | Original | Brazilian Portuguese | Translated | | :--------------: | :--------------------: | :--------: | | asynctasks.md | asynctasks_pt-br.md | โ | | coroutines.md | coroutines_pt-br.md | โ | | fetching.md | | | index.md | index_pt-br.md | โ | | loading_state.md | loading_state_pt-br.md | โ | | sockets.md | | | use_future.md | use_future_pt-br.md | โ | ## Components | Original | Brazilian Portuguese | Translated | | :---------------------: | :---------------------------: | :--------: | | component_children.md | component_children_pt-br.md | โ | | composing.md | composing_pt-br.md | โ | | exporting_components.md | exporting_components_pt-br.md | โ | | index.md | index_pt-br.md | โ | | propsmacro.md | propsmacro_pt-br.md | โ | ## Elements | Original | Brazilian Portuguese | Translated | | :----------------------: | :----------------------------: | :--------: | | conditional_rendering.md | conditional_rendering_pt-br.md | โ | | index.md | index_pt-br.md | โ | | lists.md | lists_pt-br.md | โ | | special_attributes.md | special_attributes_pt-br.md | โ | | vnodes.md | vnodes_pt-br.md | โ | ## Helpers | Original | Brazilian Portuguese | Translated | | :------: | :------------------: | :--------: | | index.md | index_pt-br.md | โ | ## Interactivity | Original | Brazilian Portuguese | Translated | | :---------------: | :---------------------: | :--------: | | event_handlers.md | event_handlers_pt-br.md | โ | | hooks.md | hooks_pt-br.md | โ | | importanthooks.md | importanthooks_pt-br.md | โ | | index.md | index_pt-br.md | โ | | lifecycles.md | lifecycles_pt-br.md | โ | | useref.md | useref_pt-br.md | โ | | user_input.md | user_input_pt-br.md | โ | | usestate.md | usestate_pt-br.md | โ | ## State | Original | Brazilian Portuguese | Translated | | :--------------: | :--------------------: | :--------: | | channels.md | | โ | | errorhandling.md | errorhandling_pt-br.md | โ | | fanout.md | fanout_pt-br.md | โ | | fermi.md | fermi_pt-br.md | โ | | index.md | index_pt-br.md | โ | | liftingstate.md | liftingstate_pt-br.md | โ | | localstate.md | localstate_pt-br.md | โ | | router.md | router_pt-br.md | โ | | sharedstate.md | sharedstate_pt-br.md | โ | ## Tutorial | Original | Brazilian Portuguese | Translated | | :----------------: | :----------------------: | :--------: | | advanced_guides.md | advanced_guides_pt-br.md | โ | | components.md | components_pt-br.md | โ | | index.md | index_pt-br.md | โ | | new_app.md | new_app_pt-br.md | โ | | publishing.md | publishing_pt-br.md | โ | | state.md | state_pt-br.md | โ | | structure.md | structure_pt-br.md | โ | | styling.md | styling_pt-br.md | โ |
Reference
Reference Section
## Guide | Original | Brazilian Portuguese | Translated | | :-----------------------: | :----------------------: | :--------: | | bundline.md | | | | components.md | | | | custom_elements.md | | | | custom_renderer.md | custom_renderer_pt-br.md | โ | | hot_reloading.md | hot_reloading_pt-br.md | โ | | index.md | index_pt-br.md | โ | | memoization.md | | | | performance.md | | | | props.md | | | | rsx_in_depth.md | rsx_in_depth_pt-br.md | โ | | rsx.md | | | | server_side_components.md | | | | testing.md | | | ## Platforms | Original | Brazilian Portuguese | Translated | | :--------: | :------------------: | :--------: | | desktop.md | desktop_pt-br.md | โ | | index.md | index_pt-br.md' | โ | | mobile.md | mobile_pt-br.md | โ | | ssr.md | ssr_pt-br.md | โ | | tui.md | tui_pt-br.md | โ | | web.md | web_pt-br.md | โ |
Router
Router Section
## Guide | Original | Brazilian Portuguese | Translated | | :-----------------------: | :-----------------------------: | :--------: | | building-a-nest.md | building-a-nest_pt-br.md | โ | | first-route.md | first-route_pt-br.md | โ | | getting-started.md | getting-started_pt-br.md | โ | | index.md | index_pt-br.md | โ | | redirection-perfection.md | redirection-perfection_pt-br.md | โ | ## Reference | Original | Brazilian Portuguese | Translated | | :------: | :------------------: | :--------: | | index.md | index_pt-br.md | โ |
My guess is that many like me came from React and TypeScript and if I can make this transition easier by translating everything that's fantastic.
I want to reduce the number of files to as minimum as possible so merging would be effortless. Where should I look for that?
Any suggestions/modifications for this being merged and a PT-BR section added in the Home Page/README.md?
Btw, thanks for this awesome tool!