1
0
mirror of https://github.com/Morganamilo/paru synced 2024-07-08 16:55:45 +00:00
paru/CONTRIBUTING.md

92 lines
2.1 KiB
Markdown
Raw Normal View History

2021-06-27 12:57:37 +00:00
# Contributing to paru
## Formatting
Please format the code using `cargo fmt`
## Building
Paru is built with cargo.
To build paru use:
```
cargo build
```
To run paru use:
```
`cargo run -- <args>
```
Paru has a couple of feature flags which you may want to enable:
- backtrace: generate backtraces when errors occur (requires nightly)
2021-06-27 12:57:37 +00:00
- git: target the libalpm-git API
- generate: generate the libalpm bindings at build time (requires clang)
2021-06-27 12:57:37 +00:00
2021-06-27 16:48:35 +00:00
### Building Against a Custom libalpm
2021-06-27 12:57:37 +00:00
If you wish to build against a custom libalpm you can specify **ALPM_LIB_DIR** while using the generate
feature. Then running with **LD_LIBRARY_PATH** pointed at the custom libalpm.so.
## Testing
2021-06-29 02:31:47 +00:00
Paru's test suite can be run by running:
2021-06-27 12:57:37 +00:00
```
cargo test --features mock -- --test-threads=1
```
## Translating
2021-06-29 02:31:47 +00:00
See https://github.com/Morganamilo/paru/discussions/433 for discussion on localization.
2021-06-28 21:37:56 +00:00
You probably want to subscribe to this to be nodified when translations need to be updated.
2021-06-27 16:48:35 +00:00
### New Languages
2021-06-28 16:30:02 +00:00
When translating to a new language try to stick to languages pacman already supports:
https://gitlab.archlinux.org/pacman/pacman/-/tree/master/src/pacman/po. For example using
`es` over `es_ES`.
2021-06-29 02:31:47 +00:00
To translate paru to a new language, copy the the template .pot file to the locale you
2021-06-27 12:57:37 +00:00
are translating to.
For example, to translate paru to Japanese you would do:
```
cp po/paru.pot po/jp.po
```
Then fill out the template file with your information and translation.
2021-06-28 03:48:08 +00:00
Alternatively, you can use programs like `poedit` to write the translations.
2021-06-27 16:48:35 +00:00
### Updating existing translations
To update existing translations against new code you must first update the
2021-06-29 08:01:44 +00:00
template file then update the .po files.
2021-06-27 16:48:35 +00:00
Do this as its own commit.
2021-06-27 16:48:35 +00:00
Updating the template requires [xtr](https://github.com/woboq/tr) to be installed.
```
./scripts/mkpot
./scripts/updpo
git commit po
2021-06-27 16:48:35 +00:00
```
Then fill in new strings.
### Testing Translations
2021-06-27 12:57:37 +00:00
To test the translations you first must build the translation then run paru
pointing it at the generated files.
```
./scripts/mkmo locale/
LOCALE_DIR=locale/ cargo run -- <args>
```