This commit is contained in:
Shunsuke Shibayama 2022-08-19 12:32:51 +09:00
commit 580ccddfe5
8 changed files with 150 additions and 7 deletions

View file

@ -59,6 +59,8 @@ impl DeserializeError {
fn_name!(), fn_name!(),
switch_lang!( switch_lang!(
"japanese" => "読み込んだ.pycファイルは破損しています", "japanese" => "読み込んだ.pycファイルは破損しています",
"simplified_chinese" => "加载的.pyc文件已损坏",
"traditional_chinese" => "加載的.pyc文件已損壞",
"english" => "the loaded .pyc file is broken", "english" => "the loaded .pyc file is broken",
), ),
) )
@ -73,6 +75,14 @@ impl DeserializeError {
"{}型オブジェクトを予期しましたが、 読み込んだオブジェクトは{}型です", "{}型オブジェクトを予期しましたが、 読み込んだオブジェクトは{}型です",
expect, found expect, found
), ),
"simplified_chinese" => format!(
"期望一个{}对象,但反序列化的对象是{}",
expect, found
),
"traditional_chinese" => format!(
"期望一個{}對象,但反序列化的對像是{}",
expect, found
),
"english" => format!( "english" => format!(
"expect a {} object, but the deserialized object is {}", "expect a {} object, but the deserialized object is {}",
expect, found expect, found
@ -229,6 +239,8 @@ impl Deserializer {
fn_name!(), fn_name!(),
switch_lang!( switch_lang!(
"japanese" => format!("このオブジェクトは復元できません: {}", other), "japanese" => format!("このオブジェクトは復元できません: {}", other),
"simplified_chinese" => format!("无法反序列化此对象:{}", other),
"traditional_chinese" => format!("無法反序列化此對象:{}", other),
"english" => format!("cannot deserialize this object: {}", other), "english" => format!("cannot deserialize this object: {}", other),
), ),
)), )),
@ -302,6 +314,8 @@ impl Deserializer {
fn_name!(), fn_name!(),
switch_lang!( switch_lang!(
"japanese" => "バイト列の読み込みに失敗しました", "japanese" => "バイト列の読み込みに失敗しました",
"simplified_chinese" => "未能加载字节",
"traditional_chinese" => "未能加載字節",
"english" => "failed to load bytes", "english" => "failed to load bytes",
), ),
)); ));

View file

@ -327,6 +327,8 @@ impl ErrorCore {
loc, loc,
switch_lang!( switch_lang!(
"japanese" => format!("これはErgのバグです、開発者に報告して下さい (https://github.com/...)\n{fn_name}:{line}より発生"), "japanese" => format!("これはErgのバグです、開発者に報告して下さい (https://github.com/...)\n{fn_name}:{line}より発生"),
"simplified_chinese" => format!("这是Erg的bug请报告给https://github.com/...\n原因来自:{fn_name}:{line}"),
"traditional_chinese" => format!("这是Erg的bug请报告给https://github.com/...\n原因来自:{fn_name}:{line}"),
"english" => format!("this is a bug of Erg, please report it to https://github.com/...\ncaused from: {fn_name}:{line}"), "english" => format!("this is a bug of Erg, please report it to https://github.com/...\ncaused from: {fn_name}:{line}"),
), ),
None, None,

View file

@ -327,6 +327,8 @@ impl ValueObj {
"{}", "{}",
switch_lang!( switch_lang!(
"japanese" => format!("このオブジェクトはシリアライズできません: {other}"), "japanese" => format!("このオブジェクトはシリアライズできません: {other}"),
"simplified_chinese" => format!("此对象无法序列化:{other}"),
"traditional_chinese" => format!("此對象無法序列化:{other}"),
"english" => format!("this object cannot be serialized: {other}"), "english" => format!("this object cannot be serialized: {other}"),
) )
) )

View file

@ -145,6 +145,8 @@ impl CompileError {
loc, loc,
switch_lang!( switch_lang!(
"japanese" => format!("これはErg compilerのバグです、開発者に報告して下さい (https://github.com/...)\n{fn_name}:{line}より発生"), "japanese" => format!("これはErg compilerのバグです、開発者に報告して下さい (https://github.com/...)\n{fn_name}:{line}より発生"),
"simplified_chinese" => format!("这是Erg编译器的错误请报告给https://github.com/...\n原因来自:{fn_name}:{line}"),
"traditional_chinese" => format!("這是Erg編譯器的錯誤請報告給https://github.com/...\n原因來自:{fn_name}:{line}"),
"english" => format!("this is a bug of the Erg compiler, please report it to https://github.com/...\ncaused from: {fn_name}:{line}"), "english" => format!("this is a bug of the Erg compiler, please report it to https://github.com/...\ncaused from: {fn_name}:{line}"),
), ),
None, None,
@ -170,6 +172,12 @@ impl CompileError {
"japanese" => format!("スタックの要素数が異常です (要素数: {stack_len}, ブロックID: {block_id})\n\ "japanese" => format!("スタックの要素数が異常です (要素数: {stack_len}, ブロックID: {block_id})\n\
(https://github.com/...)\n\ (https://github.com/...)\n\
{fn_name}"), {fn_name}"),
"simplified_chinese" => format!("堆栈中的元素数无效(元素数:{stack_len}块id{block_id}\n\
Erg (https://github.com/...)\n\
{fn_name}"),
"traditional_chinese" => format!("堆棧中的元素數無效(元素數:{stack_len}塊id{block_id}\n\
Erg (https://github.com/...)\n\
{fn_name}"),
"english" => format!("the number of elements in the stack is invalid (num of elems: {stack_len}, block id: {block_id})\n\ "english" => format!("the number of elements in the stack is invalid (num of elems: {stack_len}, block id: {block_id})\n\
this is a bug of the Erg compiler, please report it (https://github.com/...)\n\ this is a bug of the Erg compiler, please report it (https://github.com/...)\n\
caused from: {fn_name}"), caused from: {fn_name}"),
@ -189,7 +197,8 @@ impl CompileError {
loc, loc,
switch_lang!( switch_lang!(
"japanese" => format!("この機能({name})はまだ正式に提供されていません"), "japanese" => format!("この機能({name})はまだ正式に提供されていません"),
"simplified_chinese" => format!("该功能({name})还没有正式提供"), "simplified_chinese" => format!("此功能({name})尚未实现"),
"traditional_chinese" => format!("此功能({name})尚未實現"),
"english" => format!("this feature({name}) is not implemented yet"), "english" => format!("this feature({name}) is not implemented yet"),
), ),
None, None,
@ -206,8 +215,10 @@ impl CompileError {
SystemExit, SystemExit,
Location::Unknown, Location::Unknown,
switch_lang!( switch_lang!(
"japanese" => format!("システムを終了します"), "japanese" => "システムを終了します",
"english" => format!("system is exiting"), "simplified_chinese" => "系统正在退出",
"traditional_chinese" => "系統正在退出",
"english" => "system is exiting",
), ),
None, None,
), ),
@ -240,6 +251,8 @@ impl TyCheckError {
loc, loc,
switch_lang!( switch_lang!(
"japanese" => format!("これはErg compilerのバグです、開発者に報告して下さい (https://github.com/...)\n{fn_name}:{line}より発生"), "japanese" => format!("これはErg compilerのバグです、開発者に報告して下さい (https://github.com/...)\n{fn_name}:{line}より発生"),
"simplified_chinese" => format!("这是Erg编译器的错误请报告给https://github.com/...\n原因来自:{fn_name}:{line}"),
"traditional_chinese" => format!("這是Erg編譯器的錯誤請報告給https://github.com/...\n原因來自:{fn_name}:{line}"),
"english" => format!("this is a bug of the Erg compiler, please report it to https://github.com/...\ncaused from: {fn_name}:{line}"), "english" => format!("this is a bug of the Erg compiler, please report it to https://github.com/...\ncaused from: {fn_name}:{line}"),
), ),
None, None,
@ -256,6 +269,8 @@ impl TyCheckError {
loc, loc,
switch_lang!( switch_lang!(
"japanese" => format!("この機能({name})はまだ正式に提供されていません"), "japanese" => format!("この機能({name})はまだ正式に提供されていません"),
"simplified_chinese" => format!("此功能({name})尚未实现"),
"traditional_chinese" => format!("此功能({name})尚未實現"),
"english" => format!("this feature({name}) is not implemented yet"), "english" => format!("this feature({name}) is not implemented yet"),
), ),
None, None,
@ -286,6 +301,8 @@ impl TyCheckError {
loc, loc,
switch_lang!( switch_lang!(
"japanese" => format!("{name}は既に宣言されています"), "japanese" => format!("{name}は既に宣言されています"),
"simplified_chinese" => format!("{name}已声明"),
"traditional_chinese" => format!("{name}已聲明"),
"english" => format!("{name} is already declared"), "english" => format!("{name} is already declared"),
), ),
Option::<Str>::None, Option::<Str>::None,
@ -310,6 +327,8 @@ impl TyCheckError {
loc, loc,
switch_lang!( switch_lang!(
"japanese" => format!("{name}{GREEN}{spec_t}{RESET}型として宣言されましたが、{RED}{found_t}{RESET}型のオブジェクトが代入されています"), "japanese" => format!("{name}{GREEN}{spec_t}{RESET}型として宣言されましたが、{RED}{found_t}{RESET}型のオブジェクトが代入されています"),
"simplified_chinese" => format!("{name}被声明为{GREEN}{spec_t}{RESET},但分配了一个{RED}{found_t}{RESET}对象"),
"traditional_chinese" => format!("{name}被聲明為{GREEN}{spec_t}{RESET},但分配了一個{RED}{found_t}{RESET}對象"),
"english" => format!("{name} was declared as {GREEN}{spec_t}{RESET}, but an {RED}{found_t}{RESET} object is assigned"), "english" => format!("{name} was declared as {GREEN}{spec_t}{RESET}, but an {RED}{found_t}{RESET} object is assigned"),
), ),
Option::<Str>::None, Option::<Str>::None,
@ -327,6 +346,8 @@ impl TyCheckError {
loc, loc,
switch_lang!( switch_lang!(
"japanese" => format!("{name}の型が指定されていません"), "japanese" => format!("{name}の型が指定されていません"),
"simplified_chinese" => format!("{name}的类型未指定"),
"traditional_chinese" => format!("{name}的類型未指定"),
"english" => format!("the type of {name} is not specified"), "english" => format!("the type of {name} is not specified"),
), ),
None, None,
@ -347,6 +368,8 @@ impl TyCheckError {
let n = readable_name(n); let n = readable_name(n);
switch_lang!( switch_lang!(
"japanese" => format!("似た名前の変数があります: {n}"), "japanese" => format!("似た名前の変数があります: {n}"),
"simplified_chinese" => format!("存在相同名称变量:{n}"),
"traditional_chinese" => format!("存在相同名稱變量:{n}"),
"english" => format!("exists a similar name variable: {n}"), "english" => format!("exists a similar name variable: {n}"),
) )
.into() .into()
@ -358,6 +381,8 @@ impl TyCheckError {
loc, loc,
switch_lang!( switch_lang!(
"japanese" => format!("{RED}{name}{RESET}という変数は定義されていません"), "japanese" => format!("{RED}{name}{RESET}という変数は定義されていません"),
"simplified_chinese" => format!("{RED}{name}{RESET}未定义"),
"traditional_chinese" => format!("{RED}{name}{RESET}未定義"),
"english" => format!("{RED}{name}{RESET} is not defined"), "english" => format!("{RED}{name}{RESET} is not defined"),
), ),
hint, hint,
@ -378,6 +403,8 @@ impl TyCheckError {
let n = readable_name(n); let n = readable_name(n);
switch_lang!( switch_lang!(
"japanese" => format!("似た名前の属性があります: {n}"), "japanese" => format!("似た名前の属性があります: {n}"),
"simplified_chinese" => format!("具有相同名称的属性:{n}"),
"traditional_chinese" => format!("具有相同名稱的屬性:{n}"),
"english" => format!("has a similar name attribute: {n}"), "english" => format!("has a similar name attribute: {n}"),
) )
.into() .into()
@ -389,6 +416,8 @@ impl TyCheckError {
loc, loc,
switch_lang!( switch_lang!(
"japanese" => format!("{obj_t}型オブジェクトに{RED}{name}{RESET}という属性はありません"), "japanese" => format!("{obj_t}型オブジェクトに{RED}{name}{RESET}という属性はありません"),
"simplified_chinese" => format!("{obj_t}对象没有属性{RED}{name}{RESET}"),
"traditional_chinese" => format!("{obj_t}對像沒有屬性{RED}{name}{RESET}"),
"english" => format!("{obj_t} object has no attribute {RED}{name}{RESET}"), "english" => format!("{obj_t} object has no attribute {RED}{name}{RESET}"),
), ),
hint, hint,
@ -413,6 +442,8 @@ impl TyCheckError {
"japanese" => format!( "japanese" => format!(
"{callee}は{param_ts}を引数に取る呼び出し可能オブジェクトではありません" "{callee}は{param_ts}を引数に取る呼び出し可能オブジェクトではありません"
), ),
"simplified_chinese" => format!("{callee}不是以{param_ts}作为参数的可调用对象"),
"traditional_chinese" => format!("{callee}不是以{param_ts}作為參數的可調用對象"),
"english" => format!( "english" => format!(
"{callee} is not a Callable object that takes {param_ts} as an argument" "{callee} is not a Callable object that takes {param_ts} as an argument"
), ),
@ -438,6 +469,8 @@ impl TyCheckError {
loc, loc,
switch_lang!( switch_lang!(
"japanese" => format!("{name}の型が違います。\n予期した型: {GREEN}{expect}{RESET}\n与えられた型: {RED}{found}{RESET}"), "japanese" => format!("{name}の型が違います。\n予期した型: {GREEN}{expect}{RESET}\n与えられた型: {RED}{found}{RESET}"),
"simplified_chinese" => format!("{name}的类型不匹配:\n预期:{GREEN}{expect}{RESET}\n但找到:{RED}{found}{RESET}"),
"traditional_chinese" => format!("{name}的類型不匹配:\n預期:{GREEN}{expect}{RESET}\n但找到:{RED}{found}{RESET}"),
"english" => format!("the type of {name} is mismatched:\nexpected: {GREEN}{expect}{RESET}\nbut found: {RED}{found}{RESET}"), "english" => format!("the type of {name} is mismatched:\nexpected: {GREEN}{expect}{RESET}\nbut found: {RED}{found}{RESET}"),
), ),
None, None,
@ -461,6 +494,8 @@ impl TyCheckError {
loc, loc,
switch_lang!( switch_lang!(
"japanese" => format!("{name}の戻り値の型が違います。\n予期した型: {GREEN}{expect}{RESET}\n与えられた型: {RED}{found}{RESET}"), "japanese" => format!("{name}の戻り値の型が違います。\n予期した型: {GREEN}{expect}{RESET}\n与えられた型: {RED}{found}{RESET}"),
"simplified_chinese" => format!("{name}的返回类型不匹配:\n预期:{GREEN}{expect}{RESET}\n但找到:{RED}{found}{RESET}"),
"traditional_chinese" => format!("{name}的返回類型不匹配:\n預期:{GREEN}{expect}{RESET}\n但找到:{RED}{found}{RESET}"),
"english" => format!("the return type of {name} is mismatched:\nexpected: {GREEN}{expect}{RESET}\nbut found: {RED}{found}{RESET}"), "english" => format!("the return type of {name} is mismatched:\nexpected: {GREEN}{expect}{RESET}\nbut found: {RED}{found}{RESET}"),
), ),
None, None,
@ -483,6 +518,8 @@ impl TyCheckError {
loc, loc,
switch_lang!( switch_lang!(
"japanese" => format!("{name}: {t}は初期化されていません"), "japanese" => format!("{name}: {t}は初期化されていません"),
"simplified_chinese" => format!("{name}{t}未初始化"),
"traditional_chinese" => format!("{name}{t}未初始化"),
"english" => format!("{name}: {t} is not initialized"), "english" => format!("{name}: {t} is not initialized"),
), ),
None, None,
@ -505,6 +542,8 @@ impl TyCheckError {
loc, loc,
switch_lang!( switch_lang!(
"japanese" => format!("ポジショナル引数の数が違います。\n予期した個数: {GREEN}{expect}{RESET}\n与えられた個数: {RED}{found}{RESET}"), "japanese" => format!("ポジショナル引数の数が違います。\n予期した個数: {GREEN}{expect}{RESET}\n与えられた個数: {RED}{found}{RESET}"),
"simplified_chinese" => format!("正则参数的数量不匹配:\n预期:{GREEN}{expect}{RESET}\n但找到:{RED}{found}{RESET}"),
"traditional_chinese" => format!("正則參數的數量不匹配:\n預期:{GREEN}{expect}{RESET}\n但找到:{RED}{found}{RESET}"),
"english" => format!("the number of positional arguments is mismatched:\nexpected: {GREEN}{expect}{RESET}\nbut found: {RED}{found}{RESET}"), "english" => format!("the number of positional arguments is mismatched:\nexpected: {GREEN}{expect}{RESET}\nbut found: {RED}{found}{RESET}"),
), ),
None, None,
@ -521,6 +560,8 @@ impl TyCheckError {
loc, loc,
switch_lang!( switch_lang!(
"japanese" => format!("{expr_t}型の全パターンを網羅していません"), "japanese" => format!("{expr_t}型の全パターンを網羅していません"),
"simplified_chinese" => format!("并非所有{expr_t}类型的模式都被涵盖"),
"traditional_chinese" => format!("並非所有{expr_t}類型的模式都被涵蓋"),
"english" => format!("not all patterns of type {expr_t} are covered"), "english" => format!("not all patterns of type {expr_t} are covered"),
), ),
None, None,
@ -537,6 +578,8 @@ impl TyCheckError {
loc, loc,
switch_lang!( switch_lang!(
"japanese" => format!("{expr}の型が推論できません"), "japanese" => format!("{expr}の型が推論できません"),
"simplified_chinese" => format!("无法推断{expr}的类型"),
"traditional_chinese" => format!("無法推斷{expr}的類型"),
"english" => format!("failed to infer the type of {expr}"), "english" => format!("failed to infer the type of {expr}"),
), ),
None, None,
@ -562,6 +605,8 @@ impl TyCheckError {
loc, loc,
switch_lang!( switch_lang!(
"japanese" => format!("定数{name}には再代入できません"), "japanese" => format!("定数{name}には再代入できません"),
"simplified_chinese" => format!("不能为不可变变量{name}分配两次"),
"traditional_chinese" => format!("不能為不可變變量{name}分配兩次"),
"english" => format!("cannot assign twice to the immutable variable {name}"), "english" => format!("cannot assign twice to the immutable variable {name}"),
), ),
None, None,
@ -591,6 +636,18 @@ impl TyCheckError {
: {GREEN}{params_len}{RESET} : {GREEN}{params_len}{RESET}
: {RED}{pos_args_len}{RESET} : {RED}{pos_args_len}{RESET}
: {RED}{kw_args_len}{RESET}" : {RED}{kw_args_len}{RESET}"
),
"simplified_chinese" => format!("传递给{name}的参数过多。
{GREEN}{params_len}{RESET}
{RED}{pos_args_len}{RESET}
{RED}{kw_args_len}{RESET}
"
),
"traditional_chinese" => format!("傳遞給{name}的參數過多。
{GREEN}{params_len}{RESET}
{RED}{pos_args_len}{RESET}
{RED}{kw_args_len}{RESET}
"
), ),
"english" => format!( "english" => format!(
"too many arguments for {name}: "too many arguments for {name}:
@ -620,6 +677,8 @@ passed keyword args: {RED}{kw_args_len}{RESET}"
loc, loc,
switch_lang!( switch_lang!(
"japanese" => format!("{name}の引数{RED}{arg_name}{RESET}が複数回渡されています"), "japanese" => format!("{name}の引数{RED}{arg_name}{RESET}が複数回渡されています"),
"simplified_chinese" => format!("{name}的参数{RED}{arg_name}{RESET}被多次传递"),
"traditional_chinese" => format!("{name}的參數{RED}{arg_name}{RESET}被多次傳遞"),
"english" => format!("{name}'s argument {RED}{arg_name}{RESET} is passed multiple times"), "english" => format!("{name}'s argument {RED}{arg_name}{RESET} is passed multiple times"),
), ),
None, None,
@ -643,6 +702,8 @@ passed keyword args: {RED}{kw_args_len}{RESET}"
loc, loc,
switch_lang!( switch_lang!(
"japanese" => format!("{name}には予期しないキーワード引数{RED}{param_name}{RESET}が渡されています"), "japanese" => format!("{name}には予期しないキーワード引数{RED}{param_name}{RESET}が渡されています"),
"simplified_chinese" => format!("{name}得到了意外的关键字参数{RED}{param_name}{RESET}"),
"traditional_chinese" => format!("{name}得到了意外的關鍵字參數{RED}{param_name}{RESET}"),
"english" => format!("{name} got unexpected keyword argument {RED}{param_name}{RESET}"), "english" => format!("{name} got unexpected keyword argument {RED}{param_name}{RESET}"),
), ),
None, None,
@ -660,6 +721,8 @@ passed keyword args: {RED}{kw_args_len}{RESET}"
loc, loc,
switch_lang!( switch_lang!(
"japanese" => format!("{YELLOW}{name}{RESET}は使用されていません"), "japanese" => format!("{YELLOW}{name}{RESET}は使用されていません"),
"simplified_chinese" => format!("{YELLOW}{name}{RESET}未使用"),
"traditional_chinese" => format!("{YELLOW}{name}{RESET}未使用"),
"english" => format!("{YELLOW}{name}{RESET} is not used"), "english" => format!("{YELLOW}{name}{RESET} is not used"),
), ),
None, None,
@ -689,6 +752,8 @@ passed keyword args: {RED}{kw_args_len}{RESET}"
loc, loc,
switch_lang!( switch_lang!(
"japanese" => format!("型の単一化に失敗しました:\n左辺: {YELLOW}{lhs_t}{RESET}\n右辺: {YELLOW}{rhs_t}{RESET}"), "japanese" => format!("型の単一化に失敗しました:\n左辺: {YELLOW}{lhs_t}{RESET}\n右辺: {YELLOW}{rhs_t}{RESET}"),
"simplified_chinese" => format!("类型统一失败:\n左边:{YELLOW}{lhs_t}{RESET}\n右边:{YELLOW}{rhs_t}{RESET}"),
"traditional_chinese" => format!("類型統一失敗:\n左邊:{YELLOW}{lhs_t}{RESET}\n右邊:{YELLOW}{rhs_t}{RESET}"),
"english" => format!("unification failed:\nlhs: {YELLOW}{lhs_t}{RESET}\nrhs: {YELLOW}{rhs_t}{RESET}"), "english" => format!("unification failed:\nlhs: {YELLOW}{lhs_t}{RESET}\nrhs: {YELLOW}{rhs_t}{RESET}"),
), ),
None, None,
@ -718,6 +783,8 @@ passed keyword args: {RED}{kw_args_len}{RESET}"
loc, loc,
switch_lang!( switch_lang!(
"japanese" => format!("型の再単一化に失敗しました:\n左辺: {YELLOW}{lhs_t}{RESET}\n右辺: {YELLOW}{rhs_t}{RESET}"), "japanese" => format!("型の再単一化に失敗しました:\n左辺: {YELLOW}{lhs_t}{RESET}\n右辺: {YELLOW}{rhs_t}{RESET}"),
"simplified_chinese" => format!("重新统一类型失败:\n左边:{YELLOW}{lhs_t}{RESET}\n右边:{YELLOW}{rhs_t}{RESET}"),
"traditional_chinese" => format!("重新統一類型失敗:\n左邊:{YELLOW}{lhs_t}{RESET}\n右邊:{YELLOW}{rhs_t}{RESET}"),
"english" => format!("re-unification failed:\nlhs: {YELLOW}{lhs_t}{RESET}\nrhs: {YELLOW}{rhs_t}{RESET}"), "english" => format!("re-unification failed:\nlhs: {YELLOW}{lhs_t}{RESET}\nrhs: {YELLOW}{rhs_t}{RESET}"),
), ),
None, None,
@ -747,6 +814,8 @@ passed keyword args: {RED}{kw_args_len}{RESET}"
loc, loc,
switch_lang!( switch_lang!(
"japanese" => format!("部分型制約を満たせません:\nサブタイプ: {YELLOW}{sub_t}{RESET}\nスーパータイプ: {YELLOW}{sup_t}{RESET}"), "japanese" => format!("部分型制約を満たせません:\nサブタイプ: {YELLOW}{sub_t}{RESET}\nスーパータイプ: {YELLOW}{sup_t}{RESET}"),
"simplified_chinese" => format!("无法满足子类型约束:\n子类型:{YELLOW}{sub_t}{RESET}\n超类型:{YELLOW}{sup_t}{RESET}"),
"traditional_chinese" => format!("無法滿足子類型約束:\n子類型:{YELLOW}{sub_t}{RESET}\n超類型:{YELLOW}{sup_t}{RESET}"),
"english" => format!("subtype constraints cannot be satisfied:\nsubtype: {YELLOW}{sub_t}{RESET}\nsupertype: {YELLOW}{sup_t}{RESET}"), "english" => format!("subtype constraints cannot be satisfied:\nsubtype: {YELLOW}{sub_t}{RESET}\nsupertype: {YELLOW}{sup_t}{RESET}"),
), ),
None, None,
@ -768,6 +837,8 @@ passed keyword args: {RED}{kw_args_len}{RESET}"
Location::Unknown, Location::Unknown,
switch_lang!( switch_lang!(
"japanese" => format!("述語式の単一化に失敗しました:\n左辺: {YELLOW}{lhs}{RESET}\n右辺: {YELLOW}{rhs}{RESET}"), "japanese" => format!("述語式の単一化に失敗しました:\n左辺: {YELLOW}{lhs}{RESET}\n右辺: {YELLOW}{rhs}{RESET}"),
"simplified_chinese" => format!("无法统一谓词表达式:\n左边:{YELLOW}{lhs}{RESET}\n左边:{YELLOW}{rhs}{RESET}"),
"traditional_chinese" => format!("無法統一謂詞表達式:\n左邊:{YELLOW}{lhs}{RESET}\n左邊:{YELLOW}{rhs}{RESET}"),
"english" => format!("predicate unification failed:\nlhs: {YELLOW}{lhs}{RESET}\nrhs: {YELLOW}{rhs}{RESET}"), "english" => format!("predicate unification failed:\nlhs: {YELLOW}{lhs}{RESET}\nrhs: {YELLOW}{rhs}{RESET}"),
), ),
None, None,
@ -783,8 +854,10 @@ passed keyword args: {RED}{kw_args_len}{RESET}"
HasEffect, HasEffect,
expr.loc(), expr.loc(),
switch_lang!( switch_lang!(
"japanese" => format!("この式には副作用があります"), "japanese" => "この式には副作用があります",
"english" => format!("this expression causes a side-effect"), "simplified_chinese" => "此表达式会产生副作用",
"traditional_chinese" => "此表達式會產生副作用",
"english" => "this expression causes a side-effect",
), ),
None, None,
), ),
@ -809,6 +882,14 @@ passed keyword args: {RED}{kw_args_len}{RESET}"
"{RED}{name}{RESET}は{}行目ですでに移動されています", "{RED}{name}{RESET}は{}行目ですでに移動されています",
moved_loc.ln_begin().unwrap() moved_loc.ln_begin().unwrap()
), ),
"simplified_chinese" => format!(
"{RED}{name}{RESET}已移至第{}行",
moved_loc.ln_begin().unwrap()
),
"traditional_chinese" => format!(
"{RED}{name}{RESET}已移至第{}行",
moved_loc.ln_begin().unwrap()
),
"english" => format!( "english" => format!(
"{RED}{name}{RESET} was moved in line {}", "{RED}{name}{RESET} was moved in line {}",
moved_loc.ln_begin().unwrap() moved_loc.ln_begin().unwrap()

View file

@ -70,12 +70,16 @@ impl ASTLowerer {
self.ctx.name.clone(), self.ctx.name.clone(),
switch_lang!( switch_lang!(
"japanese" => "式の評価結果が使われていません", "japanese" => "式の評価結果が使われていません",
"simplified_chinese" => "表达式评估结果未使用",
"traditional_chinese" => "表達式評估結果未使用",
"english" => "the evaluation result of the expression is not used", "english" => "the evaluation result of the expression is not used",
), ),
Some( Some(
switch_lang!( switch_lang!(
"japanese" => "値を使わない場合は、discard関数を使用してください", "japanese" => "値を使わない場合は、discard関数を使用してください",
"english" => "if you don't use the value, use `discard` function", "simplified_chinese" => "如果您不想使用该值请使用discard函数",
"traditional_chinese" => "如果您不想使用該值請使用discard函數",
"english" => "if you don't use the value, use discard function",
) )
.into(), .into(),
), ),

View file

@ -27,6 +27,8 @@ impl LexError {
loc, loc,
switch_lang!( switch_lang!(
"japanese" => format!("これはErg compilerのバグです、開発者に報告して下さい (https://github.com/mtshiba/erg)\n{fn_name}:{line}より発生"), "japanese" => format!("これはErg compilerのバグです、開発者に報告して下さい (https://github.com/mtshiba/erg)\n{fn_name}:{line}より発生"),
"simplified_chinese" => format!("这是Erg编译器的一个错误请报告给https://github.com/mtshiba/erg\n原因来自:{fn_name}:{line}"),
"traditional_chinese" => format!("這是Erg編譯器的一個錯誤請報告給https://github.com/mtshiba/erg\n原因來自:{fn_name}:{line}"),
"english" => format!("this is a bug of the Erg compiler, please report it to https://github.com/mtshiba/erg\ncaused from: {fn_name}:{line}"), "english" => format!("this is a bug of the Erg compiler, please report it to https://github.com/mtshiba/erg\ncaused from: {fn_name}:{line}"),
), ),
None, None,
@ -40,7 +42,8 @@ impl LexError {
loc, loc,
switch_lang!( switch_lang!(
"japanese" => format!("この機能({name})はまだ正式に提供されていません"), "japanese" => format!("この機能({name})はまだ正式に提供されていません"),
"simplified_chinese" => format!("该功能({name})还没有正式提供"), "simplified_chinese" => format!("此功能({name})尚未实现"),
"traditional_chinese" => format!("此功能({name})尚未實現"),
"english" => format!("this feature({name}) is not implemented yet"), "english" => format!("this feature({name}) is not implemented yet"),
), ),
None, None,
@ -55,6 +58,7 @@ impl LexError {
switch_lang!( switch_lang!(
"japanese" => "不正な構文です", "japanese" => "不正な構文です",
"simplified_chinese" => "无效的语法", "simplified_chinese" => "无效的语法",
"traditional_chinese" => "無效的語法",
"english" => "invalid syntax", "english" => "invalid syntax",
), ),
None, None,

View file

@ -268,6 +268,8 @@ impl Lexer /*<'a>*/ {
comment.loc(), comment.loc(),
switch_lang!( switch_lang!(
"japanese" => "不正なユニコード文字(双方向オーバーライド)がコメント中に使用されています", "japanese" => "不正なユニコード文字(双方向オーバーライド)がコメント中に使用されています",
"simplified_chinese" => "注释中使用了非法的unicode字符双向覆盖",
"traditional_chinese" => "註釋中使用了非法的unicode字符雙向覆蓋",
"english" => "invalid unicode character (bi-directional override) in comments", "english" => "invalid unicode character (bi-directional override) in comments",
), ),
None, None,
@ -301,6 +303,8 @@ impl Lexer /*<'a>*/ {
space.loc(), space.loc(),
switch_lang!( switch_lang!(
"japanese" => "インデントが不正です", "japanese" => "インデントが不正です",
"simplified_chinese" => "无效缩进",
"traditional_chinese" => "無效縮進",
"english" => "invalid indent", "english" => "invalid indent",
), ),
None, None,
@ -323,11 +327,15 @@ impl Lexer /*<'a>*/ {
token.loc(), token.loc(),
switch_lang!( switch_lang!(
"japanese" => "インデントが深すぎます", "japanese" => "インデントが深すぎます",
"simplified_chinese" => "缩进太深",
"traditional_chinese" => "縮進太深",
"english" => "indentation is too deep", "english" => "indentation is too deep",
), ),
Some( Some(
switch_lang!( switch_lang!(
"japanese" => "コードが複雑すぎます。処理を分割してください", "japanese" => "コードが複雑すぎます。処理を分割してください",
"simplified_chinese" => "代码过于复杂,请拆分过程",
"traditional_chinese" => "代碼過於復雜,請拆分過程",
"english" => "The code is too complicated. Please split the process", "english" => "The code is too complicated. Please split the process",
) )
.into(), .into(),
@ -368,6 +376,8 @@ impl Lexer /*<'a>*/ {
invalid_dedent.loc(), invalid_dedent.loc(),
switch_lang!( switch_lang!(
"japanese" => "インデントが不正です", "japanese" => "インデントが不正です",
"simplified_chinese" => "无效缩进",
"traditional_chinese" => "無效縮進",
"english" => "invalid indent", "english" => "invalid indent",
), ),
None, None,
@ -540,6 +550,8 @@ impl Lexer /*<'a>*/ {
token.loc(), token.loc(),
switch_lang!( switch_lang!(
"japanese" => "不正なユニコード文字(双方向オーバーライド)が文字列中に使用されています", "japanese" => "不正なユニコード文字(双方向オーバーライド)が文字列中に使用されています",
"simplified_chinese" => "注释中使用了非法的unicode字符双向覆盖",
"traditional_chinese" => "註釋中使用了非法的unicode字符雙向覆蓋",
"english" => "invalid unicode character (bi-directional override) in string literal", "english" => "invalid unicode character (bi-directional override) in string literal",
), ),
None, None,
@ -553,6 +565,8 @@ impl Lexer /*<'a>*/ {
token.loc(), token.loc(),
switch_lang!( switch_lang!(
"japanese" => "文字列が\"によって閉じられていません", "japanese" => "文字列が\"によって閉じられていません",
"simplified_chinese" => "字符串没有被\"关闭",
"traditional_chinese" => "字符串没有被\"关闭",
"english" => "the string is not closed by \"", "english" => "the string is not closed by \"",
), ),
None, None,
@ -602,6 +616,8 @@ impl Iterator for Lexer /*<'a>*/ {
token.loc(), token.loc(),
switch_lang!( switch_lang!(
"japanese" => "<.という演算子はありません", "japanese" => "<.という演算子はありません",
"simplified_chinese" => "没有这样的运算符:<.",
"traditional_chinese" => "沒有這樣的運算符:<.",
"english" => "no such operator: <.", "english" => "no such operator: <.",
), ),
None, None,
@ -789,11 +805,15 @@ impl Iterator for Lexer /*<'a>*/ {
token.loc(), token.loc(),
switch_lang!( switch_lang!(
"japanese" => "タブ文字は使用できません", "japanese" => "タブ文字は使用できません",
"simplified_chinese" => "不能将制表符用作空格",
"traditional_chinese" => "不能將製表符用作空格",
"english" => "cannot use a tab as a space", "english" => "cannot use a tab as a space",
), ),
Some( Some(
switch_lang!( switch_lang!(
"japanese" => "スペース( )を使用してください", "japanese" => "スペース( )を使用してください",
"simplified_chinese" => "使用空格( )",
"traditional_chinese" => "使用空格( )",
"english" => "use spaces ( )", "english" => "use spaces ( )",
) )
.into(), .into(),
@ -821,6 +841,8 @@ impl Iterator for Lexer /*<'a>*/ {
token.loc(), token.loc(),
switch_lang!( switch_lang!(
"japanese" => format!("`{}`はユーザー定義できません", &token.content), "japanese" => format!("`{}`はユーザー定義できません", &token.content),
"simplified_chinese" => format!("`{}`不能由用户定义", &token.content),
"traditional_chinese" => format!("`{}`不能由用戶定義", &token.content),
"english" => format!("`{}` cannot be defined by user", &token.content), "english" => format!("`{}` cannot be defined by user", &token.content),
), ),
None, None,
@ -835,6 +857,8 @@ impl Iterator for Lexer /*<'a>*/ {
token.loc(), token.loc(),
switch_lang!( switch_lang!(
"japanese" => format!("バッククォート(`)が閉じられていません"), "japanese" => format!("バッククォート(`)が閉じられていません"),
"simplified_chinese" => format!("反引号(`)未关闭"),
"traditional_chinese" => format!("反引號(`)未關閉"),
"english" => format!("back quotes (`) not closed"), "english" => format!("back quotes (`) not closed"),
), ),
None, None,
@ -852,6 +876,8 @@ impl Iterator for Lexer /*<'a>*/ {
token.loc(), token.loc(),
switch_lang!( switch_lang!(
"japanese" => format!("この文字は使用できません: '{invalid}'"), "japanese" => format!("この文字は使用できません: '{invalid}'"),
"simplified_chinese" => format!("无效字符:'{invalid}'"),
"traditional_chinese" => format!("無效字符:'{invalid}'"),
"english" => format!("invalid character: '{invalid}'"), "english" => format!("invalid character: '{invalid}'"),
), ),
None, None,

View file

@ -453,6 +453,8 @@ impl Parser {
loc, loc,
switch_lang!( switch_lang!(
"japanese" => "ブロックの解析に失敗しました", "japanese" => "ブロックの解析に失敗しました",
"simplified_chinese" => "无法解析块",
"traditional_chinese" => "無法解析塊",
"english" => "failed to parse a block", "english" => "failed to parse a block",
), ),
None, None,
@ -529,6 +531,8 @@ impl Parser {
self.peek().unwrap().loc(), self.peek().unwrap().loc(),
switch_lang!( switch_lang!(
"japanese" => "変数宣言で型制約は使えません", "japanese" => "変数宣言で型制約は使えません",
"simplified_chinese" => "变量声明中不允许类型约束",
"traditional_chinese" => "變量聲明中不允許類型約束",
"english" => "Cannot use type bounds in a declaration of a variable", "english" => "Cannot use type bounds in a declaration of a variable",
), ),
None, None,
@ -711,6 +715,8 @@ impl Parser {
t.loc(), t.loc(),
switch_lang!( switch_lang!(
"japanese" => "左辺値の中で中置演算子は使えません", "japanese" => "左辺値の中で中置演算子は使えません",
"simplified_chinese" => "二元运算符不能用于左值",
"traditional_chinese" => "二元運算符不能用於左值",
"english" => "Binary operators cannot be used in left-values", "english" => "Binary operators cannot be used in left-values",
), ),
None, None,
@ -825,6 +831,8 @@ impl Parser {
t.loc(), t.loc(),
switch_lang!( switch_lang!(
"japanese" => "仮引数の中で中置演算子は使えません", "japanese" => "仮引数の中で中置演算子は使えません",
"simplified_chinese" => "参数中不能使用二元运算符",
"traditional_chinese" => "參數中不能使用二元運算符",
"english" => "Binary operators cannot be used in parameters", "english" => "Binary operators cannot be used in parameters",
), ),
None, None,
@ -1162,6 +1170,8 @@ impl Parser {
other.loc(), other.loc(),
switch_lang!( switch_lang!(
"japanese" => "この式はコンパイル時計算できないため、型引数には使用できません", "japanese" => "この式はコンパイル時計算できないため、型引数には使用できません",
"simplified_chinese" => "此表达式在编译时不可计算,因此不能用作类型参数",
"traditional_chinese" => "此表達式在編譯時不可計算,因此不能用作類型參數",
"english" => "this expression is not computable at the compile-time, so cannot used as a type-argument", "english" => "this expression is not computable at the compile-time, so cannot used as a type-argument",
), ),
None, None,