Skip to content

Commit

Permalink
Fix cake day readout (#1596)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sjmarf authored Jan 12, 2025
1 parent 368162a commit e36259f
Show file tree
Hide file tree
Showing 2 changed files with 79 additions and 6 deletions.
6 changes: 3 additions & 3 deletions Mlem/App/Views/Shared/ProfileDateView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ struct ProfileDateView: View {
}

func format(_ date: Date) -> String {
var relTime = date.getRelativeTime(unitsStyle: .abbreviated)
if profilable.isCakeDay {
relTime = String(localized: "\(relTime) today!")
let components = Calendar.current.dateComponents([.year], from: profilable.created, to: .now)
return "\(date.dateString), " + String(localized: "\(components.year ?? 0) years ago today!")
}
return "\(date.dateString), \(relTime)"
return "\(date.dateString), \(date.getRelativeTime(unitsStyle: .abbreviated))"
}
}
79 changes: 76 additions & 3 deletions Mlem/Localizable.xcstrings
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,6 @@
},
"%@ rules..." : {

},
"%@ today!" : {

},
"%@ transferred ownership of a community" : {

Expand Down Expand Up @@ -164,6 +161,24 @@
}
}
}
},
"en-GB" : {
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "%lld Crosspost..."
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "%lld Crossposts..."
}
}
}
}
}
}
},
Expand All @@ -179,6 +194,46 @@
},
"%lld on your instance" : {

},
"%lld years ago today!" : {
"localizations" : {
"en" : {
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "%lld year ago today!"
}
},
"other" : {
"stringUnit" : {
"state" : "new",
"value" : "%lld years ago today!"
}
}
}
}
},
"en-GB" : {
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "%lld year ago today!"
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "%lld years ago today!"
}
}
}
}
}
}
},
"A censure signifies that an instance disapproves of another instance. Like an endorsement, it is completely subjective and a reason does not have to be given." : {

Expand Down Expand Up @@ -1882,6 +1937,24 @@
}
}
}
},
"en-GB" : {
"variations" : {
"plural" : {
"one" : {
"stringUnit" : {
"state" : "translated",
"value" : "There was %lld recorded incidents today."
}
},
"other" : {
"stringUnit" : {
"state" : "translated",
"value" : "There were %lld recorded incidents today."
}
}
}
}
}
}
},
Expand Down

0 comments on commit e36259f

Please sign in to comment.