From 1769c1f4bc16bf2c4854791506bedcb8e93e43d5 Mon Sep 17 00:00:00 2001 From: Benjamin Bach Date: Fri, 22 Apr 2016 21:19:48 +0200 Subject: [PATCH] Danish language support --- AUTHORS.rst | 1 + HISTORY.rst | 1 + README.rst | 1 + data/languagefiles/da.yaml | 108 +++++++++++++++++++++++++++++++++++++ data/languages.yaml | 1 + tests/test_languages.py | 11 ++++ 6 files changed, 123 insertions(+) create mode 100644 data/languagefiles/da.yaml diff --git a/AUTHORS.rst b/AUTHORS.rst index 5cccca9d0..e469b5180 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -10,6 +10,7 @@ Committers * Alec Koumjian * Artur Sadurski * Artur Gaspar +* Benjamin Bach * Claudio Salazar * Cesar Flores * Elias Dorneles diff --git a/HISTORY.rst b/HISTORY.rst index 3a7a65147..e03ef4cb1 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -7,6 +7,7 @@ x.x.x (xxxx-xx-xx) ------------------ New features: +* Danish language support. * Japanese language support. diff --git a/README.rst b/README.rst index ce593aa76..f8b92b1e9 100644 --- a/README.rst +++ b/README.rst @@ -124,6 +124,7 @@ Supported languages * Belarusian * Chinese * Czech +* Danish * Dutch * English * Tagalog/Filipino diff --git a/data/languagefiles/da.yaml b/data/languagefiles/da.yaml new file mode 100644 index 000000000..32ca72ecc --- /dev/null +++ b/data/languagefiles/da.yaml @@ -0,0 +1,108 @@ +name: Danish + +skip: ["kl", "kl.", "cirka", "d."] + +monday: + - Mandag + - Man +tuesday: + - Tirsdag + - Tir +wednesday: + - Onsdag + - Ons +thursday: + - Torsdag + - Tor +friday: + - Fredag + - Fre +saturday: + - Lørdag + - Lør +sunday: + - Søndag + - Søn + +january: + - Jan + - Januar +february: + - Feb + - Februar +march: + - Marts + - Mar +april: + - April + - Apr +may: + - Maj +june: + - Juni + - Jun +july: + - Juli + - Jul +august: + - August + - Aug +september: + - September + - Sept + - Sep +october: + - Oktober + - Okt +november: + - November + - Nov +december: + - December + - Dec + +year: + - år +month: + - måned + - måneder +week: + - uge + - uger +day: + - dag + - dage +hour: + - time + - timer +minute: + - minut + - minutter + - min +second: + - sekund + - sekunder + - sek + +ago: + - siden + +simplifications: + - i går: 1 dag + - i dag: 0 dage + - en: 1 + - for (\d+)\s*h: for \1 timer + - for (\d+)\s*m: for \1 minutter + - for (\d+)\s*s: for \1 sekunder + - en: 1 + - et: 1 + - (\d+)\s*hr(s?): \1 time\2 + - (\d+)\s*min(s?): \1 minut\2 + - (\d+)\s*sec(s?): \1 sekund\2 + - middag: '12:00' + - midnat: '00:00' + - (\d+)h(\d+)m?: \1:\2 + - mindre end 1 minut siden: 45 seconds + - nu: 0 sekunder + - sidste (uge|måned|år): 1 \1 + diff --git a/data/languages.yaml b/data/languages.yaml index dce48a143..d2c0e3f16 100644 --- a/data/languages.yaml +++ b/data/languages.yaml @@ -4,6 +4,7 @@ base: ar: !include languagefiles/ar.yaml be: !include languagefiles/be.yaml cs: !include languagefiles/cs.yaml +da: !include languagefiles/da.yaml de: !include languagefiles/de.yaml en: !include languagefiles/en.yaml es: !include languagefiles/es.yaml diff --git a/tests/test_languages.py b/tests/test_languages.py index 14ecc4564..b9f79d8a0 100644 --- a/tests/test_languages.py +++ b/tests/test_languages.py @@ -81,6 +81,11 @@ def setUp(self): param('en', "28 Oct 2014 16:39:01 +0000", "28 october 2014 16:39:01 +0000"), param('es', "13 Febrero 2015 a las 23:00", "13 february 2015 23:00"), + # Danish + param('da', "Sep 03 2014", "september 03 2014"), + param('da', "fredag, 03 september 2014", "friday 03 september 2014"), + param('da', "fredag d. 3 september 2014", "friday 3 september 2014"), + # Finnish param('fi', "maanantai tammikuu 16, 2015", "monday january 16 2015"), param('fi', "ma tammi 16, 2015", "monday january 16 2015"), @@ -193,6 +198,11 @@ def test_translation(self, shortname, datetime_string, expected_translation): param('zh', "50 秒", "50 second"), param('zh', "7 周", "7 week"), param('zh', "12 年", "12 year"), + # Danish + param('da', "i går", "1 day"), + param('da', "i dag", "0 day"), + param('da', "sidste måned", "1 month"), + param('da', "mindre end et minut siden", "45 seconds"), # Dutch param('nl', "17 uur geleden", "17 hour ago"), param('nl', "27 jaar geleden", "27 year ago"), @@ -347,6 +357,7 @@ def test_split(self, shortname, datetime_string, expected_tokens): param('en', "#@Sept#04#2014", strip_timezone=False), param('en', "2014-12-13T00:11:00Z", strip_timezone=False), param('de', "Donnerstag, 8. Januar 2015 um 07:17", strip_timezone=False), + param('da', "Torsdag, 8. januar 2015 kl. 07:17", strip_timezone=False), param('ru', "8 января 2015 г. в 9:10", strip_timezone=False), param('cs', "Pondělí v 22:29", strip_timezone=False), param('nl', "woensdag 7 januari om 21:32", strip_timezone=False),