Skip to content

Commit

Permalink
Merge pull request huggingface#32 from huggingface/update-translation…
Browse files Browse the repository at this point in the history
…-template

Update translation template
  • Loading branch information
lewtun authored Mar 28, 2022
2 parents 56918ab + 7df3d56 commit d4b920b
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 31 deletions.
12 changes: 0 additions & 12 deletions .github/ISSUE_TEMPLATE/translation-template.md

This file was deleted.

33 changes: 33 additions & 0 deletions .github/ISSUE_TEMPLATE/translations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
name: Translation template
about: 🤝 Translating the course to another language
title: ''
labels: translation
assignees: ''

---

<!-- You should replace `LANG-ID` below with one of the ISO 639-1 or ISO 639-2 language codes -- see https://www.loc.gov/standards/iso639-2/php/code_list.php for a handy table. Also, please add a descriptive title for the issue like "Translation to LANG-ID" -->

Hi there 👋

Let's translate the course to `LANG-ID` so that the whole community can benefit from this resource 🌎!

Below are the files and chapters that need translating - let us know here if you'd like to translate any and we'll add your name to the list. Once you're finished, open a pull request and tag this issue by including `#issue-number` in the description, where `issue-number` is the number of this issue.

> 🙋 If you'd like others to help you with the translation, you can also post in our [forums](https://discuss.huggingface.co/c/course/20) or tag [@_lewtun](https://twitter.com/_lewtun) on Twitter to gain some visibility.
## Chapters

- [ ] [`table of contents`](https://github.com/huggingface/course/blob/main/chapters/en/_toctree.yml)
- [ ] [`chapter0`](https://github.com/huggingface/course/tree/main/chapters/en/chapter0)
- [ ] [`chapter1`](https://github.com/huggingface/course/tree/main/chapters/en/chapter1)
- [ ] [`chapter2`](https://github.com/huggingface/course/tree/main/chapters/en/chapter2)
- [ ] [`chapter3`](https://github.com/huggingface/course/tree/main/chapters/en/chapter3)
- [ ] [`chapter4`](https://github.com/huggingface/course/tree/main/chapters/en/chapter4)
- [ ] [`chapter5`](https://github.com/huggingface/course/tree/main/chapters/en/chapter5)
- [ ] [`chapter6`](https://github.com/huggingface/course/tree/main/chapters/en/chapter6)
- [ ] [`chapter7`](https://github.com/huggingface/course/tree/main/chapters/en/chapter7)
- [ ] [`chapter8`](https://github.com/huggingface/course/tree/main/chapters/en/chapter8)
- [ ] [`event`](https://github.com/huggingface/course/tree/main/chapters/en/event)

37 changes: 21 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,52 +6,57 @@ This repo contains the content that's used to create the **[Hugging Face course]

| Language | Source | Authors |
|:-------------------------------------------------------|:--------------|:---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [English](https://huggingface.co/course/en/chapter1/1) | [`chapters/en`](https://github.com/huggingface/course/tree/master/chapters/en) | [@sgugger](https://github.com/sgugger), [@lewtun](https://github.com/lewtun), [@LysandreJik](https://github.com/LysandreJik), [@Rocketknight1](https://github.com/Rocketknight1), [@sashavor](https://github.com/sashavor), [@osanseviero](https://github.com/osanseviero), [@SaulLu](https://github.com/SaulLu), [@lvwerra](https://github.com/lvwerra) |
| [English](https://huggingface.co/course/en/chapter1/1) | [`chapters/en`](https://github.com/huggingface/course/tree/main/chapters/en) | [@sgugger](https://github.com/sgugger), [@lewtun](https://github.com/lewtun), [@LysandreJik](https://github.com/LysandreJik), [@Rocketknight1](https://github.com/Rocketknight1), [@sashavor](https://github.com/sashavor), [@osanseviero](https://github.com/osanseviero), [@SaulLu](https://github.com/SaulLu), [@lvwerra](https://github.com/lvwerra) |

### Translating the course into your language

As part of our mission to democratise machine learning, we'd love to have the course available in many more languages! Please follow the steps below if you'd like to help translate the course into your language 🙏.

**🗞️ Open an issue**

To get started, navigate to the [_Issues_](https://github.com/huggingface/course/issues) page of this repo and check if anyone else has opened an issue for your language. If not, open a new issue by selecting the _Translation template_ from the _New issue_ button.

Once an issue is created, post a comment to indicate which chapters you'd like to work on and we'll add your name to the list.

**🍴 Fork the repository**

To get started, you'll first need to [fork this repo](https://docs.github.com/en/get-started/quickstart/fork-a-repo). You can do this by clicking on the **Fork** button on the top-right corner of this repo's page.
Next, you'll need to [fork this repo](https://docs.github.com/en/get-started/quickstart/fork-a-repo). You can do this by clicking on the **Fork** button on the top-right corner of this repo's page.

Once you've forked the repo, you'll want to get the files on your local machine for editing. You can do that by cloning the fork with Git as follows:

```bash
git clone https://github.com/YOUR-USERNAME/course
```

**📋 Copy-paste the English version with a new language code**
**📋 Copy-paste the English files with a new language code**

The course files are organised into two main directories:
The course files are organised under a main directory:

* [`chapters`](https://github.com/huggingface/course/tree/master/chapters): all the text and code snippets associated with the course.
* [`huggingface-course/documentation-images`](https://huggingface.co/datasets/huggingface-course/documentation-images): repository that contains all the images and GIFs for the course website.
* [`chapters`](https://github.com/huggingface/course/tree/main/chapters): all the text and code snippets associated with the course.

You'll only need to copy the files in the [`chapters/en`](https://github.com/huggingface/course/tree/master/chapters/en) directory, so first navigate to your fork of the repo and run the following:
You'll only need to copy the files in the [`chapters/en`](https://github.com/huggingface/course/tree/main/chapters/en) directory, so first navigate to your fork of the repo and run the following:

```bash
cd ~/path/to/course
cp -r chapters/en chapters/LANG-ID
cp -r chapters/en/CHAPTER-NUMBER chapters/LANG-ID/CHAPTER-NUMBER
```

Here, `LANG-ID` should be one of the ISO 639-1 or ISO 639-2 language codes -- see [here](https://www.loc.gov/standards/iso639-2/php/code_list.php) for a handy table.
Here, `CHAPTER-NUMBER` refers to the chapter you'd like to work on and `LANG-ID` should be one of the ISO 639-1 or ISO 639-2 language codes -- see [here](https://www.loc.gov/standards/iso639-2/php/code_list.php) for a handy table.

**✍️ Start translating**

Now comes the fun part - translating the text! The first thing we recommend is translating the `_chapters.yml` file. This file is used to render the table of contents on the website and provide the links to the Colab notebooks. The only fields you should change are `title`, `subtitle`, and `sections`. For example, here are the parts of `_chapters.yml` that we'd translate for [Chapter 0](https://huggingface.co/course/chapter0/1?fw=pt):
Now comes the fun part - translating the text! The first thing we recommend is translating the part of the `_toctree.yml` file that corresponds to your chapter. This file is used to render the table of contents on the website and provide the links to the Colab notebooks. The only fields you should change are the `title`, ones -- for example, here are the parts of `_toctree.yml` that we'd translate for [Chapter 0](https://huggingface.co/course/chapter0/1?fw=pt):

```yaml
- title: Setup # Translate this!
subtitle: This course looks cool, how can I run its code? # Translate this!
- title: 0. Setup # Translate this!
sections:
- Setting up a working environment # Translate this!
- local: chapter0/1 # Do not change this!
title: Introduction # Translate this!
```
Once you have translated the `_chapters.yml` file, you can start translating the [MDX](https://mdxjs.com/) files associated with each chapter. We recommend opening a pull request once you've translated Chapter 0 so that we can test that the website renders correctly.
Once you have translated the `_toctree.yml` file, you can start translating the [MDX](https://mdxjs.com/) files associated with your chapter.

> 🙋 If you'd like others to help you with the translation, you can either [open an issue](https://github.com/huggingface/course/issues), post in our [forums](https://discuss.huggingface.co/c/course/20), or tag @_lewtun on Twitter to gain some visibility.
> 🙋 If the `_toctree.yml` file doesn't yet exist for your language, you can simply create one by copy-pasting from the English version and deleting the sections that aren't related to your chapter. Just make sure it exists in the `chapters/LANG-ID/` directory!

## 📔 Jupyter notebooks

Expand All @@ -77,7 +82,7 @@ Adding a new chapter to the course is quite simple:

1. Create a new directory under `chapters/en/chapterX`, where `chapterX` is the chapter you'd like to add.
2. Add numbered MDX files `sectionX.mdx` for each section. If you need to include images, place them in the [huggingface-course/documentation-images](https://huggingface.co/datasets/huggingface-course/documentation-images) repository and use the [HTML Images Syntax](https://www.w3schools.com/html/html_images.asp) with the path `https://huggingface.co/datasets/huggingface-course/documentation-images/resolve/main/{langY}/{chapterX}/{your-image.png}`.
3. Update the `_chapters.yml` file to include your chapter sections -- this information will render the table of contents on the website. If your section involves both the PyTorch and TensorFlow APIs of `transformers`, make sure you include links to both Colabs in the `colab` field.
3. Update the `_toctree.yml` file to include your chapter sections -- this information will render the table of contents on the website. If your section involves both the PyTorch and TensorFlow APIs of `transformers`, make sure you include links to both Colabs in the `colab` field.

If you get stuck, check out one of the existing chapters -- this will often show you the expected syntax.

Expand Down
6 changes: 3 additions & 3 deletions chapters/en/_toctree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
sections:
- local: chapter0/1
title: Introduction

- title: 1. Transformer models
sections:
- local: chapter1/1
Expand All @@ -26,7 +26,7 @@
- local: chapter1/10
title: End-of-chapter quiz
quiz: 1

- title: 2. Using 🤗 Transformers
sections:
- local: chapter2/1
Expand All @@ -46,7 +46,7 @@
- local: chapter2/8
title: End-of-chapter quiz
quiz: 2

- title: 3. Fine-tuning a pretrained model
sections:
- local: chapter3/1
Expand Down

0 comments on commit d4b920b

Please sign in to comment.