Compare commits
5 Commits
develop
...
lang/chine
| Author | SHA1 | Date | |
|---|---|---|---|
| f7de0fc671 | |||
| 773e56b619 | |||
| e5cc2e2feb | |||
| 3fe496f8d9 | |||
| 3093b4328d |
@@ -14,6 +14,7 @@ foreignthon/
|
||||
│ └── langs/
|
||||
│ ├── es/ # foreignthon-es (Spanish)
|
||||
│ └── ta/ # foreignthon-ta (Tamil)
|
||||
| |__ zh/ # foreignthon-zh (Chinese)
|
||||
├── docs/
|
||||
└── .gitea/workflows/
|
||||
├── ci.yml # runs tests + lint on every push
|
||||
@@ -33,6 +34,7 @@ python -m venv .venv && source .venv/bin/activate
|
||||
pip install -e "packages/foreignthon[dev]"
|
||||
pip install -e packages/langs/es
|
||||
pip install -e packages/langs/ta
|
||||
pip install -e packages/langs/zh
|
||||
```
|
||||
|
||||
## Running tests
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
pip install foreignthon
|
||||
pip install foreignthon-es # add Spanish
|
||||
pip install foreignthon-ta # add Tamil
|
||||
pip install foreignthon-zh # add Chinese
|
||||
```
|
||||
|
||||
For CLI use across projects, prefer pipx:
|
||||
@@ -76,5 +77,6 @@ python -m venv .venv && source .venv/bin/activate
|
||||
pip install -e "packages/foreignthon[dev]"
|
||||
pip install -e packages/langs/es
|
||||
pip install -e packages/langs/ta
|
||||
pip install -e packages/langs/zh
|
||||
pytest packages/foreignthon/tests/ -v
|
||||
```
|
||||
|
||||
@@ -8,6 +8,7 @@ A language pack is a JSON file that maps foreign tokens to Python equivalents, p
|
||||
|---|---|---|
|
||||
| `foreignthon-es` | Spanish | `pip install foreignthon-es` |
|
||||
| `foreignthon-ta` | Tamil | `pip install foreignthon-ta` |
|
||||
| `foreignthon-zh` | Chinese | `pip install foreignthon-zh` |
|
||||
|
||||
## JSON schema
|
||||
|
||||
|
||||
1
packages/langs/zh/README.md
Normal file
1
packages/langs/zh/README.md
Normal file
@@ -0,0 +1 @@
|
||||
# foreignthon-zh
|
||||
22
packages/langs/zh/pyproject.toml
Normal file
22
packages/langs/zh/pyproject.toml
Normal file
@@ -0,0 +1,22 @@
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[project]
|
||||
name = "foreignthon-zh"
|
||||
version = "0.1.0"
|
||||
description = "Chinese language pack for ForeignThon."
|
||||
license = { text = "GPL v3" }
|
||||
requires-python = ">=3.9"
|
||||
authors = [
|
||||
{ name = "Cody Trainer" },
|
||||
]
|
||||
keywords = ["foreignthon", "chinese", "中文", "mandarin"]
|
||||
|
||||
dependencies = ["foreignthon>=0.4.1"]
|
||||
|
||||
[project.entry-points."foreignthon.langs"]
|
||||
zh = "foreignthon_zh"
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["src/foreignthon_zh"]
|
||||
5
packages/langs/zh/src/foreignthon_zh/__init__.py
Normal file
5
packages/langs/zh/src/foreignthon_zh/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
from importlib.resources import files
|
||||
|
||||
|
||||
def get_pack_path():
|
||||
return files(__name__) / "zh.json"
|
||||
149
packages/langs/zh/src/foreignthon_zh/zh.json
Normal file
149
packages/langs/zh/src/foreignthon_zh/zh.json
Normal file
@@ -0,0 +1,149 @@
|
||||
{
|
||||
"meta": {
|
||||
"name": "Chinese",
|
||||
"native_name": "中文",
|
||||
"code": "zh",
|
||||
"version": "0.1.0",
|
||||
"authors": []
|
||||
},
|
||||
"keywords": {
|
||||
"如果": "if",
|
||||
"否则": "else",
|
||||
"否": "elif",
|
||||
"对于": "for",
|
||||
"而": "while",
|
||||
"功能": "def",
|
||||
"类": "class",
|
||||
"导入": "import",
|
||||
"从": "from",
|
||||
"como": "as",
|
||||
"返回": "return",
|
||||
"打断": "break",
|
||||
"继续": "continue",
|
||||
"pasar": "pass",
|
||||
"intentar": "try",
|
||||
"excepto": "except",
|
||||
"finalmente": "finally",
|
||||
"提出": "raise",
|
||||
"同": "with",
|
||||
"在": "in",
|
||||
"是": "is",
|
||||
"和": "and",
|
||||
"或": "or",
|
||||
"不": "not",
|
||||
"elim": "del",
|
||||
"global": "global",
|
||||
"nolocal": "nonlocal",
|
||||
"afirmar": "assert",
|
||||
"generar": "yield",
|
||||
"esperar": "await",
|
||||
"asinc": "async",
|
||||
"lambda": "lambda",
|
||||
"真": "True",
|
||||
"假": "False",
|
||||
"空": "None"
|
||||
},
|
||||
"builtins": {
|
||||
"写": "print",
|
||||
"打印": "print",
|
||||
"扫描": "input",
|
||||
"lon": "len",
|
||||
"dist": "range",
|
||||
"型": "type",
|
||||
"数字": "int",
|
||||
"浮点数": "float",
|
||||
"字符串": "str",
|
||||
"列表": "list",
|
||||
"dicc": "dict",
|
||||
"conj": "set",
|
||||
"tupla": "tuple",
|
||||
"布尔": "bool",
|
||||
"abrir": "open",
|
||||
"enumerar": "enumerate",
|
||||
"map": "map",
|
||||
"filtrar": "filter",
|
||||
"ordenado": "sorted",
|
||||
"invertido": "reversed",
|
||||
"sum": "sum",
|
||||
"min": "min",
|
||||
"max": "max",
|
||||
"abs": "abs",
|
||||
"redondear": "round",
|
||||
"rnd": "round",
|
||||
"todos": "all",
|
||||
"alguno": "any",
|
||||
"esinstancia": "isinstance",
|
||||
"teneatri": "hasattr",
|
||||
"obtatri": "getattr",
|
||||
"estabatri": "setattr",
|
||||
"repr": "repr",
|
||||
"formatear": "format",
|
||||
"vars": "vars",
|
||||
"sigue": "next",
|
||||
"id": "id",
|
||||
"car": "chr",
|
||||
"十六进制": "hex",
|
||||
"二进制": "bin",
|
||||
"八进制": "oct"
|
||||
},
|
||||
"exceptions": {
|
||||
"Excepcion": "Exception",
|
||||
"ExcepcionBase": "BaseException",
|
||||
"ErrorDeValor": "ValueError",
|
||||
"ErrorDeTipo": "TypeError",
|
||||
"ErrorDeClave": "KeyError",
|
||||
"ErrorDeIndice": "IndexError",
|
||||
"ErrorDeAtributo": "AttributeError",
|
||||
"ErrorDeNombre": "NameError",
|
||||
"ErrorDeImportacion": "ImportError",
|
||||
"ErrorDelSistema": "OSError",
|
||||
"ArchivoNoEncontrado": "FileNotFoundError",
|
||||
"ErrorDeEjecucion": "RuntimeError",
|
||||
"DetenerIteracion": "StopIteration",
|
||||
"SalidaDelSistema": "SystemExit",
|
||||
"InterrupcionDeTeclado": "KeyboardInterrupt",
|
||||
"ErrorNoImplementado": "NotImplementedError",
|
||||
"ErrorDeDivisionCero": "ZeroDivisionError",
|
||||
"ErrorDeRecursion": "RecursionError",
|
||||
"ErrorDeSintaxis": "SyntaxError",
|
||||
"ErrorDeAfirmacion": "AssertionError",
|
||||
"ErrorDeDesbordamiento": "OverflowError",
|
||||
"ErrorDeMemoria": "MemoryError",
|
||||
"ErrorDePermiso": "PermissionError",
|
||||
"ErrorDeTiempoAgotado": "TimeoutError"
|
||||
},
|
||||
"error_messages": {
|
||||
"SyntaxError": "Error de sintaxis",
|
||||
"ValueError": "Error de valor",
|
||||
"TypeError": "Error de tipo",
|
||||
"KeyError": "Error de clave",
|
||||
"IndexError": "Error de índice",
|
||||
"AttributeError": "Error de atributo",
|
||||
"NameError": "Error de nombre",
|
||||
"ImportError": "Error de importación",
|
||||
"FileNotFoundError": "Archivo no encontrado",
|
||||
"ZeroDivisionError": "Error división por cero",
|
||||
"RecursionError": "Error de recursión",
|
||||
"RuntimeError": "Error de ejecución",
|
||||
"MemoryError": "Error de memoria",
|
||||
"OverflowError": "Error de desbordamiento",
|
||||
"AssertionError": "Error de afirmación",
|
||||
"NotImplementedError": "Error no implementado",
|
||||
"StopIteration": "Detener iteración",
|
||||
"KeyboardInterrupt": "Interrupción de teclado",
|
||||
"PermissionError": "Error de permiso",
|
||||
"TimeoutError": "Error de tiempo agotado"
|
||||
},
|
||||
"stdlib": {
|
||||
"数学": "math",
|
||||
"系统": "sys",
|
||||
"日期时间": "datetime",
|
||||
"时间": "time",
|
||||
"aleatorio": "random",
|
||||
"aleatoria": "random",
|
||||
"colecciones": "collections",
|
||||
"ruta": "pathlib",
|
||||
"er": "re"
|
||||
},
|
||||
"postfix_keywords": []
|
||||
}
|
||||
Reference in New Issue
Block a user