mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-11-16 14:54:23 +08:00
fix(i18n): use English runtime text and localize system UI
This commit is contained in:
@@ -23,29 +23,29 @@ const (
|
||||
func ParseStatusCodeTag(tag string) (lo, hi int, err error) {
|
||||
tag = strings.TrimSpace(tag)
|
||||
if tag == "" {
|
||||
return 0, 0, errors.New("状态码标签不能为空")
|
||||
return 0, 0, errors.New("status code tag must not be empty")
|
||||
}
|
||||
if before, after, ok := strings.Cut(tag, "-"); ok {
|
||||
lo, err = strconv.Atoi(before)
|
||||
if err != nil {
|
||||
return 0, 0, fmt.Errorf("无效状态码区间: %s", tag)
|
||||
return 0, 0, fmt.Errorf("invalid status code range: %s", tag)
|
||||
}
|
||||
hi, err = strconv.Atoi(after)
|
||||
if err != nil {
|
||||
return 0, 0, fmt.Errorf("无效状态码区间: %s", tag)
|
||||
return 0, 0, fmt.Errorf("invalid status code range: %s", tag)
|
||||
}
|
||||
} else {
|
||||
lo, err = strconv.Atoi(tag)
|
||||
if err != nil {
|
||||
return 0, 0, fmt.Errorf("无效状态码: %s", tag)
|
||||
return 0, 0, fmt.Errorf("invalid status code: %s", tag)
|
||||
}
|
||||
hi = lo
|
||||
}
|
||||
if lo > hi {
|
||||
return 0, 0, fmt.Errorf("状态码区间左右端点反序: %s", tag)
|
||||
return 0, 0, fmt.Errorf("status code range endpoints are reversed: %s", tag)
|
||||
}
|
||||
if lo < StatusCodeMin || hi > StatusCodeMax {
|
||||
return 0, 0, fmt.Errorf("状态码须在 %d–%d: %s", StatusCodeMin, StatusCodeMax, tag)
|
||||
return 0, 0, fmt.Errorf("status code must be between %d and %d: %s", StatusCodeMin, StatusCodeMax, tag)
|
||||
}
|
||||
return lo, hi, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user