feat(home): AI 캐릭터 섹션을 연결한다
This commit is contained in:
@@ -3090,7 +3090,58 @@ If you block this user, the following features will be restricted.
|
||||
}
|
||||
|
||||
static var aiCharacterSectionTitle: String {
|
||||
pick(ko: "AI 캐릭터", en: "AI characters", ja: "AIキャラクター")
|
||||
pick(ko: "크리에이터와 이야기를 나눠요!", en: "AI characters", ja: "AIキャラクター")
|
||||
}
|
||||
|
||||
static func compactChatCount(_ count: Int) -> String {
|
||||
pick(
|
||||
ko: compactEastAsianCount(count, tenMillionUnit: "억", tenThousandUnit: "만", thousandUnit: "천"),
|
||||
en: compactEnglishCount(count),
|
||||
ja: compactEastAsianCount(count, tenMillionUnit: "億", tenThousandUnit: "万", thousandUnit: "千")
|
||||
)
|
||||
}
|
||||
|
||||
private static func compactEastAsianCount(
|
||||
_ count: Int,
|
||||
tenMillionUnit: String,
|
||||
tenThousandUnit: String,
|
||||
thousandUnit: String
|
||||
) -> String {
|
||||
if count >= 100_000_000 {
|
||||
return compactCountValue(count, divisor: 100_000_000, unit: tenMillionUnit)
|
||||
}
|
||||
|
||||
if count >= 10_000 {
|
||||
return compactCountValue(count, divisor: 10_000, unit: tenThousandUnit)
|
||||
}
|
||||
|
||||
if count >= 1_000 {
|
||||
return compactCountValue(count, divisor: 1_000, unit: thousandUnit)
|
||||
}
|
||||
|
||||
return count.comma()
|
||||
}
|
||||
|
||||
private static func compactEnglishCount(_ count: Int) -> String {
|
||||
if count >= 1_000_000_000 {
|
||||
return compactCountValue(count, divisor: 1_000_000_000, unit: "B")
|
||||
}
|
||||
|
||||
if count >= 1_000_000 {
|
||||
return compactCountValue(count, divisor: 1_000_000, unit: "M")
|
||||
}
|
||||
|
||||
if count >= 1_000 {
|
||||
return compactCountValue(count, divisor: 1_000, unit: "K")
|
||||
}
|
||||
|
||||
return count.comma()
|
||||
}
|
||||
|
||||
private static func compactCountValue(_ count: Int, divisor: Int, unit: String) -> String {
|
||||
let value = floor((Double(count) / Double(divisor)) * 10) / 10
|
||||
let format = value.truncatingRemainder(dividingBy: 1) == 0 ? "%.0f" : "%.1f"
|
||||
return String(format: format, locale: Locale(identifier: "en_US_POSIX"), value) + unit
|
||||
}
|
||||
|
||||
static var genreCreatorSectionTitle: String {
|
||||
|
||||
Reference in New Issue
Block a user