Skip to content

Commit

Permalink
Add usage information
Browse files Browse the repository at this point in the history
  • Loading branch information
CoolCat467 committed Feb 12, 2024
1 parent dffae87 commit f2a8d55
Showing 1 changed file with 47 additions and 8 deletions.
55 changes: 47 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,29 +17,68 @@ Supports MineOS lang files, which is the main purpose of this project's existenc
pip install git+https://github.com/CoolCat467/Localization-Translation-Utility.git
```

Simply run `auto_trans.py` and everything else except fixing comment positions is done.
## Usage
WARNING: Creating hundreds of new files takes up a lot of space on your computer!
This program may require more than 3.5 MB to store the new localizations alone!

```console
> mineos_translate
usage: mineos_translate [-h] [-V] [-u | -b | -l] [-f FILENAME] [-k KEY]

options:
-h, --help show this help message and exit
-V, --version show program's version number and exit
-u, --unhandled Translate unhandled languages
-b, --broken Translate broken values
-l, --lolcat Translate to lolcat

-f FILENAME, --filename FILENAME
-k KEY, --key KEY
```

The program will download `Installer/Files.cfg` from MineOS repo, save downloaded files
to `cache` folder it creates, and then for every language code in `languages.py` (from
https://github.com/ssut/py-googletrans/blob/master/googletrans/constants.py)
When run with any valid option, program will download `Installer/Files.cfg` from
MineOS repo, save downloaded files to `mineos_cache` folder it creates in the current working directory,
and save translated results in `mineos_upload` folder it creates in the current working directory.

### Unhandled mode
For every language code in `languages.py` (from https://github.com/ssut/py-googletrans/blob/master/googletrans/constants.py)
it will use google translate with different user agents from `agents.py` (from
https://github.com/Animenosekai/useragents/blob/main/pyuseragents/data/list.py) to translate
the English localization to that language and save the new file in the `Upload` folder
the English localization to that language and save the new file in the `mineos_upload` folder
it creates.

WARNING: Creating hundreds of new files takes up a lot of space on your computer!
This program may require more than 3.5 MB to store the new localizations alone!
### Broken mode
For all existing localization files, if the value is identical to the value the English localization uses,
translate the value from the English localization to that language using google translate and save new file
in the `mineos_upload` folder it creates.

### Lolcat mode
For all localization directories, if an English localization exists and there is not a Lolcat translation,
use web scraper to talk to `funtranslations.com/lolcat` and translate the English localization to Lolcat
and save new file in the `mineos_upload` folder the program creates.

### Translating a new key for a specific program
Pass the filename and key parameters and the program will get the English localization of the program specified
by the folder given as the `filename` input and will use google translate to translate the localization
key specified by the `key` parameter. New files saved in the `mineos_upload` folder the program creates.


General code layout:

`auto_trans.py` is the glue holding everything together, and is what you run as the main script.
`cli.py` is the command line interface handler.

`mineos_auto_trans.py` is the glue holding everything together.

`convert.py` handles making MineOS `.lang` and `.cfg` files json-parsable and translating
entire files at once.

`translate.py` handles talking to Google Translate

`extricate.py` (name means taking apart and putting back together) is used by the translation
module to split dictionaries into a keys list and a values list so it can translate all the
values and then rebuild the dictionary by re-combining the keys list and the new translated
values list.

`agents.py` from https://github.com/Animenosekai/useragents/blob/main/pyuseragents/data/list.py
is by Anime no Sekai and has a ton of random user agents to use so Google Translate
doesn't get suspicious of us sending tens of thousands of requests without an API key
Expand Down

0 comments on commit f2a8d55

Please sign in to comment.