Translating Learning Lab courses into other languages involves a series of simple steps modifying a course's config.yml
file and translating response files.
config.yml
to add language preferences and step translationsIf the course you're translating doesn't have language preferences yet, you will need to add that first. However, you would only want to modify the config.yml
file once all the response files have been translated.
Field | Required | Description |
---|---|---|
type |
✓ | How you would like the preferences to be displayed. For language preferences, the only accepted value is dropdown . |
name |
✓ | Name of the preference. In this case, the value is always going to be language . |
label |
✓ | How you would like the name of the preference to be displayed. For consistency, we strongly suggest using the value Language . |
description |
A one-line description of the language preference. |
Here's an example of how that would look like in an actual config.yml
file:
preferences:
- type: dropdown
name: language
label: Language
description: Choose your preferred language.
Once the language preference has been added, you need to add language options. If the course you're translating was, for example, originally authored in English, then you need to add English and the language you're translating the course into.
Field | Required | Description |
---|---|---|
label |
✓ | The native name of the language. For example, Español for Spanish. |
value |
✓ | A two-letter language code. For example, es for Spanish. |
The final preferences section with language preferences added would look something like this:
preferences:
- type: dropdown
name: language
label: Language
description: Choose your preferred language.
options:
- label: English
value: en
- label: 日本語
value: ja
- label: Español
value: es
After you have finished adding language preferences, it's time to add translations to the steps titles and descriptions. For that, you will need to add a translations
field to each step. Inside the translations field, you'll add a subfield whose name will be the language code of the language you're working with and value will contain a title
field with the step title translated and a description
field with the step description translated. Below, you can find an example of a step from our Introduction to GitHub course that includes a Spanish translation:
# 2
- title: Turn on GitHub Pages
description: Turn on GitHub Pages in the settings page of the repository.
translations:
es:
title: Activa GitHub Pages
description: Activa GitHub Pages en la página de configuración del repositorio.
event: page_build
link: '{{ store.first_issue_url }}'
actions:
- type: octokit
method: repos.getPages
owner: '{{ payload.repository.owner.login }}'
repo: '{{ payload.repository.name }}'
store:
pagesUrl: '{{ result.data.html_url }}'
- type: respond
issue: Getting Started with GitHub
with: close-issue.md
data:
pagesUrl: '{{ store.pagesUrl }}'
Next, you will need to translate the response files. These files contain the text that the Learning Lab bot uses to interact with learners. If you want learners to interact with the bot in another language you need to translate the files under the Responses directory in a course repo (responses/
).
The files that are directly under the responses/
directory are assumed to be the English version of the responses.
To add support for another language, create a new directory under the Responses directory with a name matching the corresponding 2-letter language code, such as responses/es/
for Spanish. Store all of the translated response files into the appropriate language-specific directory.
The following diagram shows how a Responses directory for an English course translated into Japanese and Spanish would look. Inside the es/
and ja/
directories, you'll find the same files as the files directly under the main Responses directory shown below.