Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

feat: i18n support for mdbook #203

Merged
merged 5 commits into from
Oct 12, 2023
Merged

Conversation

dpinones
Copy link
Contributor

This PR adds support for the i18n mdbook extension.

  • Added a script translation.sh to facilitate the work.
  • The CI has also been modified to use Rust's cache. The CI always builds the English version first and then the translations.
  • When modifying a translation, only the po files will be changed. The book's structure remains completely intact.

To create this PR, I based it on the Beerus Book and Cairo Book.

It's already functional in a test repository:
Repository: https://github.com/dpinones/starknetbook-test
Actions: https://github.com/dpinones/starknetbook-test/actions
Book: http://dpinones.com/starknetbook-test/

@dpinones
Copy link
Contributor Author

@cryptonerdcn
Copy link
Contributor

cryptonerdcn commented Oct 10, 2023

Good job!
I'd like to share some exps about the mdbook.

  1. Seems like if generates the message.pot from different environments, the .po file also changes. It also happened in Dojo-book [i18n] Add Japanese translation for Dojo book. dojoengine/book#53 (comment) but we don't know why. This can cause some texts to not be included in the .po file.
  2. In my Mac, try to run generate language .po file command will cause an error like this:
po/messages.pot:964: duplicate message definition...
po/messages.pot:3: ...this is the location of the first definition

google/mdbook-i18n-helpers#64. It is still not been fixed so if you got the same error, you need to delete 954 to 965 manually. It looks like:

#: src/ch01-00-getting-started.md:13
#: src/ch01-00-getting-started.md:127
#: src/ch02-07-starknet-js.md:11
#: src/ch03-00-architecture.md:26
#: src/ch03-02-sequencers.md:52
#: src/ch03-02-sequencers.md:211
#: src/ch03-04-nodes.md:66
#: src/ch03-04-nodes.md:350
#: src/ch03-04-nodes.md:420
#: src/ch03-05-layer-3.md:18
msgid ""
msgstr ""

@cryptonerdcn
Copy link
Contributor

スクリーンショット 2023-10-10 23 01 17 BTW: I also add Chinese `.po` file to this. Waiting for the merge.

@Nadai2010
Copy link
Contributor

@dpinones @cryptonerdcn This is great, what a great community... Since the merge has been in place we have organized ourselves by language and we will do it with our best effort.

@omarespejel omarespejel merged commit a98f1a6 into starknet-edu:main Oct 12, 2023
@omarespejel
Copy link
Collaborator

Thank you so much, @dpinones! Your contribution is outstanding and paves the way for greater collaboration with communities where @Nadai2010 and @cryptonerdcn play pivotal roles 🙏

I've merged it. A huge thanks once again for your invaluable input! I'll be highlighting this along with recent contributions from @dbejarano820 and @devnet0x in an upcoming tweet. Truly, we have an incredible community!

@Nadai2010
Copy link
Contributor

Thank you @omarespejel for the words, here I leave a small update on the tabs

Tabs book.toml: #208

I'm going to start the translation

@omarespejel
Copy link
Collaborator

Amazing @Nadai2010!! Thank you! i just merged your PR 🙏

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants