Update contributing

This commit is contained in:
Romain Vigier
2020-02-27 09:44:06 +01:00
parent 4ef6baccd6
commit 18abccfb20
2 changed files with 49 additions and 5 deletions
+48 -4
View File
@@ -1,16 +1,20 @@
# Contributing # 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. 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`. 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. 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 ```bash
make test 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.
+1 -1
View File
@@ -59,4 +59,4 @@ gnome-extensions enable nightthemeswitcher@romainvigier.fr
## Contributing ## Contributing
See [CONTRIBUTING.md](./CONTRIBUTING.md). You're welcome to contribute to the code or the translations! See [CONTRIBUTING.md](./CONTRIBUTING.md).