Convert MediaWiki language names and codes
Project description
MediaWiki langcodes
Convert MediaWiki language names and language codes.
Build dependencies
-
php
-
wget
Build
$ python -m venv .venv
$ source .venv/bin/activate.fish
$ python -m pip install -U pip build
$ make
Update extra language names
Extract language names from Lua modules in the Wiktionary dump file, use code from https://github.com/tatuylonen/wiktextract/blob/master/languages/get_data.py
$ python languages/get_data.py en --db-file ../en_20231220.db
$ python languages/get_data.py zh --db-file ../zh_20231220.db
then in this project folder:
// download files
$ make lang_files
// remove old extra files
$ rm build_script/extra_names/*.json
// create a db file without extra languages
$ python build_script/main.py
$ python build_script/add_extra.py en path_to_en_extra_json
// add extra languages from the English Wiktionary
$ python build_script/main.py
$ python build_script/add_extra.py zh path_to_zh_extra_json
Usage
from mediawiki_langcodes import code_to_name, name_to_code
code_to_name("fr") # return "français"
code_to_name("fr", "en") # return "French"
name_to_code("français") # return "fr"
name_to_code("français", "fr") # return "fr"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mediawiki_langcodes-0.2.0.tar.gz.
File metadata
- Download URL: mediawiki_langcodes-0.2.0.tar.gz
- Upload date:
- Size: 4.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b5ad0a1f5168f07064fdd0b8d42cd2055474cee81e4babbdcb7bd4d2b7aa2a67
|
|
| MD5 |
f4e6ef4ec6c003fd74b6531667f6403a
|
|
| BLAKE2b-256 |
f76ed31567b2357cd9f677cca308ac891ae600b0bb27adccc672165ef83b48d5
|
File details
Details for the file mediawiki_langcodes-0.2.0-py3-none-any.whl.
File metadata
- Download URL: mediawiki_langcodes-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.5 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
595816438859efadb6a567e0c441e64975199269fd7ce5b3cba371a50357591c
|
|
| MD5 |
c2e50bd8448a589177f1d2c0163a5a6e
|
|
| BLAKE2b-256 |
b13ffbcb94173e610d706dee2180c9fb0434dbe84589f482438e3186c35671ea
|