Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Persian translation #671

Open
mgeisler opened this issue May 24, 2023 · 27 comments
Open

Persian translation #671

mgeisler opened this issue May 24, 2023 · 27 comments

Comments

@mgeisler
Copy link
Collaborator

mgeisler commented May 24, 2023

Hi @mbpouri, here is an issue for you!

I don't see any translation on https://doc.rust-lang.org/book/appendix-06-translation.html, but perhaps there is a Persian Rust community somewhere where you can find translations of common words 😄

The translation is live at https://google.github.io/comprehensive-rust/fa/.

@mgeisler
Copy link
Collaborator Author

Let me know if/when you run into rust-lang/mdBook#1486 — then we'll have to work on adding good support for right-to-left languages in mdbook.

@mbpouri
Copy link

mbpouri commented May 26, 2023

sure, on it. thanks pal @mgeisler

@mgeisler
Copy link
Collaborator Author

@DannyRavi, I tried out the translation in #1042 and the text looks like this out of the box:

image

Adding dir="rtl" to the html tag makes it look like this:

image

Does this look more correct to you? I cannot read it, so it's hard for me to judge how it looks 🙂

Ideally, we should fix this in the upstream mdbook project (rust-lang/mdBook#1486), but we can perhaps prototype a fix for them here and then contribute it upstream. I'm thinking we can simply use different index.hbs template depending on the writing direction.

@DannyRavi
Copy link
Collaborator

Before starting the translation of the texts. I noticed that the book has a problem with right-to-left texts according to links #1486 and #671
After translating some texts and testing the program on a local server, I realized that the right-to-left texts are not correct and the texts are difficult to understand for Persian speakers. Finally, I had no idea for right-to-left texts.

@mgeisler
Copy link
Collaborator Author

mgeisler commented Aug 2, 2023

Hi @DannyRavi, could you test locally with mdbook serve after modifying theme/index.hbs like this:

modified   theme/index.hbs
@@ -1,5 +1,5 @@
 <!DOCTYPE HTML>
-<html lang="{{ language }}" class="sidebar-visible no-js {{ default_theme }}">
+<html lang="{{ language }}" dir="rtl" class="sidebar-visible no-js {{ default_theme }}">
     <head>
         <!-- Book generated using mdBook -->
         <meta charset="UTF-8">

This simply adds the dir="rtl" attribute to the html tag. Is this enough to make the page readable? If so, we could use this as a starting point and fix other issues down the road.

@mgeisler
Copy link
Collaborator Author

Hey @DannyRavi, @mbpouri, and @javad-jafari — would you be able to review each other's PRs? We have #1209 (by @DannyRavi) and #1341 (by @javad-jafari) open right now.

@hamidrezakp
Copy link
Collaborator

hamidrezakp commented Oct 16, 2023

Hey there, i just saw this issue and the work you guys all are doing, that mean a lot to Persian community, Thank you all.

Can we use custom font for Persian translation? it's not pretty good. I'm available to change and fix it if you are okay with it.
I'm suggesting to use Vazir fonts family for Persian texts.

@hamidrezakp
Copy link
Collaborator

hamidrezakp commented Oct 16, 2023

@DannyRavi @mbpouri
Thank you and @javad-jafari for your great work on translation.

I just checked some of translations and it seems there is a good amount of ZWNG missing in translations, let's fix them before merge to ensure a good quality text.
And I suggest we use راست for word ‍Rust because reading it is easier and it's pretty common in Persian community right now.

@mgeisler
Copy link
Collaborator Author

Hey there, i just saw this issue and the work you guys all are doing, that mean a lot to Persian community, Thank you all.

Hi @hamidrezakp, thanks for joining in!

Can we use custom font for Persian translation? it's not pretty good. I'm available to change and fix it if you are okay with it. I'm suggesting to use Vazir fonts family for Persian texts.

Awesome! If you can write a PR which tweaks the CSS, then I would be happy to add it!

We should ultimately add this upstream in https://github.com/rust-lang/mdBook/ since we're relying on the right-to-left support recently added there (rust-lang/mdBook#1641).

If the fix/improvement is clear, then I suggest adding it upstream directly. Otherwise we can also modify our CSS and theme as needed. Just let me know.

@mgeisler
Copy link
Collaborator Author

If we can find 2-3 people who are interested in reviewing, then add yourself to the CODEOWNERS file.

That way you'll be auto-added to future PRs and will thus be able to do everything yourself — @henrif75 and myself should not really be involved in the Persian translation 😄

@hamidrezakp
Copy link
Collaborator

If the fix/improvement is clear, then I suggest adding it upstream directly. Otherwise we can also modify our CSS and theme as needed. Just let me know.

So let me open an issue there and ask them if we can use custom fonts for Persian language; if not, we add it here.

@hamidrezakp
Copy link
Collaborator

That way you'll be auto-added to future PRs and will thus be able to do everything yourself — @henrif75 and myself should not really be involved in the Persian translation 😄

Yeah you are right 😄 it's just impossible for you to review or check translations, I think i can find some friends in Persian Rust community that are willing to be maintainer here.

@mehrad77
Copy link
Collaborator

Hey folks, so existed about this.
I can help with reviewing the translations and other stuff related to fa translations.

@hamidrezakp
Copy link
Collaborator

@mehrad77 I have added your name to reviewers for Persian(#1375 ),
Which one of this PRs do you want to review?

You can assign them to yourself and we will pick others.

@mehrad77
Copy link
Collaborator

mehrad77 commented Oct 17, 2023

@hamidrezakp I see there is a problem with the #1209 and I see no change in that PR.
With that said I'll assign myself to review #1341

@mehrad77
Copy link
Collaborator

mehrad77 commented Oct 17, 2023

I've just made a look. I see lots of not related changes (mostly code style and text formatting, new lines, etc...).
When opening new PRs I think its very important to keep that in mind to not change parts of the document that are not related to the Farsi translation and limit the scope of changes. It'll make the reviewing a lot easier. At this moment I have no idea what to do with this much unrelated change in #1341

Besides that I see that a lot of chapters are not translated.I want to know is there a bigger plan to split chapters and assign the task of translation of each chapter to one person? I rather get involved in the translation itself and start making a bigger picture of who is translating which parts. I'll start translating the "Day 2" morning. (from chapter 12 to 17) and open a new PR.

@hamidrezakp
Copy link
Collaborator

Yeah i agree but maybe you can just check last commit (although it contains a lot of non-related things to translation and that's because of poor formatting i guess).

Anyways, That's a good idea to split the translation task into smaller chunks and more organized so contributors can easily pick 'em up and translate.

If you can open a draft PR that mentions what you are working on would be great.

@DannyRavi
Copy link
Collaborator

DannyRavi commented Oct 17, 2023

Hi @hamidrezakp .
Unfortunately, the word راست in Farsi, which means ‍Rust programming language, is the same as the word راست ,which means ‍Right , and this would increase the error of reading and misunderstand the translated text, and suggestions like رااست have been discussed before and have not reached a conclusion.

@mehrad77
Copy link
Collaborator

mehrad77 commented Oct 18, 2023

@DannyRavi my suggestion is using رآست with the U+0622 instead of U+0627. (As afshin introduced on Mastadon). But I'm seeing that رااست has more adaption. I'm in favor of both of these.

@hamidrezakp
Copy link
Collaborator

@DannyRavi @mehrad77
I think we should do some polls in communities and social media to see what are everyone okay with.

@mgeisler
Copy link
Collaborator Author

Yeah i agree but maybe you can just check last commit (although it contains a lot of non-related things to translation and that's because of poor formatting i guess).

If the poor formatting is about lines being re-wrapped in strange ways, then we have a solution for that: we recently (#1359) introduced a GitHub check which requires PO files to be formatted consistently. This boils down to following the preparation section of TRANSLATIONS.md and then running

dprint fmt

Btw, I've found that using gh and bat works very well for reviewing the large diffs:

gh pr diff 1341 | bat -l patch

is very quick and shows me that changes of #1341 in a nice way.

@mgeisler
Copy link
Collaborator Author

@DannyRavi @mehrad77 I think we should do some polls in communities and social media to see what are everyone okay with.

Great idea! Feel free to use the discussions here or any other convenient place!

@moaminsharifi
Copy link
Collaborator

First of all, special thanks to @mgeisler for adding dir="rtl|ltr" to the html template

#671 (comment)

When you add dir="rtl" to html, the page direction will be right to left, but what about the English text (or any other LTR text) between the contents (or vice versa)?

For example,

Welcome to Comprehensive Rust 🦀 - Comprehensive Rust 🦀 - issue in BiDi

In #1413 , I proposed a simple way to handle it with theme but not the most suitable way for doing it.

It's better to mention it here as well.

@mgeisler
Copy link
Collaborator Author

Thanks @moaminsharifi for looking at this. As I wrote in #1413, I think we should first understand if the right-to-left support works okayish for fully-translated pages. If it does, then the problem you point out is a temporary problem — if it doesn't, then I would need help from people here to find a good solution.

@moaminsharifi
Copy link
Collaborator

Thanks @moaminsharifi for looking at this. As I wrote in #1413, I think we should first understand if the right-to-left support works okayish for fully-translated pages. If it does, then the problem you point out is a temporary problem — if it doesn't, then I would need help from people here to find a good solution.

@mgeisler, For the time being, I think we should close that github issue #1413 until the pages are completely translated, then check it out again.

hamidrezakp pushed a commit that referenced this issue Oct 25, 2023
Part of #671
**Summary of changes:** 
- Persian version of book messages synced to original book
- Translate sidebar menu
* I just translate and double check until `# src/SUMMARY.md:333` part*
hamidrezakp added a commit that referenced this issue Oct 26, 2023
Part of #671
Summary of changes:

- Translate Part 1,2
- Recheck `#, fuzzy` lines and synced their translations

Co-authored-by: Kaveh <hamidrkp@riseup.net>
mgeisler pushed a commit that referenced this issue Oct 31, 2023
Part of #671 
and #1413

In the code part of content which always is in english and must be
`text-align: left` but with `<html ... dir=rtl >` cuz conflict.

---------

Co-authored-by: Kaveh <hamidrkp@riseup.net>
hamidrezakp added a commit that referenced this issue Nov 4, 2023
Part of #671 
- Translate Part `3` , `4` , `5` ,`6.1`, `6.2`, `6.3`

---------

Co-authored-by: Hamid R. K. Pisghadam <kaveh@riseup.net>
Co-authored-by: Kaveh <hamidrkp@riseup.net>
@moaminsharifi
Copy link
Collaborator

@mgeisler

Some of markdown renders to svg with ```bob , but I can not find in the translate file.
There is 10 Item like that:
image
but mostly 4 in each translation file like (fa.po):
in-translation-file

Is that something we must add it manually?

@mgeisler
Copy link
Collaborator Author

mgeisler commented Nov 8, 2023

Hi @moaminsharifi, the svgbob images disappeared from the translation pipeline with google/mdbook-i18n-helpers#75 by @dyoo: we now only translate a code block if it contains " or // since that is a very simple heuristic to recognize code with string literals or comments.

We should restore this and google/mdbook-i18n-helpers#76 is in some sense about this problem: with that feature implemented, we should be able to say "always translate svgbob code blocks".

Note that our text extraction tooling will become more fine-grained with google/mdbook-i18n-helpers#109, which will be merged later today or tomorrow after a small rebase.

moaminsharifi added a commit that referenced this issue Nov 8, 2023
hamidrezakp pushed a commit that referenced this issue Dec 17, 2023
…1453)

Part of #671
- Translate Part  `6.x`, `7`, `..`, `15.x`, `16.1` , `..` , `16.5`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants