google / comprehensive-rust

This is the Rust course used by the Android team at Google. It provides you the material to quickly teach Rust.
https://google.github.io/comprehensive-rust/
Apache License 2.0
27.43k stars 1.63k forks source link

Spanish (es): Catch-up with EN version #2120

Open henrif75 opened 3 months ago

henrif75 commented 3 months ago

Translate remaining messages and review fuzzy translations. As of 6/5/24, current translation stats are:

es.po
3129 translated messages, 450 fuzzy translations, 194 untranslated messages.

Steps:

  1. Sync your branch with main.
  2. Recreate messages.pot:
    MDBOOK_OUTPUT='{"xgettext": {"pot-file": "messages.pot", "granularity": 0}}' \
    mdbook build -d po
  3. Merge with the es.po:
    msgmerge --update po/es.po po/messages.pot
  4. Edit the es.po file with your favorite PO editor.
letesdev commented 2 months ago

Hi 👋

I am interested in helping translating this book to spanish, but I am having some problems with building the spanish version. I am using a Windows 10 machine and followed your README.md, CONTRIBUTING.md and TRANSLATIONS.md guides, but still face some errors.

I am able to build (and serve) the english and the spanish version, but as you can see in the image below, there are still some level-1 paragraphs in English:

image

I followed your steps in this issue, and the po/es.po file seems legit for me (I used Poedit):

#: src\index.md
msgid ""
"Android: a half-day course on using Rust for Android platform development "
"(AOSP). This includes interoperability with C, C++, and Java."
msgstr ""
"Android: un curso de medio día sobre el uso de Rust en el desarrollo de la "
"plataforma Android (AOSP). En él se incluye la interoperabilidad con C, C++ "
"y Java."

Thanks in advance ! 😄

henrif75 commented 2 months ago

Hi @letesdev Can you make sure you've got the latest version from main? My po/es.po is different from your screenshot: image

letesdev commented 2 months ago

Hi @henrif75, Thanks for your message ! After getting the latest version from main, my po/es.po is the same as yours:

#: src/index.md
msgid ""
"[Android](android.md): a half-day course on using Rust for Android platform "
"development (AOSP). This includes interoperability with C, C++, and Java."
msgstr ""
"[Android](android.md): un curso de medio día sobre el uso de Rust en el "
"desarrollo de la plataforma Android (AOSP). En él se incluye la "
"interoperabilidad con C, C++ y Java."

and serving the book directly shows me the translated message: image

I can translate paragraphs using Poedit:

image

However, I have the same problems if I follow the TRANSLATIONS.md guide. After extracting the original English text and generating the messages.pot (with MDBOOK_OUTPUT='{"xgettext": {"pot-file": "messages.pot", "granularity": 0}}' mdbook build -d po command), and updating the po/es.po file with new messages (with msgmerge --update po/es.po po/messages.pot command), here's the output:

image

(here's the es.po.txt file in case you need it - ps: delete the .txt extension)

henrif75 commented 2 months ago

The resulting es.po file after you run the msgmerge looks weird (e.g., it has the original line numbers) Can you delete and regenerate the messages.pot and share here? Also, can you check the version of gettext? Thanks.

letesdev commented 2 months ago

Of course, here's the requested information:

henrif75 commented 2 months ago

Can you try to upgrade the gettext tools to the latest version (0.22.5) and recreate the messages.pot?

carreter commented 2 months ago

@letesdev What's your status on this? Would love to pitch in!

mgeisler commented 1 month ago

Hey folks, I'm sorry about these formatting problems! I only tested our instructions once way back using my wife's Windows laptop :smile:

I recall that there were two popular places to get the Gettext tools from on Windows. The instructions should point to the right one, so perhaps it's worth double-checking that you really installed everything from there?

carreter commented 1 month ago

@letesdev I've put up a draft PR so we can start collaborating on this. I'll commit my progress as often as I can.

@henrif75 Can you verify that the file generated by Poedit over in my PR (#2232) is correct and doesn't have the same issues as @letesdev ?

henrif75 commented 1 month ago

Hi @carreter, I checked the file and unfortunately it's still in the wrong format, with line numbers in comments:

#: src/SUMMARY.md src/running-the-course/course-structure.md:15
#: src/running-the-course/course-structure.md:34
#: src/running-the-course/course-structure.md:52
#: src/running-the-course/course-structure.md:69 src/welcome-day-1.md
#: src/welcome-day-2.md src/welcome-day-3.md src/welcome-day-4.md
#: src/concurrency/welcome-async.md
msgid "Welcome"
msgstr "Te damos la bienvenida"

The es.po file I updated does not have these:

#: src/SUMMARY.md src/index.md
msgid "Welcome to Comprehensive Rust 🦀"
msgstr "Te damos la bienvenida a Comprehensive Rust 🦀"

Can you please check and report back here:

Also, please upload the messages.pot file created after you ran mdbook build Thank you.

letesdev commented 1 month ago

Hi guys, sorry for the late answer, last days before holidays have been crazy...

I tried to update gettext tools twice, without success... I would love to have some Windows guide if you have 😄 if not, i will try again...

Thanks @carreter and @henrif75 😄

carreter commented 1 month ago

@henrif75 thanks for checking on that. Here's the info you requested:

And here's the messages.pot: messages.pot.txt

henrif75 commented 1 month ago

Thanks @carreter. The messages.pot file was generated with the line numbers. The most current version of gettext is 0.22.5 - I don't think this could be the culprit, but if you could update and retest it would be great.

@mgeisler Would have any idea of why messages.pot was created with the wrong parameter? Essentially, the it's ignoring the granularity parameter.

@henrif75 thanks for checking on that. Here's the info you requested:

  • gettext version: 0.21
  • mdbook version: 0.4.40
  • OS version: custom Debian derivative

And here's the messages.pot: messages.pot.txt

carreter commented 1 month ago

@henrif75 just updated get text version and confirmed that this doesn't change the behavior.

Maybe this is related to this issue? https://github.com/google/mdbook-i18n-helpers/issues/171

carreter commented 1 month ago

After the fix in https://github.com/google/mdbook-i18n-helpers/pull/215, the line numbers issue is resolved:

carreter@carreter:~/projects/comprehensive-rust$ cat po/messages.pot | grep :[0-9]
"POT-Creation-Date: 2024-07-19T19:45:30Z\n"
"We typically run classes from 9:00 am to 4:00 pm, with a 1 hour lunch break "
msgid "\"127.0.0.1:0\""
msgid "\"127.0.0.1:2000\""
msgid "\"ws://127.0.0.1:2000\""

Now time to go through the translations I had made with the incorrect messages.pot and merge them into the corrected one! :')

mgeisler commented 1 month ago

Now time to go through the translations I had made with the incorrect messages.pot and merge them into the corrected one! :')

If we're talking about many translations, then you should look into using msgcat and/or msgmerge to merge them. The Gettext tools come with a lot of utilities which can manipulate the PO files.

carreter commented 1 month ago

msgmerge did the trick!

carreter commented 2 weeks ago

FYI, this is my last week working at Google. I'm not sure if I will have time to finish the translation while I am here, but I will try my best to get as much of it as I can done over on #2232. Afterwards work will be slower, but I will still plug away at it.

There are 301/3613 messages left to translate!

@letesdev are you still interested in helping out with this?

mgeisler commented 2 weeks ago

Thanks @carreter for all the hard work here! @henrif75 and @letesdev, can you give #2232 a review? From skimming through it with gh pr diff 2232 | bat -l patch, it looks great from a structure point of view.

mgeisler commented 1 week ago

The live translation delta can be seen in the synced translation report.