添加翻译的可行性

This commit is contained in:
2024-04-14 23:09:07 +08:00
parent ae522dc0f5
commit 16967381d8
5 changed files with 590 additions and 6 deletions

266
translator/en.toml Normal file
View File

@@ -0,0 +1,266 @@
[email_verify_code]
description = "Email verification code"
[get_email_verify_code_first]
description = "Please get the email verification code first"
[email_verify_code_wrong]
description = "Incorrect email verification code"
[email_verify_code_wrong_login_fail]
description = "Incorrect email verification code, login failed"
[email_registered]
description = "Email already registered"
[email_registered_forget_password]
description = "Email already registered, please log in directly. If you forgot your login password, please retrieve it"
[invitation_code_not_exists]
description = "Invitation code does not exist or is incorrect, please check and try again"
[password_match_error]
description = "Passwords do not match"
[account_not_registered]
description = "Account not registered, please register before operating"
[account_disabled]
description = "Your account has been disabled and cannot be operated temporarily"
[phone_number_not_registered]
description = "Account not registered, please register before operating"
[phone_number_country_incorrect]
description = "Incorrect country for the phone number, please check"
[phone_number_verify_code_wrong]
description = "Incorrect phone verification code"
[phone_number_registered]
description = "Phone number already registered"
[phone_number_registered_forget_password]
description = "Phone number already registered, please log in directly. If you forgot your login password, please retrieve it"
[get_phone_number_verify_code_first]
description = "Please get the phone verification code first"
[phone_number_verify_code_wrong_login_fail]
description = "Incorrect phone verification code, login failed"
[account_disabled_not_login]
description = "Your account has been disabled and cannot be operated temporarily"
[account_or_password_login_failed]
description = "Incorrect account or password, login failed"
[record_not_exist]
description = "Record does not exist"
[category_not_exist]
description = "Category does not exist"
[data_not_exist]
description = "Data does not exist!"
[data_not_exist_retry]
description = "Data does not exist, please try again!"
[new_shares_do_not_exist]
description = "New shares do not exist"
[state_not_cancel]
description = "Current state does not allow cancellation"
[apply_cannot_be_cancelled]
description = "This application has been closed and cannot be cancelled"
[financing_not_cancel]
description = "Sorry, financing for new shares is not allowed to be cancelled"
[application_has_been_submitted]
description = "Sorry, the application has been submitted to the exchange and cannot be cancelled"
[fund_has_been_delisted]
description = "Sorry, the fund has been delisted and cannot be subscribed temporarily"
[subscription_failed_over_purchased]
description = "Subscription failed, over-purchased. The current remaining subscription quota for the fund is: "
[minimum_purchase_amount]
description = "Minimum purchase amount"
[rise]
description = "and up"
[hongkong_account_is_insufficient]
description = "Insufficient balance in Hong Kong stock account, please deposit first"
[us_account_is_insufficient]
description = "Insufficient balance in US stock account, please deposit first"
[usdt_account_is_insufficient]
description = "Insufficient balance in USDT account, please deposit first"
[format_account_is_insufficient]
description = "Insufficient account balance, please deposit first"
[subscription_deadline_has_passed]
description = "The subscription deadline has passed!"
[have_a_subscription_record]
description = "You already have a subscription record for this new share and cannot apply again"
[hongkong_stock_account_not_be_less_than]
description = "Financing subscription requires Hong Kong stock account balance not less than"
[us_stock_account_not_be_less_than]
description = "Financing subscription requires US stock account balance not less than"
[please_deposit_first]
description = ", please deposit first!"
[incorrect_amount_retry]
description = "Incorrect amount, please try again"
[have_an_entrustment_record]
description = "You already have an entrustment record for this new share and cannot entrust again"
[currently_only_supports_conversion_hkd]
description = "Currently only supports conversion to Hong Kong Dollar HKD $"
[insufficient_account_balance]
description = "Insufficient account balance, conversion failed"
[record_is_not_cancel]
description = "This record is not allowed to be cancelled currently"
[order_needs_3_minutes_before]
description = "Market orders need to be placed 3 minutes before they can be cancelled"
[order_is_not_cancel]
description = "This order does not support cancellation currently"
[order_failed_retry]
description = "Order failed, please try again"
[market_closed_orders_cannot_be_placed]
description = "The current market is closed, orders cannot be placed temporarily"
[incorrect_security_code_retry]
description = "Incorrect security code, please try again"
[stock]
description = "Stock"
[order_failed_odd_lot_trading]
description = "Order failed, odd lot trading is not supported"
[withfunding_asset_total_must_large_than_order_total]
description = "Order failed, operating funds must be greater than order amount"
[order_failed_price_cannot_be_lower_than]
description = "Order failed, price cannot be lower than"
[order_failed_price_cannot_be_higher_than]
description = "Order failed, price cannot be higher than"
[order_failed_price_is_incorrect]
description = "Order failed, price is incorrect"
[stock_insufficient]
description = "You currently do not hold this stock or the holding quantity is insufficient, unable to sell"
[current_position_of_the_stock]
description = "Current holding quantity of the stock"
[holding_amount_is_insufficient]
description = ", holding amount is insufficient, unable to sell"
[maximum_number_of_sells]
description = "The maximum allowed selling quantity is"
[stocks_do_not_support_grey_market_trading]
description = "Stocks do not support grey market trading"
[non_grey_market_trading_time]
description = "Currently not in grey market trading time, order failed"
[pretrade_not_allow_market_order]
description = "Pre-trade does not support market orders, please change and try again"
[text_required]
description = "Data error"
[days_ago]
description = " days ago"
[hours_ago]
description = " hours ago"
[minutes_ago]
description = " minutes ago"
[balance_role_1]
description = "Stock buy"
[balance_role_2]
description = "Buy commission"
[balance_role_3]
description = "Stock sell"
[balance_role_4]
description = "Sell commission"
[balance_role_5]
description = "New share subscription"
[balance_role_6]
description = "New share financing interest"
[balance_role_7]
description = "New share subscription commission"
[balance_role_8]
description = "New share allotment commission"
[balance_role_9]
description = "International placement margin"
[balance_role_10]
description = "Platform share"
[balance_role_11]
description = "Withdrawal"
[balance_role_12]
description = "Deposit"
[balance_role_13]
description = "Fund subscription amount"
[balance_role_14]
description = "Fund subscription fee"
[balance_role_15]
description = "Fund management fee"
[balance_role_16]
description = "Fund deduction"
[balance_role_17]
description = "Fund refund"
[balance_role_18]
description = "Fund settlement profit"
[balance_role_19]
description = "Virtual deposit"
[balance_role_20]
description = "Manual deposit"
[balance_role_21]
description = "Fund transfer"
[balance_role_22]
description = "Promotion commission"
[balance_role_23]
description = "Fund excess management fee"
[balance_role_24]
description = "Currency exchange"
[balance_role_25]
description = "Leveraged investment principal"
[balance_role_26]
description = "Leveraged interest"
[balance_role_28]
description = "Bonus"
[balance_return]
description = "(Returned)"
[day]
description = "Day"
[week]
description = "Week"
[month]
description = "Month"
[fund_order_status_1]
description = "Subscribed"
[fund_order_status_2]
description = "Cancelled"
[fund_order_status_3]
description = "Settled"
[withfunding_must_all_clear]
description = "Order failed, leveraged positions must be sold all"
[sell_success_title]
description = "Sell trade completed"
[sell_success_content_1]
description = "Your trade "
[sell_success_content_2]
description = " sell "
[sell_success_content_3]
description = " has been completed"
[buy_success_title]
description = "Buy trade completed"
[buy_success_content_1]
description = "Your trade "
[buy_success_content_2]
description = " buy "
[buy_success_content_3]
description = " has been completed"
[sms_verify_code_content_1]
description = "Your SMS verification code is: "
[email_exchange_title]
description = "Fund Change Notification"
[currency_exchange_status_1]
description = "Pending"
[currency_exchange_status_2]
description = "Exchange successful"
[currency_exchange_status_3]
description = "Exchange failed"
[currency_exchange_status_4]
description = "Cancelled"
[to_be_disclosed]
description = "To be disclosed"
[ipo_times]
description = " times"
[ipo_cash_commission]
description = "Cash commission"
[password_match_error_origin]
description = "Original password does not match"
[ipo_financing_10_times]
description = "10 times financing"
[ipo_financing_20_times]
description = "20 times financing"
[other]
description = "Other"
[max]
description = "Max"
[the_maximum_quantity_is_limited_to_10_digits]
description = "The maximum quantity is limited to 10 digits"
[waiting_to_open]
description = "Waiting to open"
[the_market_is_closed_on_weekends]
description = "The market is closed on weekends"
[the_market_is_closed]
description = "The market is closed"
[in_transaction]
description = "In transaction"
[default_trading_time_period]
description = "Default trading time period"
[non_default_trading_time_period]
description = "Non-default trading time period"
[all_day_transaction]
description = "All-day transaction"

284
translator/ja.toml Normal file
View File

@@ -0,0 +1,284 @@
[email_verify_code]
description = "メール認証コード"
[get_email_verify_code_first]
description = "まずメール認証コードを取得してください"
[email_verify_code_wrong]
description = "メール認証コードが正しくありません"
[email_verify_code_wrong_login_fail]
description = "メール認証コードが正しくありません。ログインに失敗しました"
[email_registered]
description = "メールアドレスは既に登録されています"
[email_registered_forget_password]
description = "メールアドレスは既に登録されています。直接ログインしてください。パスワードをお忘れの場合は、パスワードを再設定してください"
[invitation_code_not_exists]
description = "招待コードが存在しないか、誤りがあります。確認の上、再度お試しください"
[password_match_error]
description = "パスワードが一致しません"
[account_not_registered]
description = "アカウントが登録されていません。登録後に操作してください"
[account_disabled]
description = "アカウントが無効になっているため、現在操作できません"
[phone_number_not_registered]
description = "アカウントが登録されていません。登録後に操作してください"
[phone_number_country_incorrect]
description = "電話番号の国が正しくありません。確認してください"
[phone_number_verify_code_wrong]
description = "携帯電話の認証コードが正しくありません"
[phone_number_registered]
description = "電話番号は既に登録されています"
[phone_number_registered_forget_password]
description = "電話番号は既に登録されています。直接ログインしてください。パスワードをお忘れの場合は、パスワードを再設定してください"
[get_phone_number_verify_code_first]
description = "まず携帯電話の認証コードを取得してください"
[phone_number_verify_code_wrong_login_fail]
description = "携帯電話の認証コードが正しくありません。ログインに失敗しました"
[account_disabled_not_login]
description = "アカウントが無効になっているため、現在操作できません"
[account_or_password_login_failed]
description = "アカウントまたはパスワードが正しくありません。ログインに失敗しました"
[record_not_exist]
description = "記録が存在しません"
[category_not_exist]
description = "カテゴリが存在しません"
[data_not_exist]
description = "データが存在しません!"
[data_not_exist_retry]
description = "データが存在しません。再度お試しください!"
[new_shares_do_not_exist]
description = "新株が存在しません"
[state_not_cancel]
description = "現在の状態ではキャンセルできません"
[apply_cannot_be_cancelled]
description = "この申請は締め切られており、キャンセルできません"
[financing_not_cancel]
description = "申し訳ありませんが、新株引受融資はキャンセルできません"
[application_has_been_submitted]
description = "申し訳ありませんが、申請は既に取引所に提出されており、キャンセルできません"
[fund_has_been_delisted]
description = "申し訳ありませんが、ファンドは上場廃止となっており、現在申し込みできません"
[subscription_failed_over_purchased]
description = "申し込みに失敗しました。購入超過です。ファンドの現在の残りの申し込み可能額は次の通りです:"
[minimum_purchase_amount]
description = "最低購入金額"
[rise]
description = "以上"
[hongkong_account_is_insufficient]
description = "香港株口座の残高が不足しています。まず入金してください"
[us_account_is_insufficient]
description = "米国株口座の残高が不足しています。まず入金してください"
[usdt_account_is_insufficient]
description = "USDT口座の残高が不足しています。まず入金してください"
[format_account_is_insufficient]
description = "口座の残高が不足しています。まず入金してください"
[subscription_deadline_has_passed]
description = "現在、申し込み期限を過ぎています!"
[have_a_subscription_record]
description = "既にこの新株の申し込み記録があるため、重複して申請できません"
[hongkong_stock_account_not_be_less_than]
description = "新株引受融資には、香港株口座の残高が次の金額を下回らないことが要求されます"
[us_stock_account_not_be_less_than]
description = "新株引受融資には、米国株口座の残高が次の金額を下回らないことが要求されます"
[please_deposit_first]
description = "。まず入金してください!"
[incorrect_amount_retry]
description = "金額が正しくありません。再度お試しください"
[have_an_entrustment_record]
description = "既にこの新株の委託記録があるため、重複して委託できません"
[currently_only_supports_conversion_hkd]
description = "現在、香港ドルHKDへの変換のみをサポートしています"
[insufficient_account_balance]
description = "口座残高が不足しているため、変換に失敗しました"
[record_is_not_cancel]
description = "この記録は現在キャンセルできません"
[order_needs_3_minutes_before]
description = "成行注文は、注文後3分経過しないと取り消せません"
[order_is_not_cancel]
description = "この注文は現在取り消しをサポートしていません"
[order_failed_retry]
description = "注文に失敗しました。再度お試しください"
[market_closed_orders_cannot_be_placed]
description = "現在、市場は休場中のため、注文を出せません"
[incorrect_security_code_retry]
description = "証券コードが正しくありません。再度お試しください"
[stock]
description = "株式"
[order_failed_odd_lot_trading]
description = "注文に失敗しました。端株取引はサポートしていません"
[withfunding_asset_total_must_large_than_order_total]
description = "注文に失敗しました。運用資金は注文金額を上回る必要があります"
[order_failed_price_cannot_be_lower_than]
description = "注文に失敗しました。価格は次の金額を下回ることはできません"
[order_failed_price_cannot_be_higher_than]
description = "注文に失敗しました。価格は次の金額を上回ることはできません"
[order_failed_price_is_incorrect]
description = "注文に失敗しました。価格が正しくありません"
[stock_insufficient]
description = "現在、この株式を保有していないか、保有数量が不足しているため、売却できません"
[current_position_of_the_stock]
description = "株式の現在の保有数量"
[holding_amount_is_insufficient]
description = "。保有数量が不足しているため、売却できません"
[maximum_number_of_sells]
description = "売却可能な最大数量は次の通りです"
[stocks_do_not_support_grey_market_trading]
description = "株式はグレーマーケット取引をサポートしていません"
[non_grey_market_trading_time]
description = "現在はグレーマーケット取引時間外のため、注文に失敗しました"
[pretrade_not_allow_market_order]
description = "プレオープン取引では成行注文はサポートされていません。変更して再度お試しください"
[text_required]
description = "データが正しくありません"
[days_ago]
description = "日前"
[hours_ago]
description = "時間前"
[minutes_ago]
description = "分前"
[balance_role_1]
description = "株式買付"
[balance_role_2]
description = "買付手数料"
[balance_role_3]
description = "株式売却"
[balance_role_4]
description = "売却手数料"
[balance_role_5]
description = "新株申し込み"
[balance_role_6]
description = "新株引受融資利息"
[balance_role_7]
description = "新株申し込み手数料"
[balance_role_8]
description = "新株当選手数料"
[balance_role_9]
description = "国内割当意向金"
[balance_role_10]
description = "プラットフォーム分配"
[balance_role_11]
description = "出金"
[balance_role_12]
description = "入金"
[balance_role_13]
description = "ファンド申し込み金額"
[balance_role_14]
description = "ファンド申し込み手数料"
[balance_role_15]
description = "ファンド管理手数料"
[balance_role_16]
description = "資金追加徴収"
[balance_role_17]
description = "資金返還"
[balance_role_18]
description = "ファンド決済益"
[balance_role_19]
description = "仮想入金"
[balance_role_20]
description = "手動入金"
[balance_role_21]
description = "資金移動"
[balance_role_22]
description = "プロモーション手数料"
[balance_role_23]
description = "ファンド超過管理手数料"
[balance_role_24]
description = "通貨両替"
[balance_role_25]
description = "レバレッジ投資元本"
[balance_role_26]
description = "レバレッジ利息"
[balance_role_28]
description = "ボーナス"
[balance_return]
description = "(返金)"
[day]
description = "日"
[week]
description = "週"
[month]
description = "月"
[fund_order_status_1]
description = "申し込み済み"
[fund_order_status_2]
description = "キャンセル済み"
[fund_order_status_3]
description = "決済済み"
[withfunding_must_all_clear]
description = "注文に失敗しました。レバレッジは全て売却する必要があります"
[sell_success_title]
description = "売却取引が成立しました"
[sell_success_content_1]
description = "あなたの取引 "
[sell_success_content_2]
description = " 売却 "
[sell_success_content_3]
description = " が成立しました"
[buy_success_title]
description = "買付取引が成立しました"
[buy_success_content_1]
description = "あなたの取引 "
[buy_success_content_2]
description = " 買付 "
[buy_success_content_3]
description = " が成立しました"
[sms_verify_code_content_1]
description = "あなたのSMS認証コードは"
[email_exchange_title]
description = "資金変動通知"
[currency_exchange_status_1]
description = "処理待ち"
[currency_exchange_status_2]
description = "両替成功"
[currency_exchange_status_3]
description = "両替失敗"
[currency_exchange_status_4]
description = "キャンセル済み"
[to_be_disclosed]
description = "公開待ち"
[ipo_times]
description = "倍"
[ipo_cash_commission]
description = "現金委託"
[password_match_error_origin]
description = "元のパスワードが一致しません"
[ipo_financing_10_times]
description = "10倍融資"
[ipo_financing_20_times]
description = "20倍融資"
[other]
description = "その他"
[max]
description = "最大"
[the_maximum_quantity_is_limited_to_10_digits]
description = "数量は最大10桁に制限されています"
[waiting_to_open]
description = "開場待ち"
[the_market_is_closed_on_weekends]
description = "週末は休場中です"
[the_market_is_closed]
description = "休場中"
[in_transaction]
description = "取引中"
[default_trading_time_period]
description = "デフォルトの取引時間帯"
[non_default_trading_time_period]
description = "デフォルト以外の取引時間帯"
[all_day_transaction]
description = "終日取引"

View File

@@ -3,6 +3,7 @@ package translator
import (
"bytes"
"go/format"
"log"
"os"
"path/filepath"
"runtime"
@@ -51,6 +52,26 @@ func TestGenTrCode(t *testing.T) {
// log.Println(string(buf.Bytes()))
}
func TestCase(t *testing.T) {
a := TomlFileToMap("./zh_cn.toml")
b := TomlFileToMap("./en.toml")
c := TomlFileToMap("./ja.toml")
for k1, v1 := range a {
if v2, ok := b[k1]; ok {
log.Println(v1, v2)
} else {
log.Panicln("k1:", k1, "不存在")
}
if v2, ok := c[k1]; ok {
log.Println(v1, v2)
} else {
log.Panicln("k1:", k1, "不存在")
}
}
}
func createTrCode(filePath string) {
tomlFile, err := os.Open(filePath)
if err != nil {
@@ -115,3 +136,16 @@ func toCamelCase(s string) string {
}
return sb.String()
}
func TomlFileToMap(tomlfile string) map[string]any {
f, err := os.Open(tomlfile)
if err != nil {
panic(err)
}
var m map[string]any
err = toml.NewDecoder(f).Decode(&m)
if err != nil {
panic(err)
}
return m
}