diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 7bb4e04..390fcce 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,16 +1,20 @@ # Contributing -You're welcome to contribute to the code! +You're welcome to contribute to the [code](#contributing-to-the-code) or to the [translations](#contributing-to-the-translations)! -## Coding style +## Contributing to the code + +Create a new branch describing what your're working on, for example `feature/{name-of-the-feature}` or `theme/{name-of-the-theme}`. When you're done, commit all your changes and create a new merge request. + +### Coding style Please follow the coding style of each file. -## Copyright notice +### Copyright notice If you make changes to a file, please add your copyright notice at the top of the file, in the form `Copyright (C) YEAR Your Name`. -## Themes and unit tests +### Themes and unit tests If you add support for a theme, please write a unit test for each of its variants, in the `tests` directory, with the theme name as filename. Unit tests are written for [AVA](https://github.com/avajs/ava) and run with node and npm. @@ -25,3 +29,43 @@ To run the tests: ```bash make test ``` + +## Contributing to the translations + +The extension uses Gettext for its localization. When working on a translation, create a new branch named `translation/{language}`. + +### Updating an existing translation + +First update all the strings in the source code: + +```bash +make pot +``` + +Then update the translations files: + +```bash +make update-po +``` + +You can then edit the language you want in `src/po/`, either by hand or with a tool like [GNOME Translation Editor](https://wiki.gnome.org/Apps/Gtranslator). + +When you're done, commit both the `.pot` file and the `.po` file you've worked on and create a new merge request. + +### Adding a new translation + +First update all the strings in the source code: + +```bash +make pot +``` + +Then run the following command, replacing `{language-code}` with the [actual code](https://www.loc.gov/standards/iso639-2/php/code_list.php) of the language you want to add: + +```bash +make add-po LANGUAGE_CODE={language-code} +``` + +You can then edit the new `{language-code}.po` file in `src/po/`, either by hand or with a tool like [GNOME Translation Editor](https://wiki.gnome.org/Apps/Gtranslator). + +When you're done, commit both the `.pot` file and the `.po` file you've worked on and create a new merge request. diff --git a/README.md b/README.md index e4421e0..6cf3b7d 100644 --- a/README.md +++ b/README.md @@ -59,4 +59,4 @@ gnome-extensions enable nightthemeswitcher@romainvigier.fr ## Contributing -See [CONTRIBUTING.md](./CONTRIBUTING.md). +You're welcome to contribute to the code or the translations! See [CONTRIBUTING.md](./CONTRIBUTING.md).