Skip to content

Commit

Permalink
Update script and localize
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-Chara committed Sep 15, 2024
1 parent 3f879be commit 2c40653
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 6 deletions.
68 changes: 68 additions & 0 deletions data/server/languages/zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@
"key": "Arming bomb... %d",
"value": "C4安装中... %d"
},
{
"key": "Ball",
"value": "球类模式"
},
{
"key": "Battle Royale",
"value": "大逃杀"
},
{
"key": "Blue team scores!",
"value": "蓝队得分!"
Expand All @@ -84,6 +92,10 @@
"key": "Bomb disarmed - Blue team wins",
"value": "炸弹被解除 - 蓝队胜利"
},
{
"key": "Capture the flag",
"value": "夺旗模式"
},
{
"key": "Cyborg wave cleared",
"value": "赛博格被全部击退"
Expand All @@ -96,6 +108,10 @@
"key": "Death takes all",
"value": "死神永生"
},
{
"key": "Deathmatch",
"value": "死亡竞赛"
},
{
"key": "Disarming bomb... %d",
"value": "C4拆除中... %d"
Expand All @@ -116,6 +132,10 @@
"key": "Everybody dies",
"value": "无人生还"
},
{
"key": "Extra explosive death match!",
"value": "爆炸就是艺术!"
},
{
"key": "Furries terminated",
"value": "兽人被全歼"
Expand All @@ -132,6 +152,10 @@
"key": "Go!",
"value": "走你!"
},
{
"key": "Grenade Deathmatch",
"value": "榴弹死亡竞技"
},
{
"key": "Hide",
"value": "嘘————"
Expand All @@ -140,6 +164,10 @@
"key": "Highest level reached on server: %d",
"value": "该服务器闯到的最高关卡: %d"
},
{
"key": "Instakill CTF",
"value": "瞬杀夺旗"
},
{
"key": "Invalid client id to kick",
"value": "无效的客户端ID"
Expand All @@ -152,6 +180,10 @@
"key": "Invalid spectator id used",
"value": "无效的旁观者ID"
},
{
"key": "Invasion",
"value": "入侵"
},
{
"key": "KILL!",
"value": "杀!!"
Expand Down Expand Up @@ -184,6 +216,14 @@
"key": "Ocean of blood",
"value": "血流成河"
},
{
"key": "PvE",
"value": "合作"
},
{
"key": "Reactor Bomber",
"value": "爆破反应堆"
},
{
"key": "Reactor defense",
"value": "保护反应堆"
Expand Down Expand Up @@ -252,6 +292,10 @@
"key": "Stage completed",
"value": "阶段性胜利"
},
{
"key": "Team deathmatch",
"value": "团队死斗"
},
{
"key": "Teams are locked",
"value": "队伍被锁定了"
Expand Down Expand Up @@ -392,10 +436,34 @@
"key": "admin moved '%s' to spectator (%s)",
"value": "管理员把 '%s' 移到了旁观者 (%s)"
},
{
"key": "ball_small1.map - no bots",
"value": "ball_small1.map - 无AI"
},
{
"key": "ball_small2.map - no bots",
"value": "ball_small2.map - 无AI"
},
{
"key": "blue",
"value": ""
},
{
"key": "generated map",
"value": "自动生成地图"
},
{
"key": "generated map - last man standing",
"value": "自动生成地图 - 活到最后"
},
{
"key": "generated match",
"value": "自动生成地图"
},
{
"key": "reactor1.map - survival mode PvP",
"value": "reactor1.map - 生存模式PvP"
},
{
"key": "red",
"value": ""
Expand Down
14 changes: 8 additions & 6 deletions scripts/Json/Parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@

unique_labels = set() # 使用集合来避免重复

def help_localize(directory, tpattern):
def help_localize(directory, suffix, tpattern):
pattern = re.compile(tpattern, re.IGNORECASE)
for root, dirs, files in os.walk(directory):
for filename in files:
if filename.endswith('.cpp'):
if filename.endswith(suffix):
# 获取完整文件路径
file_path = os.path.join(root, filename)
# 打开并读取文件内容
Expand All @@ -31,10 +31,12 @@ def help_localize(directory, tpattern):
with open(labelfile, "w") as fw: # 使用 "w" 而不是 "a" 来覆盖旧文件
fw.writelines(sorted(unique_labels)) # 对标签进行排序并写入文件

help_localize("src/game/server/", 'Localize\\("(.+?)"')
help_localize("src/game/server/", 'SendChatTarget\\([^,]*, "(.+?)"')
help_localize("src/game/server/", 'SendBroadcast\\("(.+?)"')
help_localize("src/game/server/", 'SendBroadcastFormat\\([^,]*, [^,]*, "(.+?)"')
help_localize("src/game/server/", '.cpp', 'Localize\\("(.+?)"')
help_localize("src/game/server/", '.cpp', 'SendChatTarget\\([^,]*, "(.+?)"')
help_localize("src/game/server/", '.cpp', 'SendBroadcast\\("(.+?)"')
help_localize("src/game/server/", '.cpp', 'SendBroadcastFormat\\([^,]*, [^,]*, "(.+?)"')
help_localize("data/server/gamevotes", '.vot', 'name: (.*)')
help_localize("data/server/gamevotes", '.vot', 'description: (.*)')



Expand Down

0 comments on commit 2c40653

Please sign in to comment.