Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fixes #254] Fix some chinese translation and date display format #267

Merged
merged 2 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Clendar/Base/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ extension ContentView {
.clipShape(Circle())
.accessibilityHidden(true)
.overlay(
Text(date.toDateString(calendar: store.calendar))
Text(date.toNumericDateString(calendar: store.calendar))
.minimumScaleFactor(0.5)
.font(.boldFontWithSize(17))
.foregroundColor(
Expand All @@ -227,13 +227,13 @@ extension ContentView {
}
},
trailing: { date in
Text(date.toDateString(calendar: store.calendar))
Text(date.toNumericDateString(calendar: store.calendar))
.minimumScaleFactor(0.5)
.font(.boldFontWithSize(15))
.foregroundColor(Color(.gray).opacity(0.3))
},
header: { date in
Text(date.toDayString(calendar: store.calendar).localizedUppercase)
Text(date.toNumericDateString(calendar: store.calendar).localizedUppercase)
.minimumScaleFactor(0.5)
.font(.regularFontWithSize(12))
.foregroundColor(.appGray)
Expand Down
6 changes: 5 additions & 1 deletion Clendar/Helper/Extensions/Date+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,11 @@ extension Date {
func toDateString(calendar: Calendar = CalendarIdentifier.current.calendar) -> String {
DateFormatter.asString(self, format: "d", calendar: calendar)
}


func toNumericDateString(calendar: Calendar = CalendarIdentifier.current.calendar) -> String {
DateFormatter.asNonlocalizedString(self, format: "d", calendar: calendar)
}

func toDateAndMonthString(calendar: Calendar = CalendarIdentifier.current.calendar) -> String {
DateFormatter.asString(self, format: "MMM d", calendar: calendar)
}
Expand Down
11 changes: 11 additions & 0 deletions Clendar/Helper/Extensions/DateFormatter+Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,15 @@ extension DateFormatter {
dateFormatter.calendar = calendar
return dateFormatter.string(from: date)
}

static func asNonlocalizedString(
_ date: Date,
format: String,
calendar: Calendar = CalendarIdentifier.current.calendar
) -> String {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = format
dateFormatter.calendar = calendar
return dateFormatter.string(from: date)
}
}
6 changes: 3 additions & 3 deletions Clendar/Resources/Localization/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "완전히 새롭게 재설계됨"
"value" : "全新设计"
}
},
"zh-Hant" : {
Expand Down Expand Up @@ -1286,7 +1286,7 @@
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "日曆類型"
"value" : "日历类型"
}
},
"zh-Hant" : {
Expand Down Expand Up @@ -11926,7 +11926,7 @@
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "您擁有 Clendar+。 謝謝你的支持! 😊"
"value" : "您拥有 Clendar+。 谢谢你的支持! 😊"
}
},
"zh-Hant" : {
Expand Down
Loading