Skip to content

Commit

Permalink
Swedish locale fix (#935)
Browse files Browse the repository at this point in the history
* Update locales.py

Removed "några" from seconds. That is not how we write it.

* Added TestSwedishLocale

* fix linting
  • Loading branch information
olanystrom authored Mar 2, 2021
1 parent fc2cbaa commit 47c715d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
2 changes: 1 addition & 1 deletion arrow/locales.py
Original file line number Diff line number Diff line change
Expand Up @@ -788,7 +788,7 @@ class SwedishLocale(Locale):
timeframes = {
"now": "just nu",
"second": "en sekund",
"seconds": "{0} några sekunder",
"seconds": "{0} sekunder",
"minute": "en minut",
"minutes": "{0} minuter",
"hour": "en timme",
Expand Down
20 changes: 20 additions & 0 deletions tests/test_locales.py
Original file line number Diff line number Diff line change
Expand Up @@ -1367,3 +1367,23 @@ def test_format_timeframe(self):
assert self.locale._format_timeframe("months", 11) == "11ヶ月"
assert self.locale._format_timeframe("year", 1) == "1年"
assert self.locale._format_timeframe("years", 12) == "12年"


@pytest.mark.usefixtures("lang_locale")
class TestSwedishLocale:
def test_plurals(self):
assert self.locale._format_timeframe("now", 0) == "just nu"
assert self.locale._format_timeframe("second", 1) == "en sekund"
assert self.locale._format_timeframe("seconds", 30) == "30 sekunder"
assert self.locale._format_timeframe("minute", 1) == "en minut"
assert self.locale._format_timeframe("minutes", 40) == "40 minuter"
assert self.locale._format_timeframe("hour", 1) == "en timme"
assert self.locale._format_timeframe("hours", 23) == "23 timmar"
assert self.locale._format_timeframe("day", 1) == "en dag"
assert self.locale._format_timeframe("days", 12) == "12 dagar"
assert self.locale._format_timeframe("week", 1) == "en vecka"
assert self.locale._format_timeframe("weeks", 38) == "38 veckor"
assert self.locale._format_timeframe("month", 1) == "en månad"
assert self.locale._format_timeframe("months", 11) == "11 månader"
assert self.locale._format_timeframe("year", 1) == "ett år"
assert self.locale._format_timeframe("years", 12) == "12 år"

0 comments on commit 47c715d

Please sign in to comment.