Skip to content

fix: replace hardcoded Chinese with lang constants in templates#1149

Merged
zhblue merged 2 commits intomasterfrom
fix-template-i18n
Mar 30, 2026
Merged

fix: replace hardcoded Chinese with lang constants in templates#1149
zhblue merged 2 commits intomasterfrom
fix-template-i18n

Conversation

@zhblue
Copy link
Copy Markdown
Owner

@zhblue zhblue commented Mar 30, 2026

Fix Hardcoded Chinese in Templates

Changes

Reference: syzoj template uses proper lang constants throughout.

sidebar template:

  • ACM排行榜ACM . $MSG_STANDING
  • OI排行榜OI . $MSG_STANDING
  • 提交记录$MSG_STATUS
  • 未公开$MSG_RESERVED
  • 暂无选手提交$MSG_NO_SUBMISSIONS
  • 上一页/下一页$MSG_PREV_PAGE/$MSG_NEXT_PAGE
  • 比赛已经关闭!$MSG_CONTEST_CLOSED . "!"

bshark template:

  • 未开始$MSG_Contest_Pending (all contest files)
  • 上一页/下一页/顶页$MSG_PREV_PAGE/$MSG_NEXT_PAGE/$MSG_TOP_OF_PAGE

mdui template:

  • 比赛已经关闭!$MSG_CONTEST_CLOSED . "!"

bs3/sweet templates:

  • 滚榜$MSG_ROLLING_RANK

New Lang Constants Added

Added to all lang files: cn, en, ko, fa, ru, th, ug, cnt, he, mn, bo

  • $MSG_ROLLING_RANK, $MSG_SIMILARITY, $MSG_NO_SUBMISSIONS
  • $MSG_NO_CONTACTS, $MSG_SELECT_CONTACT, $MSG_CONTEST_CLOSED
  • $MSG_FILE_SUBMIT, $MSG_NO_FREOPEN, $MSG_OI_CONTEST_VIEWING
  • $MSG_ADMIN_NO_EMAIL_CONFIG, $MSG_PLEASE_CONFIG_EMAIL
  • $MSG_STARRED_OF_MONTH, $MSG_CORRECT_SUBMISSIONS, $MSG_TOP_OF_PAGE

Files: 26 template files modified (39 insertions, 39 deletions)

zhblue added 2 commits March 30, 2026 16:08
New constants: ROLLING_RANK, SIMILARITY, NO_SUBMISSIONS, NO_CONTACTS,
SELECT_CONTACT, CONTEST_CLOSED, FILE_SUBMIT, NO_FREOPEN,
OI_CONTEST_VIEWING, ADMIN_NO_EMAIL_CONFIG, PLEASE_CONFIG_EMAIL,
STARRED_OF_MONTH, CORRECT_SUBMISSIONS, TOP_OF_PAGE
- sidebar: ACM排行榜→MSG_STANDING, 未公开→MSG_RESERVED,
  暂无选手提交→MSG_NO_SUBMISSIONS, 上一页/下一页→MSG_PREV/NEXT_PAGE
- bshark: 未开始→MSG_Contest_Pending, 上一页/下一页/顶页→MSG_PREV/NEXT_PAGE/TOP_OF_PAGE
- mdui: 比赛已经关闭→MSG_CONTEST_CLOSED
- bs3/sweet: 滚榜→MSG_ROLLING_RANK

Ref: syzoj template as reference for proper i18n usage
Copilot AI review requested due to automatic review settings March 30, 2026 08:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes hardcoded Chinese UI strings from multiple templates and replaces them with existing/new $MSG_* language constants, alongside adding the missing constants to all language packs.

Changes:

  • Replaced hardcoded Chinese labels/messages in several template themes with $MSG_* constants (paging, contest status, rolling rank, “no submissions”, etc.).
  • Added new language constants (e.g., $MSG_ROLLING_RANK, $MSG_NO_SUBMISSIONS, $MSG_CONTEST_CLOSED, $MSG_TOP_OF_PAGE) across all trunk/web/lang/*.php files.

Reviewed changes

Copilot reviewed 37 out of 37 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
trunk/web/template/sweet/contestrank.php Replaces “滚榜” label with $MSG_ROLLING_RANK.
trunk/web/template/sidebar/problemset.php Replaces “未公开” badge with $MSG_RESERVED.
trunk/web/template/sidebar/conteststatus.php Replaces prev/next page labels with $MSG_PREV_PAGE/$MSG_NEXT_PAGE.
trunk/web/template/sidebar/conteststatistics.php Replaces “比赛已经关闭!” with $MSG_CONTEST_CLOSED . "!".
trunk/web/template/sidebar/contestrank5.php Replaces “暂无选手提交” with $MSG_NO_SUBMISSIONS.
trunk/web/template/sidebar/contestrank4.php Replaces “暂无选手提交” with $MSG_NO_SUBMISSIONS.
trunk/web/template/sidebar/contestrank.php Replaces “暂无选手提交” with $MSG_NO_SUBMISSIONS.
trunk/web/template/sidebar/contestrank-oi.php Replaces “暂无选手提交” with $MSG_NO_SUBMISSIONS.
trunk/web/template/sidebar/contestbar.php Replaces contest bar labels with $MSG_STANDING/$MSG_STATUS.
trunk/web/template/mdui/conteststatus.php Replaces “比赛已经关闭!” with $MSG_CONTEST_CLOSED . "!".
trunk/web/template/mdui/conteststatistics.php Replaces “比赛已经关闭!” with $MSG_CONTEST_CLOSED . "!".
trunk/web/template/mdui/contestrank.php Replaces “比赛已经关闭!” with $MSG_CONTEST_CLOSED . "!".
trunk/web/template/mdui/contestrank-oi.php Replaces “比赛已经关闭!” with $MSG_CONTEST_CLOSED . "!".
trunk/web/template/bshark/user_set_ip.php Replaces “未开始” with $MSG_Contest_Pending.
trunk/web/template/bshark/suspect_list.php Replaces “未开始” with $MSG_Contest_Pending.
trunk/web/template/bshark/status.php Replaces paging labels with $MSG_TOP_OF_PAGE/$MSG_PREV_PAGE/$MSG_NEXT_PAGE.
trunk/web/template/bshark/index.php Replaces “未开始” contest badge with $MSG_Contest_Pending.
trunk/web/template/bshark/conteststatus.php Replaces “未开始” and paging labels with $MSG_Contest_Pending + paging constants.
trunk/web/template/bshark/conteststatistics.php Replaces “未开始” with $MSG_Contest_Pending.
trunk/web/template/bshark/contestrank5.php Replaces “未开始” with $MSG_Contest_Pending.
trunk/web/template/bshark/contestrank4.php Replaces “未开始” with $MSG_Contest_Pending.
trunk/web/template/bshark/contestrank.php Replaces “未开始” with $MSG_Contest_Pending.
trunk/web/template/bshark/contestrank-oi.php Replaces “未开始” with $MSG_Contest_Pending.
trunk/web/template/bshark/contest.php Replaces “未开始” with $MSG_Contest_Pending.
trunk/web/template/bs3/contestrank.php Replaces “滚榜” label with $MSG_ROLLING_RANK.
trunk/web/template/bs3/contestrank-oi.php Replaces “滚榜” label with $MSG_ROLLING_RANK.
trunk/web/lang/ug.php Adds new $MSG_* constants.
trunk/web/lang/th.php Adds new $MSG_* constants.
trunk/web/lang/ru.php Adds new $MSG_* constants.
trunk/web/lang/mn.php Adds new $MSG_* constants.
trunk/web/lang/ko.php Adds new $MSG_* constants.
trunk/web/lang/he.php Adds new $MSG_* constants.
trunk/web/lang/fa.php Adds new $MSG_* constants.
trunk/web/lang/en.php Adds new $MSG_* constants.
trunk/web/lang/cnt.php Adds new $MSG_* constants.
trunk/web/lang/cn.php Adds new $MSG_* constants.
trunk/web/lang/bo.php Adds new $MSG_* constants.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

$MSG_NO_FREOPEN="No freopen needed";
$MSG_OI_CONTEST_VIEWING="OI contest in progress, cannot view";
$MSG_ADMIN_NO_EMAIL_CONFIG="Administrator has not configured email sending account";
$MSG_PLEASE_CONFIG_EMAIL="Please configure $SMTP_USER in db_info.inc.php";
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

$MSG_PLEASE_CONFIG_EMAIL uses $SMTP_USER inside a double-quoted string, which will be interpolated and may expose SMTP configuration. Use a literal "$SMTP_USER" (escape the $ or use single quotes / concatenation).

Suggested change
$MSG_PLEASE_CONFIG_EMAIL="Please configure $SMTP_USER in db_info.inc.php";
$MSG_PLEASE_CONFIG_EMAIL='Please configure $SMTP_USER in db_info.inc.php';

Copilot uses AI. Check for mistakes.
$MSG_NO_FREOPEN="Freopen шаардлагагүй";
$MSG_OI_CONTEST_VIEWING="OI тэмцээн явагдаж байна, үзэх боломжгүй";
$MSG_ADMIN_NO_EMAIL_CONFIG="Админ имэйл тохиргоо хийгээгүй";
$MSG_PLEASE_CONFIG_EMAIL="$SMTP_USER-ийг db_info.inc.php-д тохируулна уу";
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

$MSG_PLEASE_CONFIG_EMAIL contains $SMTP_USER in a double-quoted string, so PHP will interpolate the configured value (or emit notices if undefined). Use a literal "$SMTP_USER" (escape the $ or use single quotes / concatenation).

Suggested change
$MSG_PLEASE_CONFIG_EMAIL="$SMTP_USER-ийг db_info.inc.php-д тохируулна уу";
$MSG_PLEASE_CONFIG_EMAIL='$SMTP_USER-ийг db_info.inc.php-д тохируулна уу';

Copilot uses AI. Check for mistakes.
Comment on lines 214 to +217
<a class="item"
href="<?php echo "status.php?" . $str2 . "&top=" . intval($_GET['prevtop']); ?>">上一页</a>
href="<?php echo "status.php?" . $str2 . "&top=" . intval($_GET['prevtop']); ?>"><?php echo $MSG_PREV_PAGE?></a>
<?php } else { ?>
<a class="item" href="<?php echo "status.php?" . $str2 . "&top=" . ($top + 20); ?>">上一页</a>
<a class="item" href="<?php echo "status.php?" . $str2 . "&top=" . ($top + 20); ?>"><?php echo $MSG_PREV_PAGE?></a>
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

These templates now rely on $MSG_PREV_PAGE/$MSG_NEXT_PAGE from the selected language. In trunk/web/lang/he.php, both are currently self-referential (assigned to "$MSG_PREV_PAGE"/"$MSG_NEXT_PAGE"), which will render as an empty string and can emit notices. Please define real values (or fall back to English) for those keys so pagination labels don't disappear in Hebrew.

Copilot uses AI. Check for mistakes.
$MSG_NO_FREOPEN="No freopen needed";
$MSG_OI_CONTEST_VIEWING="OI contest in progress, cannot view";
$MSG_ADMIN_NO_EMAIL_CONFIG="Administrator has not configured email sending account, please contact admin or teacher to manually reset password.";
$MSG_PLEASE_CONFIG_EMAIL="Please configure $SMTP_USER in db_info.inc.php to enable password recovery.";
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

$MSG_PLEASE_CONFIG_EMAIL uses $SMTP_USER inside a double-quoted string, so PHP will interpolate the configured value (or emit notices if undefined). Use a literal "$SMTP_USER" (escape the $ or use single quotes / concatenation) to avoid exposing configuration values.

Suggested change
$MSG_PLEASE_CONFIG_EMAIL="Please configure $SMTP_USER in db_info.inc.php to enable password recovery.";
$MSG_PLEASE_CONFIG_EMAIL="Please configure \$SMTP_USER in db_info.inc.php to enable password recovery.";

Copilot uses AI. Check for mistakes.
$MSG_NO_FREOPEN="ไม่ต้องใช้ freopen";
$MSG_OI_CONTEST_VIEWING="การแข่งขัน OI กำลังดำเนินอยู่ ไม่สามารถดูได้";
$MSG_ADMIN_NO_EMAIL_CONFIG="ผู้ดูแลระบบไม่ได้กำหนดค่าอีเมล";
$MSG_PLEASE_CONFIG_EMAIL="กรุณาตั้งค่า $SMTP_USER ใน db_info.inc.php";
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

$MSG_PLEASE_CONFIG_EMAIL contains $SMTP_USER inside a double-quoted string, so it will be interpolated at runtime (potentially exposing the configured SMTP account). Prefer a literal "$SMTP_USER" (escape the $ or use single quotes / concatenation).

Suggested change
$MSG_PLEASE_CONFIG_EMAIL="กรุณาตั้งค่า $SMTP_USER ใน db_info.inc.php";
$MSG_PLEASE_CONFIG_EMAIL='กรุณาตั้งค่า $SMTP_USER ใน db_info.inc.php';

Copilot uses AI. Check for mistakes.
$MSG_NO_FREOPEN="אין צורך בfreopen";
$MSG_OI_CONTEST_VIEWING="תחרות OI מתקיימת, אין אפשרות לצפות";
$MSG_ADMIN_NO_EMAIL_CONFIG="המנהל לא הגדיר שליחת אימייל";
$MSG_PLEASE_CONFIG_EMAIL="אנא הגדר את $SMTP_USER ב-db_info.inc.php";
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

$MSG_PLEASE_CONFIG_EMAIL includes $SMTP_USER in a double-quoted string, which will be interpolated and may expose SMTP configuration. Use a literal "$SMTP_USER" (escape the $ or use single quotes / concatenation).

Suggested change
$MSG_PLEASE_CONFIG_EMAIL="אנא הגדר את $SMTP_USER ב-db_info.inc.php";
$MSG_PLEASE_CONFIG_EMAIL="אנא הגדר את \$SMTP_USER ב-db_info.inc.php";

Copilot uses AI. Check for mistakes.
$MSG_NO_FREOPEN="Freopen не нужен";
$MSG_OI_CONTEST_VIEWING="OI соревнование идёт, просмотр невозможен";
$MSG_ADMIN_NO_EMAIL_CONFIG="Администратор не настроил отправку email";
$MSG_PLEASE_CONFIG_EMAIL="Настройте $SMTP_USER в db_info.inc.php";
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

$MSG_PLEASE_CONFIG_EMAIL uses $SMTP_USER inside a double-quoted string, so PHP will interpolate it at runtime (potentially exposing SMTP config / causing notices). Use a literal "$SMTP_USER" (escape the $ or use single quotes / concatenation).

Suggested change
$MSG_PLEASE_CONFIG_EMAIL="Настройте $SMTP_USER в db_info.inc.php";
$MSG_PLEASE_CONFIG_EMAIL="Настройте \$SMTP_USER в db_info.inc.php";

Copilot uses AI. Check for mistakes.
$MSG_NEXT_PAGE="Next Page";
$MSG_PREV_PAGE="Prev Page";

$MSG_ROLLING_RANK="Сrolling Rank";
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

The Russian translation for $MSG_ROLLING_RANK is misspelled ("Сrolling Rank"), which will display incorrectly. Consider correcting it to a properly spelled/translated phrase (at minimum, "Rolling Rank").

Suggested change
$MSG_ROLLING_RANK="Сrolling Rank";
$MSG_ROLLING_RANK="Rolling Rank";

Copilot uses AI. Check for mistakes.
$MSG_NO_FREOPEN="نیاز به freopen نیست";
$MSG_OI_CONTEST_VIEWING="مسابقه OI در حال اجرا، امکان مشاهده نیست";
$MSG_ADMIN_NO_EMAIL_CONFIG="مدیر ایمیل را پیکربندی نکرده است";
$MSG_PLEASE_CONFIG_EMAIL="لطفاً $SMTP_USER را در db_info.inc.php پیکربندی کنید";
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

$MSG_PLEASE_CONFIG_EMAIL is defined using a double-quoted string containing $SMTP_USER, which will be PHP-interpolated at runtime (and may leak the configured SMTP username or become empty/raise notices if undefined). Use a literal "$SMTP_USER" (escape the $ or use single quotes / concatenation) so the message shows the variable name rather than its value.

Suggested change
$MSG_PLEASE_CONFIG_EMAIL="لطفاً $SMTP_USER را در db_info.inc.php پیکربندی کنید";
$MSG_PLEASE_CONFIG_EMAIL='لطفاً $SMTP_USER را در db_info.inc.php پیکربندی کنید';

Copilot uses AI. Check for mistakes.
$MSG_NO_FREOPEN="freopen ھاجەتسىز";
$MSG_OI_CONTEST_VIEWING="OI مۇسابىقەسى داۋاملىشىۋاتىدۇ، كۆرۈش مۇمكىن ئەمەس";
$MSG_ADMIN_NO_EMAIL_CONFIG="باشقۇرغۇچى ئېلېكترونلۇق خەت تەڭشەكىنى قىلمىغان";
$MSG_PLEASE_CONFIG_EMAIL="$SMTP_USER نى db_info.inc.php دا تەڭشەڭ";
Copy link

Copilot AI Mar 30, 2026

Choose a reason for hiding this comment

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

$MSG_PLEASE_CONFIG_EMAIL includes $SMTP_USER in a double-quoted string, which PHP interpolates at runtime and can expose the configured SMTP username. Use a literal "$SMTP_USER" (escape the $ or use single quotes / concatenation).

Suggested change
$MSG_PLEASE_CONFIG_EMAIL="$SMTP_USER نى db_info.inc.php دا تەڭشەڭ";
$MSG_PLEASE_CONFIG_EMAIL='$SMTP_USER نى db_info.inc.php دا تەڭشەڭ';

Copilot uses AI. Check for mistakes.
Repository owner deleted a comment from Copilot AI Mar 30, 2026
@zhblue zhblue merged commit 266826e into master Mar 30, 2026
12 checks passed
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.

2 participants