Skip to content

Contributing

bhch edited this page Nov 10, 2020 · 3 revisions

Index:

  1. Contributing code
  2. Contributing translations
    1. Writing English translations
    2. Writing other translations
    3. Formatting guidelines

1. Contributing code

You can contribute code to:

  1. scripts: written in Python.
  2. website: written in React.

Contributing code is straight-forward, like you contribute to any other project—fork it, clone it, modify code, send pull request.


2. Contributing translations

Translations files are written in YAML format.

2.1. Writing English translations

The English translation file (translations/en.yaml) is used as the starting point for other translations. Terms and phrases are first added to English file and later translated into other languages.

It also contains some extra information about each term which is helpful for the frontend website.

Terms in English file has these keys:

  1. description: (string) Description of the term, such as how or where it is used.
  2. variants: (key-value pairs) Spelling variants of the term.
  3. tags: (array) Tags are used in the project's website to group similar terms together.
  4. similar: (array) Similar terms are used in the project's website for recommending related terms.

Examples

Color:
  description: Label for the word "Color".
  variants:
    Colour: UK # British spelling 
  tags:
    - label
    - button

Variants can have an empty value:

Email:
  description: Label for email form field. 
  variants:
    E mail:
    E-mail:
  tags:
    - label

Tags can have these values:

  1. label: For form field labels, text used on links or headings.
  2. button: For text used on buttons.
  3. error message: For error messages.
  4. success message: For success messages.
  5. confirmation message: For non destructive confirmation messages.
  6. warning message: For warnings and destructive confirmation messages.

You can create new tags if the above listed tags don't fit into any other category.

2.2. Writing other translations

2.2.1. Creating new translation file

Run this python script to create an empty skeleton:

$ python scripts/create.py --name=Spanish --code=es

The create.py script will create a new translation file using the code argument. In this case, it will create a file called es.yaml inside translations directory.

You can also create localised translation files:

$ python scripts/create.py --name="Mexican Spanish" --code=es-MX

This will create a file called es-MX.yaml file in the translations directory.

For languages, that are written right-to-left, you can also specify the direction:

$ python scripts/create.py --name=Arabic --code=ar --direction=rtl

You can open the newly created file add the translations for the terms.

2.2.2. Updating translation files with new terms

When new terms are added to the English file and you want those new terms to appear in another language's translation file, you can run this helper script:

$ python scripts/update.py --filename=es.yaml

2.3. Formatting guidelines

  1. Use two spaces for indentation.
  2. Start all terms with a capital letter.
  3. Don't use capital letters for words after first word. Eg. Terms of use and not Terms of Use.
  4. Use American spellings and show British spellings in the variants key.
  5. Use full-stop at the end of the description.
  6. Leave one blank line between terms.