Thank mirror also in English

This commit is contained in:
Aoran Zeng 2024-08-23 14:24:31 +08:00
parent 9e01bb709d
commit 6097792432
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
3 changed files with 28 additions and 18 deletions

View File

@ -276,8 +276,11 @@ query_mirror_exist (SourceInfo *sources, size_t size, char *target, char *input)
if (2==size)
{
char *msg1 = CliOpt_InEnglish ? " is " : "";
char *msg2 = CliOpt_InEnglish ? " the only mirror site available currently, thanks for their generous support" : " 目前唯一可用镜像站,感谢他们的慷慨支持";
chsrc_succ (xy_strjoin (4, sources[1].mirror->name, msg1, target, msg2));
char *msg2 = CliOpt_InEnglish ? " the only mirror site available currently, thanks for their generous support"
: " 目前唯一可用镜像站,感谢他们的慷慨支持";
const char *name = CliOpt_InEnglish ? sources[1].mirror->abbr
: sources[1].mirror->name;
chsrc_succ (xy_strjoin (4, name, msg1, target, msg2));
}
if (xy_streql ("reset", input))
@ -498,15 +501,19 @@ auto_select_ (SourceInfo *sources, size_t size, const char *target_name)
if (only_one)
{
char *is = CliOpt_InEnglish ? " is " : "";
char *msg = CliOpt_InEnglish ? "the ONLY mirror available currently, thanks for their generous support" : \
" 目前唯一可用镜像站,感谢他们的慷慨支持";
chsrc_succ (xy_strjoin (4, sources[fast_idx].mirror->name, is, target_name, msg));
char *is = CliOpt_InEnglish ? " is " : "";
char *msg = CliOpt_InEnglish ? "the ONLY mirror available currently, thanks for their generous support"
: " 目前唯一可用镜像站,感谢他们的慷慨支持";
const char *name = CliOpt_InEnglish ? sources[fast_idx].mirror->abbr
: sources[fast_idx].mirror->name;
chsrc_succ (xy_strjoin (4, name, is, target_name, msg));
}
else
{
char *msg = CliOpt_InEnglish ? "FASTEST mirror site: " : "最快镜像站: ";
say (xy_2strjoin (msg, green (sources[fast_idx].mirror->name)));
const char *name = CliOpt_InEnglish ? sources[fast_idx].mirror->abbr
: sources[fast_idx].mirror->name;
say (xy_2strjoin (msg, green(name)));
}
@ -632,6 +639,8 @@ confirm_source (SourceInfo *source)
#define MSG_EN_STILL "Still need to operate manually according to the above prompts. "
#define MSG_CN_STILL "仍需按上述提示手工操作"
#define thank_mirror(msg) chsrc_log(xy_2strjoin(msg,purple(CliOpt_InEnglish?source->mirror->abbr:source->mirror->name)))
/**
* @param source NULL
* @param last_word 5ChsrcTypeAuto | ChsrcTypeReset | ChsrcTypeSemiAuto | ChsrcTypeManual | ChsrcTypeUntested
@ -656,7 +665,7 @@ chsrc_conclude (SourceInfo *source, const char *last_word)
{
char *msg = CliOpt_InEnglish ? MSG_EN_FULLY_AUTO MSG_EN_THANKS \
: MSG_CN_FULLY_AUTO ", " MSG_CN_THANKS;
chsrc_log (xy_2strjoin (msg, purple (source->mirror->name)));
thank_mirror (msg);
}
}
else
@ -685,7 +694,7 @@ chsrc_conclude (SourceInfo *source, const char *last_word)
{
char *msg = CliOpt_InEnglish ? MSG_EN_SEMI_AUTO MSG_EN_STILL MSG_EN_THANKS \
: MSG_CN_SEMI_AUTO ", " MSG_CN_STILL "" MSG_CN_THANKS;
chsrc_log (xy_2strjoin (msg, purple (source->mirror->name)));
thank_mirror (msg);
}
}
else
@ -712,7 +721,7 @@ chsrc_conclude (SourceInfo *source, const char *last_word)
{
char *msg = CliOpt_InEnglish ? MSG_EN_CONSTRAINT MSG_EN_THANKS \
: MSG_CN_CONSTRAINT ", " MSG_CN_THANKS;
chsrc_log (xy_2strjoin (msg, purple (source->mirror->name)));
thank_mirror (msg);
}
}
else
@ -735,7 +744,7 @@ chsrc_conclude (SourceInfo *source, const char *last_word)
else
{
char *msg = CliOpt_InEnglish ? MSG_EN_THANKS : MSG_CN_THANKS;
chsrc_log (xy_2strjoin (msg, purple (source->mirror->name)));
thank_mirror (msg);
}
}
else

View File

@ -6,15 +6,15 @@
* Contributors : Shengwei Chen <414685209@qq.com>
* |
* Created on : <2023-08-29>
* Last modified : <2024-08-22>
* Last modified : <2024-08-23>
*
*
* ------------------------------------------------------------*/
typedef struct MirrorSite_t {
const char *code; // 用于用户指定镜像站
const char *abbr;
const char *name;
const char *abbr; // 需要使用镜像站的英文名时,用这个代替,因为大部分镜像站没有提供正式的英文名
const char *name; // 镜像站中文名
const char *site;
const char *__bigfile_url; // 用于对该镜像站测速
} MirrorSite;
@ -32,7 +32,7 @@ typedef struct MirrorSite_t {
* https://github.com/mirrorz-org/oh-my-mirrorz 挑选速度前10位
*/
MirrorSite
MirrorZ = {"mirrorz", "MirrorZ", "MirrorZ 校园网镜像站", "https://mirrors.cernet.edu.cn/", NULL},
MirrorZ = {"mirrorz", "MirrorZ", "MirrorZ 校园网镜像站", "https://mirrors.cernet.edu.cn/", NULL},
Tuna = {"tuna", "TUNA", "清华大学开源软件镜像站", "https://mirrors.tuna.tsinghua.edu.cn/",
"https://mirrors.tuna.tsinghua.edu.cn/speedtest/1000mb.bin"},

View File

@ -595,9 +595,6 @@ main (int argc, char const *argv[])
else if (xy_streql (argv[i], "-dry"))
{
CliOpt_DryRun = true;
char *msg = CliOpt_InEnglish ? "** Enable [Dry Run] mode. Simulate the source changing process (skipping speed measurement). Commands only print but don't run **\n"
: "**开启Dry Run模式模拟换源过程(跳过测速),命令仅打印并不运行**\n";
chsrc_log (bdyellow(msg));
}
else if (xy_streql (argv[i], "-no-color") || xy_streql (argv[i], "-no-colour"))
{
@ -623,6 +620,10 @@ main (int argc, char const *argv[])
bool matched = false;
char *dry_msg = CliOpt_InEnglish ? "** Enable [Dry Run] mode. Simulate the source changing process (skipping speed measurement). Commands only print but don't run **\n"
: "**开启Dry Run模式模拟换源过程(跳过测速),命令仅打印并不运行**\n";
chsrc_log (bdyellow(dry_msg));
/* chsrc help */
if (xy_streql (command, "h")
|| xy_streql (command, "-h")