From 26b3b00f3907f43f8792914e9bd488bd981d3fc7 Mon Sep 17 00:00:00 2001 From: Yeldar Nurpeissov Date: Sun, 25 Aug 2024 15:36:33 +0500 Subject: [PATCH] Add Kazakh/kk language --- .../libres/strings/time_units_kk.xml | 69 +++++++++++++++++++ .../humanreadable/localized/LocalizedTests.kt | 42 +++++++++++ 2 files changed, 111 insertions(+) create mode 100644 src/commonMain/libres/strings/time_units_kk.xml diff --git a/src/commonMain/libres/strings/time_units_kk.xml b/src/commonMain/libres/strings/time_units_kk.xml new file mode 100644 index 0000000..da15910 --- /dev/null +++ b/src/commonMain/libres/strings/time_units_kk.xml @@ -0,0 +1,69 @@ + + + + секунд + секунд + + + секундтан + секундтан + + + + минут + минут + + + минуттан + минуттан + + + + сағат + сағат + + + сағаттан + сағаттан + + + + күн + күн + + + күннен + күннен + + + + апта + апта + + + аптадан + аптадан + + + + ай + ай + + + айдан + айдан + + + + жыл + жыл + + + жылдан + жылдан + + + ${time} бұрын + ${time} кейін + қазір + diff --git a/src/commonTest/kotlin/nl/jacobras/humanreadable/localized/LocalizedTests.kt b/src/commonTest/kotlin/nl/jacobras/humanreadable/localized/LocalizedTests.kt index 22b9b8c..4571742 100644 --- a/src/commonTest/kotlin/nl/jacobras/humanreadable/localized/LocalizedTests.kt +++ b/src/commonTest/kotlin/nl/jacobras/humanreadable/localized/LocalizedTests.kt @@ -17,12 +17,27 @@ import kotlin.time.Duration.Companion.seconds class LocalizedTests { private val now: Instant = Clock.System.now() + private val twoSeconds = 2.seconds + private val twoSecondsAgo = now - twoSeconds + private val twoSecondsFromNow = now + twoSeconds private val oneMinute = 1.minutes private val oneMinuteAgo = now - oneMinute private val oneMinuteFromNow = now + oneMinute + private val oneHour = 60.minutes + private val oneHourAgo = now - oneHour + private val oneHourFromNow = now + oneHour + private val oneDay = 1.days + private val oneDayAgo = now - oneDay + private val oneDayFromNow = now + oneDay + private val oneWeek = 7.days + private val oneWeekAgo = now - oneWeek + private val oneWeekFromNow = now + oneWeek private val twoMonths = 60.days private val twoMonthsAgo = now - twoMonths private val twoMonthsFromNow = now + twoMonths + private val oneYear = 365.days + private val oneYearAgo = now - oneYear + private val oneYearFromNow = now + oneYear @Test fun cs() { @@ -82,6 +97,33 @@ class LocalizedTests { assertThat(HumanReadable.duration(2.seconds)).isEqualTo("2 秒") } + @Test + fun kk() { + LibresSettings.languageCode = "kk" + assertThat(HumanReadable.timeAgo(now)).isEqualTo("қазір") + assertThat(HumanReadable.duration(twoSeconds)).isEqualTo("2 секунд") + assertThat(HumanReadable.timeAgo(twoSecondsAgo, baseInstant = now)).isEqualTo("2 секунд бұрын") + assertThat(HumanReadable.timeAgo(twoSecondsFromNow, baseInstant = now)).isEqualTo("2 секундтан кейін") + assertThat(HumanReadable.duration(oneMinute)).isEqualTo("1 минут") + assertThat(HumanReadable.timeAgo(oneMinuteAgo, baseInstant = now)).isEqualTo("1 минут бұрын") + assertThat(HumanReadable.timeAgo(oneMinuteFromNow, baseInstant = now)).isEqualTo("1 минуттан кейін") + assertThat(HumanReadable.duration(oneHour)).isEqualTo("1 сағат") + assertThat(HumanReadable.timeAgo(oneHourAgo, baseInstant = now)).isEqualTo("1 сағат бұрын") + assertThat(HumanReadable.timeAgo(oneHourFromNow, baseInstant = now)).isEqualTo("1 сағаттан кейін") + assertThat(HumanReadable.duration(oneDay)).isEqualTo("1 күн") + assertThat(HumanReadable.timeAgo(oneDayAgo, baseInstant = now)).isEqualTo("1 күн бұрын") + assertThat(HumanReadable.timeAgo(oneDayFromNow, baseInstant = now)).isEqualTo("1 күннен кейін") + assertThat(HumanReadable.duration(oneWeek)).isEqualTo("1 апта") + assertThat(HumanReadable.timeAgo(oneWeekAgo, baseInstant = now)).isEqualTo("1 апта бұрын") + assertThat(HumanReadable.timeAgo(oneWeekFromNow, baseInstant = now)).isEqualTo("1 аптадан кейін") + assertThat(HumanReadable.duration(twoMonths)).isEqualTo("2 ай") + assertThat(HumanReadable.timeAgo(twoMonthsAgo, baseInstant = now)).isEqualTo("2 ай бұрын") + assertThat(HumanReadable.timeAgo(twoMonthsFromNow, baseInstant = now)).isEqualTo("2 айдан кейін") + assertThat(HumanReadable.duration(oneYear)).isEqualTo("1 жыл") + assertThat(HumanReadable.timeAgo(oneYearAgo, baseInstant = now)).isEqualTo("1 жыл бұрын") + assertThat(HumanReadable.timeAgo(oneYearFromNow, baseInstant = now)).isEqualTo("1 жылдан кейін") + } + @Test fun ko() { LibresSettings.languageCode = "ko"