Skip to content

WIP chapter 2#71

Merged
lewtun merged 14 commits into
huggingface:mainfrom
jowharshamshiri:main
Apr 5, 2022
Merged

WIP chapter 2#71
lewtun merged 14 commits into
huggingface:mainfrom
jowharshamshiri:main

Conversation

@jowharshamshiri

@jowharshamshiri jowharshamshiri commented Mar 31, 2022

Copy link
Copy Markdown
Contributor

Translated the introduction to chapter 2. This is a first draft to just get in sync with other contributors and find our common tone in translation. Also created glossary.csv in the root of 'fa' folder to standardize translations of some commonly mistranslated words--this too is a first draft open to suggestions from other contributors.

Related to #49

@lewtun lewtun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this great PR! I've left a small comment about adding the table of contents and a glossary, but otherwise this is looking good 🚀

I'll ask the Persian community for a quick review :)

Comment thread chapters/fa/glossary.csv Outdated
@@ -0,0 +1,32 @@
Transformer,ترنسفورمر

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been talking about a glossary / vocabulary with the Italian translators in #45 and I think it would be nice to have this as a "chapter" that the Persian readers can access.

To enable that, you'll just need to add a new section to the _toctree.yml file like the following:

- title: Glossary # <= translate this to Farsi
  sections:
  - local: glossary/1
    title: Glossary # Same here

Comment thread chapters/fa/chapter2/1.mdx Outdated
@@ -0,0 +1,20 @@
#مقدمه

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To render this on the website, we should add a _toctree.yml file with the following content:

- title: 1. Transformer models # Translate this
  sections:
  - local: chapter2/1
    title: Introduction # And this

Comment thread chapters/fa/chapter2/1.mdx Outdated
@@ -0,0 +1,20 @@
#مقدمه

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To render this on the website, we should add a _toctree.yml file with the following content:

- title: 1. Transformer models # Translate this
  sections:
  - local: chapter2/1
    title: Introduction # And this

Comment thread chapters/fa/chapter2/2.mdx Outdated
@@ -0,0 +1,353 @@
<FrameworkSwitchCourse {fw} />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should remove all the untranslated files - we only render on the website the chapters / sections that are translated

Comment thread chapters/fa/chapter2/2.mdx Outdated
@@ -0,0 +1,353 @@
<FrameworkSwitchCourse {fw} />

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should remove all the untranslated files - we only render on the website the chapters / sections that are translated

@lewtun lewtun mentioned this pull request Apr 1, 2022
69 tasks

@MehranMirkhan MehranMirkhan left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am a native Persian speaker. The translations look good to me.

@jowharshamshiri

Copy link
Copy Markdown
Contributor Author

@lewtun can we get this through I have another page incoming and need to add terms to the glossary but don't want to invalidate this review. :)

@jowharshamshiri

Copy link
Copy Markdown
Contributor Author

I have chapter 0 ready for merge in a separate branch on my fork. Will submit in separate PR for review.

Comment thread chapters/fa/glossary.csv Outdated
@@ -0,0 +1,32 @@
Transformer,ترنسفورمر

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been talking about a glossary / vocabulary with the Italian translators in #45 and I think it would be nice to have this as a "chapter" that the Persian readers can access.

To enable that, you'll just need to add a new section to the _toctree.yml file like the following:

- title: Glossary # <= translate this to Farsi
  sections:
  - local: glossary/1
    title: Glossary # Same here

@jowharshamshiri jowharshamshiri Apr 4, 2022

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a section for glossary, it is no longer a CSV file. This I think is resolved. Looks like this in _toctree.yml:

  • title: واژه‌نامه
    sections:
    • local: glossary/1
      title: واژه‌نامه

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

Comment thread chapters/fa/chapter2/1.mdx Outdated
@@ -0,0 +1,26 @@
<div dir="rtl">
<h1>مقدمه</h1>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I seem to be having some trouble building the docs because the tool we use assumes that we have a Markdown header like

# Chapter title 

as the start of the file. Could you please try installing our doc-builder tool via:

pip install git+https://github.com/huggingface/doc-builder.git

Then try building the docs with:

doc-builder build course ../course/chapters/fa --build_dir tmp-docs --clean --not_python_module --html --language fa

You might need to experiment with the format of the header here - are there any guidelines on writing Farsi in Markdown?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this. will do tonight. I am having so much trouble both with the characters and the RTL nature of the language. Finding editors is hard too. We might need to write that guide, haven't come across one myself.

@@ -0,0 +1,52 @@
| معادل در منبع | معادل در ترجمه |

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, here we'll need a H1 header with something like

# Glossary <= translate this

@lewtun

lewtun commented Apr 4, 2022

Copy link
Copy Markdown
Member

@lewtun can we get this through I have another page incoming and need to add terms to the glossary but don't want to invalidate this review. :)

Hey @jowharshamshiri happy to merge this once we can get the docs to build. I've left some suggestions on trying this yourself, but please let me know if you need some help!

@jowharshamshiri

jowharshamshiri commented Apr 5, 2022

Copy link
Copy Markdown
Contributor Author

Hey @lewtun, I got the docs to build with a workaround--the first header is now unfortunately rendering in LTR mode. This is ok for now so we can move forward with translating other pages. I also experimented with DISABLE-FRONTMATTER-SECTIONS and even adding an empty code block but alas to no avail. I want to open an issue on doc-builder, whereby we add a 'direction' arg or otherwise automatically figure out the direction of languages. That info is then used to automatically handle the direction of the generated divs and whatnot. If we do that we can dispense with the extra RTL divs and spans everywhere in Persian and also other RTL-language docs. Is that something that sounds worthwhile to you or am I confused?

@lewtun

lewtun commented Apr 5, 2022

Copy link
Copy Markdown
Member

Thanks a lot for diving into this @jowharshamshiri - I had no idea it would be so tricky 😬 .

I think opening an issue on doc-builder would make a lot of sense as I can already see we're running into the same issue with other RTL languages. I suggest providing a super simple example of an MDX file and corresponding _toctree.yml file that reproduces the problem and separately shows the hacks you've needed to implement to make it work.

In the meantime, I'll test I can build the current PR!

path_to_docs: course/chapters/
additional_args: --not_python_module
languages: en es fr he pt ru th tr
languages: en es fa fr he pt ru th tr

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI I've added Farsi to the list of languages here so we can build the docs in the CI

@HuggingFaceDocBuilderDev

HuggingFaceDocBuilderDev commented Apr 5, 2022

Copy link
Copy Markdown

The documentation is not available anymore as the PR was closed or merged.

@jowharshamshiri

jowharshamshiri commented Apr 5, 2022

Copy link
Copy Markdown
Contributor Author

Hey @lewtun, while trying to file the issue and reproduce the problem I found a simpler workaround which I included in new commits. Please kindly merge. The first header now renders correctly as RTL. I filed an issue on doc-builder here to automate this.

P.S. I think maybe in the CI build you have the lang arg still set to en. It is building the original English docs.

@lewtun

lewtun commented Apr 5, 2022

Copy link
Copy Markdown
Member

Thank you for finding a nice fix! Will merge this now 🤗

P.S. I think maybe in the CI build you have the lang arg still set to en. It is building the original English docs.

Yeah that's a current limitation with our UI - we need to add a dropdown button to view the PR in language X, hopefully will have that soon!

@lewtun
lewtun merged commit 4c18fa5 into huggingface:main Apr 5, 2022
GITbaburin pushed a commit to GITbaburin/course that referenced this pull request May 17, 2026
GITbaburin pushed a commit to GITbaburin/course that referenced this pull request May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants