setup + added some terms

This commit is contained in:
CT
2026-05-19 19:19:16 -05:00
parent d8ea860e50
commit a91846e44a
4 changed files with 84 additions and 70 deletions

View File

@@ -0,0 +1 @@
# foreignthon-zh

View File

@@ -3,16 +3,17 @@ requires = ["hatchling"]
build-backend = "hatchling.build" build-backend = "hatchling.build"
[project] [project]
name = "foreignthon-template" # TODO: Modify to language code name = "foreignthon-zh"
version = "0.0.0" version = "0.1.0"
description = "[Template] language pack for ForeignThon." # TODO: Replace [Template] description = "Chinese language pack for ForeignThon."
license = { text = "GPL v3" } license = { text = "GPL v3" }
requires-python = ">=3.9" requires-python = ">=3.9"
authors = [ 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 keywords = ["foreignthon", "chinese", "中文", "mandarin"]
dependencies = ["foreignthon>=0.5.3"] # TODO: Update Version to Latest
dependencies = ["foreignthon>=0.5.3"]
classifiers = [ classifiers = [
"Programming Language :: Python :: 3", "Programming Language :: Python :: 3",
@@ -21,10 +22,10 @@ classifiers = [
] ]
[project.urls] [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"] [project.entry-points."foreignthon.langs"]
template = "foreignthon_template" # TODO: Swap in format "code = foreignthon_code" zh = "foreignthon_zh"
[tool.hatch.build.targets.wheel] [tool.hatch.build.targets.wheel]
packages = ["src/foreignthon_template"] # TODO: Change to src/foreignthon_code packages = ["src/foreignthon_zh"]

View File

@@ -1,5 +1,5 @@
from importlib.metadata import PackageNotFoundError, metadata, version
from importlib.resources import files from importlib.resources import files
from importlib.metadata import version, metadata, PackageNotFoundError
try: try:
package_name = (__package__ or "").replace("_", "-") package_name = (__package__ or "").replace("_", "-")
@@ -13,7 +13,7 @@ try:
# 2. Combine them into one single, clean list of unique names # 2. Combine them into one single, clean list of unique names
combined = [] combined = []
for item in (raw_authors + raw_emails): for item in raw_authors + raw_emails:
clean_name = item.split("<")[0].strip() clean_name = item.split("<")[0].strip()
if clean_name and clean_name not in combined: if clean_name and clean_name not in combined:
combined.append(clean_name) combined.append(clean_name)
@@ -24,6 +24,6 @@ except PackageNotFoundError:
__version__ = "0.0.0" __version__ = "0.0.0"
__authors__ = [] __authors__ = []
def get_pack_path(): def get_pack_path():
# TODO: Modify this path return files(__name__) / "zh.json"
return files(__name__) / "template.json"

View File

@@ -1,65 +1,71 @@
{ {
"meta": { "meta": {
"name": "Template", "name": "Chinese",
"native_name": "Template", "native_name": "中文",
"code": "template" "code": "zh"
}, },
"keywords": { "keywords": {
"if": "if", "如果": "if",
"else": "else", "否则": "else",
"elif": "elif", "不然": "elif",
"for": "for", "对于": "for",
"while": "while", "只要": "while",
"def": "def", "函数": "def",
"class": "class", "定义": "def",
"return": "return", "": "class",
"break": "break", "类别": "class",
"continue": "continue", "导入": "import",
"pass": "pass", "": "from",
"try": "try", "": "as",
"except": "except", "返回": "return",
"finally": "finally", "打断": "break",
"raise": "raise", "继续": "continue",
"with": "with", "忽略": "pass",
"import": "import", "": "try",
"from": "from", "失败": "except",
"as": "as", "然后": "finally",
"in": "in", "提出": "raise",
"is": "is", "": "with",
"and": "and", "": "in",
"or": "or", "": "is",
"not": "not", "": "and",
"del": "del", "": "or",
"global": "global", "": "not",
// "删除": "del",
"共用": "global",
"nonlocal": "nonlocal", "nonlocal": "nonlocal",
"assert": "assert", "断言": "assert",
"yield": "yield", "yield": "yield",
"await": "await", "await": "await",
"async": "async", "async": "async",
"lambda": "lambda", "lambda": "lambda",
"True": "True", "": "True",
"False": "False", "": "False",
"None": "None" "": "None"
}, },
"builtins": { "builtins": {
"print": "print", "": "print",
"input": "input", "打印": "print",
"len": "len", "扫描": "input",
"range": "range", "长度": "len",
"type": "type", "范围": "range",
"int": "int", "类型": "type",
"float": "float", "数字": "int",
"str": "str", "浮点数": "float",
"list": "list", "字符串": "str",
"dict": "dict", "列表": "list",
"set": "set", "字典": "dict",
"tuple": "tuple", "序列": "set",
"bool": "bool", "元組": "tuple",
"布尔": "bool",
"open": "open", "open": "open",
"enumerate": "enumerate", "enumerate": "enumerate",
"map": "map", "map": "map",
"filter": "filter", "filter": "filter",
"sorted": "sorted", "排序": "sort",
"已排序": "sorted",
"反向": "reverse",
"已反向": "reversed",
"sum": "sum", "sum": "sum",
"min": "min", "min": "min",
"max": "max", "max": "max",
@@ -67,10 +73,19 @@
"round": "round", "round": "round",
"all": "all", "all": "all",
"any": "any", "any": "any",
"isinstance": "isinstance",
"hasattr": "hasattr",
"getattr": "getattr",
"setattr": "setattr",
"repr": "repr",
"format": "format",
"vars": "vars",
"next": "next", "next": "next",
"id": "id", "id": "id",
"chr": "chr", "chr": "chr",
"reversed": "reversed" "十六进制": "hex",
"二进制": "bin",
"八进制": "oct"
}, },
"exceptions": { "exceptions": {
"Exception": "Exception", "Exception": "Exception",
@@ -116,17 +131,14 @@
"KeyboardInterrupt": "KeyboardInterrupt" "KeyboardInterrupt": "KeyboardInterrupt"
}, },
"stdlib": { "stdlib": {
"math": "math", "数学": "math",
"sys": "sys", "系统": "sys",
"datetime": "datetime", "日期时间": "datetime",
"time": "time", "时间": "time",
"random": "random", "random": "random",
"collections": "collections", "collections": "collections",
"pathlib": "pathlib", "pathlib": "pathlib",
"re": "re" "re": "re"
}, },
"postfix_keywords": []
"postfix_keywords": [ }
]
}