Skip to content

添加多语言(i18n)支持 - #3206

Open
Maxcj wants to merge 4 commits into
hhyo:masterfrom
Maxcj:feature/i18n
Open

添加多语言(i18n)支持#3206
Maxcj wants to merge 4 commits into
hhyo:masterfrom
Maxcj:feature/i18n

Conversation

@Maxcj

@Maxcj Maxcj commented Jun 20, 2026

Copy link
Copy Markdown
Contributor
  • 根据 Django 文档以及另外一个 PR(3115) 完成
  • 范围包含登录、前台、后台页面
  • 目前已内置简体中文(zh_Hans), English(en)两种语言

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 50f8222b58

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sql/models.py Outdated
Comment thread sql/urls.py Outdated
Comment thread locale/zh_Hans/LC_MESSAGES/django.po Outdated
Comment thread sql/query.py
Comment thread locale/zh_Hans/LC_MESSAGES/django.po Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 04f6354eb1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sql/query.py
Comment on lines +304 to 306
QueryLog(id=query_log_id, favorite=star, alias=alias).save(
update_fields=["favorite", "alias"]
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep favorite updates scoped to the owner

For non-auditor users, the list endpoint still filters QueryLog by username, but this direct model save updates whichever primary key is posted. Any user with sql.menu_sqlquery can guess another log id and change its favorite flag/alias; use the existing QueryLog.objects.filter(id=...).filter(username=...) path (or the service) before updating.

Useful? React with 👍 / 👎.

}
// 执行结果页默认不新增
else if (active_li_title.match(/^执行结果\d$/)) {
else if (active_li_title.match(/^Execution Result\d$/)) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Match localized result tab titles

In zh-hans the result tab is created with gettext("Execution Result"), which becomes 执行结果1, so this English-only regex no longer recognizes the active result tab. Subsequent queries while a result tab is selected always create another tab instead of updating/reusing the current one, and the SQL cache update above has the same mismatch; compare against an unlocalized tab id or a translated prefix instead.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6a82f36102

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sql/query.py
sql_content = request.POST.get("sql_content")
db_name = request.POST.get("db_name")
tb_name = request.POST.get("tb_name")
limit_num = int(request.POST.get("limit_num", 0))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate nonnumeric query limits before casting

When a client posts an empty or nonnumeric limit_num value, this cast runs before the new JSON error handling and raises ValueError, so /query/ returns a 500 instead of the structured error that execute_sql_query() previously returned for invalid limits. Keep the conversion inside a try/except and reject bad limits with a JSON response.

Useful? React with 👍 / 👎.

Comment thread sql/sql_workflow.py
operation_type=5,
operation_type_desc="执行工单",
operation_info="工单执行排队中",
operation_type_desc=_("Execute workflow"), # 执行工单

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep persisted log descriptions within field length

When the active language is English, this translated value is Execute workflow (and the manual/scheduled descriptions below are also longer), but WorkflowLog.operation_type_desc is max_length=10. Saving these audit log entries in MySQL strict mode will fail, or truncate in lax configurations, when executing or scheduling workflows, so keep the stored code/short text unlocalized and localize only for display.

Useful? React with 👍 / 👎.

Comment thread sql/templates/my2sql.html
$("#end_file").empty();
for (var i = 0; i < result.length; i++) {
var name = "<option value=\"" + result[i]['Log_name'] + "\">" + result[i]['Log_name'] + ' Size:' + result[i]['File_size'] + "</option>";
var name = "<option value=\"" + result[i]['Log_name'] + "\">" + result[i]['Log_name'] + ' ' + gettext('Size:') + result[i]['File_size'] + "</option>";

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep My2SQL size parsing independent of labels

When zh-hans is active, gettext('Size:') renders as 大小:, but the click handler below still derives the default end position with .split('Size:')[1]. That leaves end_pos unset when users click My2SQL without manually entering an end position, so the request omits -stop-pos and can parse a different binlog range than the selected file size intended; store the size in the option value/data attribute instead of parsing localized text.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant