Skip to content

Commit

Permalink
Merge pull request #6 from OverflowCat/i18n
Browse files Browse the repository at this point in the history
feat(i18n): add `en` locale
  • Loading branch information
yzqzss authored Aug 16, 2023
2 parents 3a55b3a + 742f92b commit 67c4ef2
Show file tree
Hide file tree
Showing 21 changed files with 1,451 additions and 350 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/python-package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,15 @@ jobs:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt install gettext
python -m pip install --upgrade pip
python -m pip install poetry ruff pytest
python -m pip install poetry pytest
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
poetry install
pip install -e .
- name: build
run: |
python build.py
- name: Lint with ruff
uses: chartboost/ruff-action@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ config.json
.venv/
__pycache__/
videos/
.vscode/
.vscode/settings.json
bilibili_archive_dir/
dist/
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"charliermarsh.ruff",
"tamasfe.even-better-toml",
"esbenp.prettier-vscode"
]
}
77 changes: 76 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,79 @@ pip install biliarchiver

## Usage

待补充。
```bash
biliarchiver --help
```

Follow these steps to start archiving:

1. Initialize a new workspace in current working directory:
```bash
biliarchiver init
```
2. Provide cookies and tokens following instructions:
```bash
biliarchiver auth
```
3. Download videos from BiliBili:
```bash
biliarchiver down --bvids BVXXXXXXXXX
```
- This command also accepts a list of BVIDs or path to a file. Details can be found in `biliarchiver down --help`.
4. Upload videos to Internet Archive:
```bash
biliarchiver up --bvids BVXXXXXXXXX
```
- This command also accepts a list of BVIDs or path to a file. Details can be found in `biliarchiver up --help`.

## Develop

### Install

Please use poetry to install dependencies:

```sh
poetry install
```

Build English locale if necessary. Refer to the last section for details.

### Run

```sh
poetry run biliarchiver --help
```

### Lint

```sh
poetry run ruff check .
```

### i18n

To generate and build locales, you need a GNU gettext compatible toolchain. You can install `mingw` and use `sh` to enter a bash shell on Windows.

Generate `biliarchiver.pot`:

```sh
find biliarchiver/ -name '*.py' | xargs xgettext -d base -o biliarchiver/locales/biliarchiver.pot
```

Add a new language:

```sh
msginit -i biliarchiver/locales/biliarchiver.pot -o en.po -l en
```

Update a language:

```sh
pnpx gpt-po sync --po biliarchiver/locales/en/LC_MESSAGES/biliarchiver.po --pot biliarchiver/locales/biliarchiver.pot
```

**(Important)** Build a language:

```sh
msgfmt biliarchiver/locales/en/LC_MESSAGES/biliarchiver.po -o biliarchiver/locales/en/LC_MESSAGES/biliarchiver.mo
```
Loading

0 comments on commit 67c4ef2

Please sign in to comment.