Skip to content

Commit

Permalink
Merge pull request Byaidu#399 from namazuchin/feature/env-config-gui-…
Browse files Browse the repository at this point in the history
…lang
  • Loading branch information
Byaidu authored Jan 4, 2025
2 parents abdff65 + eb9bd9a commit ca813fd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
22 changes: 22 additions & 0 deletions docs/README_GUI.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,28 @@ This subfolder provides the GUI mode of `pdf2zh`.

2. Drop the PDF file into the window and click `Translate`.

### Environment Variables

You can set the source and target languages using environment variables:

- `PDF2ZH_LANG_FROM`: Sets the source language. Defaults to "English".
- `PDF2ZH_LANG_TO`: Sets the target language. Defaults to "Simplified Chinese".

### Supported Languages

The following languages are supported:

- English
- Simplified Chinese
- Traditional Chinese
- French
- German
- Japanese
- Korean
- Russian
- Spanish
- Italian

## Preview

<img src="./images/before.png" width="500"/>
Expand Down
4 changes: 2 additions & 2 deletions pdf2zh/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,12 @@ def progress_bar(t: tqdm.tqdm):
lang_from = gr.Dropdown(
label="Translate from",
choices=lang_map.keys(),
value="English",
value=os.getenv("PDF2ZH_LANG_FROM", "English"),
)
lang_to = gr.Dropdown(
label="Translate to",
choices=lang_map.keys(),
value="Simplified Chinese",
value=os.getenv("PDF2ZH_LANG_TO", "Simplified Chinese"),
)
page_range = gr.Radio(
choices=page_map.keys(),
Expand Down

0 comments on commit ca813fd

Please sign in to comment.