Skip to content

Commit

Permalink
update locale
Browse files Browse the repository at this point in the history
  • Loading branch information
DoroWolf authored Mar 25, 2024
1 parent 9171375 commit 5882c5c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 14 deletions.
8 changes: 4 additions & 4 deletions modules/dice/locales/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
"dice.message.dc.failed": "Failed!",
"dice.message.dc.invalid": "Invalid DC: ",
"dice.message.dc.success": "Success!",
"dice.message.set.success": "Successfully set the default sides to ${face}.",
"dice.message.set.clear": "Successfully cleared the default sides.",
"dice.message.error": "Unable to parse the dice expression: ",
"dice.message.error.invalid": "Unrecognized characters in dice expression.",
"dice.message.error.prompt": "Item ${i} occurs: ",
Expand All @@ -18,18 +16,20 @@
"dice.message.error.value.k.invalid": "Invalid advantages and disadvantages.",
"dice.message.error.value.k.out_of_range": "The number of advantage and disadvantage dice is greater than the total number of dice.",
"dice.message.error.value.m.invalid": "Invalid number of dice.",
"dice.message.error.value.m.out_of_range": "The number of dice cannot be less than 1 or greater than ${max}.",
"dice.message.error.value.n.d1": "D1?",
"dice.message.error.value.n.invalid": "Invalid sides number of dice.",
"dice.message.error.value.n.less_2": "The sides number of dice cannot be less than 2.",
"dice.message.error.value.N.out_of_range": "The number of dice roll cannot be less than 1 or greater than ${max}.",
"dice.message.error.value.m.out_of_range": "The number of dice cannot be less than 1 or greater than ${max}.",
"dice.message.error.value.too_long": "The number of items in the dice expression exceeds the limit.",
"dice.message.error.value.y.invalid": "Invalid adjustment value.",
"dice.message.error.value.y.out_of_range": "The adjustment value cannot be less than ${min} or greater than ${max}.",
"dice.message.N.invalid": "Invalid number of dice rolls: ",
"dice.message.N.invalid": "Invalid number of dice rolls.",
"dice.message.output": "Your result: ",
"dice.message.output.too_long": "${length} items have been omitted",
"dice.message.rule.disable": "The check rule has been changed to forward.",
"dice.message.rule.enable": "The check rule has been changed to reverse.",
"dice.message.set.clear": "Successfully cleared the default sides.",
"dice.message.set.success": "Successfully set the default sides to ${face}.",
"dice.message.too_long": "Output is too long..."
}
8 changes: 4 additions & 4 deletions modules/dice/locales/zh_cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
"dice.message.dc.failed": "判定失败!",
"dice.message.dc.invalid": "无效的 DC:",
"dice.message.dc.success": "判定成功!",
"dice.message.set.success": "成功设置骰子默认面数为 ${face}。",
"dice.message.set.clear": "成功清除骰子默认面数。",
"dice.message.error": "无法解析骰子表达式:",
"dice.message.error.invalid": "骰子表达式中存在无法识别的字符。",
"dice.message.error.prompt": "第 ${i} 项发生:",
Expand All @@ -18,18 +16,20 @@
"dice.message.error.value.k.invalid": "无效的优劣势。",
"dice.message.error.value.k.out_of_range": "优劣势骰数大于总骰子数。",
"dice.message.error.value.m.invalid": "无效的骰子数量。",
"dice.message.error.value.m.out_of_range": "骰子数量不得小于 1 或大于 ${max}。",
"dice.message.error.value.n.d1": "1 面的骰子?",
"dice.message.error.value.n.invalid": "无效的骰子面数。",
"dice.message.error.value.n.less_2": "骰子面数不得小于 2。",
"dice.message.error.value.N.out_of_range": "投骰次数不得小于 1 或大于 ${max}。",
"dice.message.error.value.m.out_of_range": "骰子数量不得小于 1 或大于 ${max}。",
"dice.message.error.value.too_long": "骰子表达式项数超过限制。",
"dice.message.error.value.y.invalid": "无效的调节值项。",
"dice.message.error.value.y.out_of_range": "调节值不得小于 ${min} 或大于 ${max}。",
"dice.message.N.invalid": "无效的投骰次数",
"dice.message.N.invalid": "无效的投骰次数",
"dice.message.output": "你掷得的结果是:",
"dice.message.output.too_long": "数量过大,已省略 ${length} 条数据",
"dice.message.rule.disable": "判定规则已更改为正向。",
"dice.message.rule.enable": "判定规则已更改为反向。",
"dice.message.set.clear": "成功清除骰子默认面数。",
"dice.message.set.success": "成功设置骰子默认面数为 ${face}。",
"dice.message.too_long": "输出过长……"
}
8 changes: 4 additions & 4 deletions modules/dice/locales/zh_tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
"dice.message.dc.failed": "判定失敗!",
"dice.message.dc.invalid": "無效的 DC:",
"dice.message.dc.success": "判定成功!",
"dice.message.set.success": "成功設定預設骰子面數為 ${face}。",
"dice.message.set.clear": "成功清除預設骰子面數。",
"dice.message.error": "無法解析骰子運算式:",
"dice.message.error.invalid": "骰子語句中存在無法辨識的字元。",
"dice.message.error.prompt": "第 ${i} 項發生:",
Expand All @@ -18,18 +16,20 @@
"dice.message.error.value.k.invalid": "無效的優劣勢。",
"dice.message.error.value.k.out_of_range": "優劣势骰數大於總骰子數。",
"dice.message.error.value.m.invalid": "無效的骰子數量。",
"dice.message.error.value.m.out_of_range": "骰子數量不得小於 1 或大於 ${max}。",
"dice.message.error.value.n.d1": "1 面的骰子?",
"dice.message.error.value.n.invalid": "無效的骰子面數。",
"dice.message.error.value.n.less_2": "骰子面數不得小於 2。",
"dice.message.error.value.m.out_of_range": "骰子數量不得小於 1 或大於 ${max}。",
"dice.message.error.value.N.out_of_range": "投骰次數不得小於 1 或大於 ${max}。",
"dice.message.error.value.too_long": "骰子運算式項數超過限制。",
"dice.message.error.value.y.invalid": "無效的調整值項。",
"dice.message.error.value.y.out_of_range": "調整值不得小於 ${min} 或大於 ${max}。",
"dice.message.N.invalid": "無效的投骰次數",
"dice.message.N.invalid": "無效的投骰次數",
"dice.message.output": "你掷得的結果是:",
"dice.message.output.too_long": "數量過大,已省略 ${length} 條資訊",
"dice.message.rule.disable": "判定規則已更改為正向。",
"dice.message.rule.enable": "判定規則已更改為反向。",
"dice.message.set.clear": "成功清除預設骰子面數。",
"dice.message.set.success": "成功設定預設骰子面數為 ${face}。",
"dice.message.too_long": "輸出過長……"
}
6 changes: 4 additions & 2 deletions modules/dice/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ def parse_dice_expression(msg, dices):
else:
times = '1'
if not times.isdigit():
return None, None, None, DiceValueError(msg, msg.locale.t('dice.message.N.invalid'), times).message
errmsg = msg.locale.t('dice.message.N.invalid')
return None, None, None, DiceValueError(msg, msg.locale.t('dice.message.error') + '\n' + errmsg).message

dice_expr_list = re.split(f'{math_func_pattern}|' + '|'.join(patterns), dices, flags=re.I)
dice_expr_list = [item for item in dice_expr_list if item] # 清除空白元素
Expand All @@ -96,7 +97,8 @@ def parse_dice_expression(msg, dices):

Logger.debug(dice_expr_list)
if len(dice_item_list) > MAX_ITEM_COUNT:
return None, None, None, DiceValueError(msg, msg.locale.t('dice.message.error.value.too_long')).message
errmsg = msg.locale.t('dice.message.error.value.too_long')
return None, None, None, DiceValueError(msg, msg.locale.t('dice.message.error') + '\n' + errmsg).message

dice_count = 0
# 初始化骰子序列
Expand Down

0 comments on commit 5882c5c

Please sign in to comment.