Skip to content

Commit

Permalink
Merge pull request #7 from jacobras/feature/czech-language
Browse files Browse the repository at this point in the history
Add Czech language
  • Loading branch information
jacobras authored Jan 9, 2024
2 parents 85dc42d + e2b5621 commit 07093dd
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ HumanReadable.timeAgo(instant) // "il y a 3 jours"

### Supported languages

* Czech
* Dutch
* English (**default**)
* French
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package nl.jacobras.humanreadable

import io.github.skeptick.libres.strings.PluralForm
import io.github.skeptick.libres.strings.PluralRule
import io.github.skeptick.libres.strings.PluralRules

// See also: jsMain
Expand All @@ -11,4 +13,13 @@ actual fun extendLibresPlurals() {
PluralRules["es"] = PluralRules["en"]
PluralRules["it"] = PluralRules["en"]
PluralRules["tr"] = PluralRules["en"]

// TODO: Remove when https://github.com/Skeptick/libres/pull/56 is merged
PluralRules["cs"] = PluralRule { number ->
when (number) {
1 -> PluralForm.One
2-4 -> PluralForm.Few
else -> PluralForm.Other
}
}
}
42 changes: 42 additions & 0 deletions src/commonMain/libres/strings/time_units_cs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<plurals name="seconds">
<item quantity="one">sekunda</item>
<item quantity="few">sekundy</item>
<item quantity="other">sekund</item>
</plurals>
<plurals name="minutes">
<item quantity="one">minuta</item>
<item quantity="few">minuty</item>
<item quantity="other">minut</item>
</plurals>
<plurals name="hours">
<item quantity="one">hodina</item>
<item quantity="few">hodiny</item>
<item quantity="other">hodin</item>
</plurals>
<plurals name="days">
<item quantity="one">den</item>
<item quantity="few">dny</item>
<item quantity="other">dní</item>
</plurals>
<plurals name="weeks">
<item quantity="one">týden</item>
<item quantity="few">týdny</item>
<item quantity="other">týdnů</item>
</plurals>
<plurals name="months">
<item quantity="one">měsíc</item>
<item quantity="few">měsíce</item>
<item quantity="other">měsíců</item>
</plurals>
<plurals name="years">
<item quantity="one">rok</item>
<item quantity="few">roky</item>
<item quantity="other">let</item>
</plurals>

<string name="time_ago">před ${time}</string>
<string name="time_in_future">za ${time}</string>
<string name="now">nyní</string>
</resources>
11 changes: 11 additions & 0 deletions src/jsMain/kotlin/nl/jacobras/humanreadable/extendLibresPlurals.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package nl.jacobras.humanreadable

import io.github.skeptick.libres.strings.PluralForm
import io.github.skeptick.libres.strings.PluralRule
import io.github.skeptick.libres.strings.PluralRules

// See also: appleMain
Expand All @@ -11,4 +13,13 @@ actual fun extendLibresPlurals() {
PluralRules["es"] = PluralRules["en"]
PluralRules["it"] = PluralRules["en"]
PluralRules["tr"] = PluralRules["en"]

// TODO: Remove when https://github.com/Skeptick/libres/pull/56 is merged
PluralRules["cs"] = PluralRule { number ->
when (number) {
1 -> PluralForm.One
2-4 -> PluralForm.Few
else -> PluralForm.Other
}
}
}

0 comments on commit 07093dd

Please sign in to comment.