From a91846e44a80843c9f1015f7fe40d871b3747b26 Mon Sep 17 00:00:00 2001 From: CT Date: Tue, 19 May 2026 19:19:16 -0500 Subject: [PATCH] setup + added some terms --- README.md | 1 + pyproject.toml | 19 +-- .../__init__.py | 8 +- .../template.json => foreignthon_zh/zh.json} | 126 ++++++++++-------- 4 files changed, 84 insertions(+), 70 deletions(-) rename src/{foreignthon_template => foreignthon_zh}/__init__.py (79%) rename src/{foreignthon_template/template.json => foreignthon_zh/zh.json} (57%) diff --git a/README.md b/README.md index e69de29..9bcf1fb 100644 --- a/README.md +++ b/README.md @@ -0,0 +1 @@ +# foreignthon-zh diff --git a/pyproject.toml b/pyproject.toml index 553f31b..f5a3cfd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,16 +3,17 @@ requires = ["hatchling"] build-backend = "hatchling.build" [project] -name = "foreignthon-template" # TODO: Modify to language code -version = "0.0.0" -description = "[Template] language pack for ForeignThon." # TODO: Replace [Template] +name = "foreignthon-zh" +version = "0.1.0" +description = "Chinese language pack for ForeignThon." license = { text = "GPL v3" } requires-python = ">=3.9" authors = [ - { name = "John Doe", email = "loremipsum@example.com" } # TODO: Swap with real information + { name = "Cody Trainer" }, ] -keywords = ["foreignthon", "template", "template"] # TODO: Swap with real information -dependencies = ["foreignthon>=0.5.3"] # TODO: Update Version to Latest +keywords = ["foreignthon", "chinese", "中文", "mandarin"] + +dependencies = ["foreignthon>=0.5.3"] classifiers = [ "Programming Language :: Python :: 3", @@ -21,10 +22,10 @@ classifiers = [ ] [project.urls] -Homepage = "https://git.keshavanand.net/foreign-thon/foreignthon-template" # TODO: Update URL +Homepage = "https://git.keshavanand.net/foreign-thon/foreignthon-zh" [project.entry-points."foreignthon.langs"] -template = "foreignthon_template" # TODO: Swap in format "code = foreignthon_code" +zh = "foreignthon_zh" [tool.hatch.build.targets.wheel] -packages = ["src/foreignthon_template"] # TODO: Change to src/foreignthon_code \ No newline at end of file +packages = ["src/foreignthon_zh"] diff --git a/src/foreignthon_template/__init__.py b/src/foreignthon_zh/__init__.py similarity index 79% rename from src/foreignthon_template/__init__.py rename to src/foreignthon_zh/__init__.py index 105e737..f637cfc 100644 --- a/src/foreignthon_template/__init__.py +++ b/src/foreignthon_zh/__init__.py @@ -1,5 +1,5 @@ +from importlib.metadata import PackageNotFoundError, metadata, version from importlib.resources import files -from importlib.metadata import version, metadata, PackageNotFoundError try: package_name = (__package__ or "").replace("_", "-") @@ -13,7 +13,7 @@ try: # 2. Combine them into one single, clean list of unique names combined = [] - for item in (raw_authors + raw_emails): + for item in raw_authors + raw_emails: clean_name = item.split("<")[0].strip() if clean_name and clean_name not in combined: combined.append(clean_name) @@ -24,6 +24,6 @@ except PackageNotFoundError: __version__ = "0.0.0" __authors__ = [] + def get_pack_path(): - # TODO: Modify this path - return files(__name__) / "template.json" \ No newline at end of file + return files(__name__) / "zh.json" diff --git a/src/foreignthon_template/template.json b/src/foreignthon_zh/zh.json similarity index 57% rename from src/foreignthon_template/template.json rename to src/foreignthon_zh/zh.json index efa8316..4acc70e 100644 --- a/src/foreignthon_template/template.json +++ b/src/foreignthon_zh/zh.json @@ -1,65 +1,71 @@ { "meta": { - "name": "Template", - "native_name": "Template", - "code": "template" + "name": "Chinese", + "native_name": "中文", + "code": "zh" }, "keywords": { - "if": "if", - "else": "else", - "elif": "elif", - "for": "for", - "while": "while", - "def": "def", - "class": "class", - "return": "return", - "break": "break", - "continue": "continue", - "pass": "pass", - "try": "try", - "except": "except", - "finally": "finally", - "raise": "raise", - "with": "with", - "import": "import", - "from": "from", - "as": "as", - "in": "in", - "is": "is", - "and": "and", - "or": "or", - "not": "not", - "del": "del", - "global": "global", + "如果": "if", + "否则": "else", + "不然": "elif", + "对于": "for", + "只要": "while", + "函数": "def", + "定义": "def", + "类": "class", + "类别": "class", + "导入": "import", + "从": "from", + "名": "as", + "返回": "return", + "打断": "break", + "继续": "continue", + "忽略": "pass", + "试": "try", + "失败": "except", + "然后": "finally", + "提出": "raise", + "同": "with", + "在": "in", + "是": "is", + "和": "and", + "或": "or", + "不": "not", + // "删除": "del", + "共用": "global", "nonlocal": "nonlocal", - "assert": "assert", + "断言": "assert", "yield": "yield", "await": "await", "async": "async", "lambda": "lambda", - "True": "True", - "False": "False", - "None": "None" + "真": "True", + "假": "False", + "空": "None" }, "builtins": { - "print": "print", - "input": "input", - "len": "len", - "range": "range", - "type": "type", - "int": "int", - "float": "float", - "str": "str", - "list": "list", - "dict": "dict", - "set": "set", - "tuple": "tuple", - "bool": "bool", + "写": "print", + "打印": "print", + "扫描": "input", + "长度": "len", + "范围": "range", + "类型": "type", + "数字": "int", + "浮点数": "float", + "字符串": "str", + "列表": "list", + "字典": "dict", + "序列": "set", + "元組": "tuple", + "布尔": "bool", "open": "open", "enumerate": "enumerate", "map": "map", "filter": "filter", - "sorted": "sorted", + "排序": "sort", + "已排序": "sorted", + "反向": "reverse", + "已反向": "reversed", "sum": "sum", "min": "min", "max": "max", @@ -67,10 +73,19 @@ "round": "round", "all": "all", "any": "any", + "isinstance": "isinstance", + "hasattr": "hasattr", + "getattr": "getattr", + "setattr": "setattr", + "repr": "repr", + "format": "format", + "vars": "vars", "next": "next", "id": "id", "chr": "chr", - "reversed": "reversed" + "十六进制": "hex", + "二进制": "bin", + "八进制": "oct" }, "exceptions": { "Exception": "Exception", @@ -116,17 +131,14 @@ "KeyboardInterrupt": "KeyboardInterrupt" }, "stdlib": { - "math": "math", - "sys": "sys", - "datetime": "datetime", - "time": "time", + "数学": "math", + "系统": "sys", + "日期时间": "datetime", + "时间": "time", "random": "random", "collections": "collections", "pathlib": "pathlib", "re": "re" }, - - "postfix_keywords": [ - - ] -} \ No newline at end of file + "postfix_keywords": [] +}