The relative date in Chinese language has unnecessary spaces.
Usually the date format should be “mm月dd日” , the current format is “mm月 dd 日” .
I haven’t found any issue with the translation, and also I think the ember helper lead to this issue.
import jQuery from "jquery";
import deprecated from "discourse/lib/deprecated";
import { helperContext, makeArray } from "discourse/lib/helpers";
import I18n, { i18n } from "discourse-i18n";
export function shortDate(date) {
return moment(date).format(i18n("dates.medium.date_year"));
}
export function shortDateNoYear(date) {
return moment(date).format(i18n("dates.tiny.date_month"));
}
// Suppress year if it's this year
export function smartShortDate(date, withYear = tinyDateYear) {
return date.getFullYear() === new Date().getFullYear()
? shortDateNoYear(date)
: withYear(date);
}
This file has been truncated. show original
I think function autoUpdatingRelativeAge adds the extra spaces.
I understand this is not an issue for English version discourse, but may cause some format issues for other languages.
I tried javascript to remove the spaces, but it won’t work with the lazy loading content.
I’m appreciated to any tips for modifying the ember helper in a plugin or any fix from the main branch.
Alteras
(Steven Chang)
8월 27, 2024, 11:17오후
2
이것은 로케일 파일의 날짜 형식 문자열로 인해 간체 중국어에서 발생하는 Contribute > Bug 인 것 같습니다. git 히스토리를 살펴보면, v3.3.0에서 형식은 다음과 같습니다:
percent: "%{count}%"
short:
thousands: "%{number}k"
millions: "%{number}M"
dates:
time: "HH:mm"
time_with_zone: "HH:mm (z)"
time_short_day: "ddd, HH:mm"
timeline_date: "YYYY 年 M 月"
long_no_year: "M 月 D 日 HH:mm"
long_no_year_no_time: "M 月 D 日"
full_no_year_no_time: "M 月 D 日"
long_with_year: "YYYY 年 M 月 D 日 HH:mm"
long_with_year_no_time: "YYYY 年 M 月 D 日"
full_with_year_no_time: "YYYY 年 M 月 D 日"
long_date_with_year: "YYYY 年 MMM 月 D 日 LT"
long_date_without_year: "M 月 D 日 LT"
long_date_with_year_without_time: "YYYY 年 MMM 月 D 日"
long_date_without_year_with_linebreak: "M 月 D 日<br/>LT"
long_date_with_year_with_linebreak: "YYYY 年 MMM 月 D 日<br/>LT"
wrap_ago: "%{date} 前"
최근에 업데이트된 것으로 보입니다(3.4.0.beta1-dev에서 라이브로 확인됨)
percent: "%{count}%"
short:
thousands: "%{number}k"
millions: "%{number}M"
dates:
time: "HH:mm"
time_with_zone: "HH:mm (z)"
time_short_day: "ddd, HH:mm"
timeline_date: "YYYY 年 MMM"
long_no_year: "MMM D 日 HH:mm"
long_no_year_no_time: "MMM D 日"
full_no_year_no_time: "MMMM Do 日"
long_with_year: "YYYY 年 MMM D 日 HH:mm"
long_with_year_no_time: "YYYY 年 MMM D 日"
full_with_year_no_time: "YYYY 年 MMMM Do 日"
long_date_with_year: "YYYY 年 MMM D 日 LT"
long_date_without_year: "MMM D 日 LT"
long_date_with_year_without_time: "YYYY 年 MMM D 日"
long_date_without_year_with_linebreak: "MMM D 日<br/>LT"
long_date_with_year_with_linebreak: "YYYY 年 MMM D 日<br/>LT"
wrap_ago: "%{date} 前"
코드펜에서 "MMM D 日" 형식 문자열을 zh-cn의 기본 Momentjs 설정 과 함께 테스트해 보면, 관찰된 결함(즉, "8월 2 日")이 생성됩니다.
즉각적인 수정을 위해, js.dates.tiny.date_month 및 js.dates.long_no_year_no_time의 번역을 통해 형식을 다음과 같이 변경할 수 있습니다:
2개의 좋아요