Skip to content

Commit

Permalink
Danish language support
Browse files Browse the repository at this point in the history
  • Loading branch information
benjaoming committed Apr 22, 2016
1 parent 1223377 commit 1769c1f
Show file tree
Hide file tree
Showing 6 changed files with 123 additions and 0 deletions.
1 change: 1 addition & 0 deletions AUTHORS.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Committers
* Alec Koumjian
* Artur Sadurski
* Artur Gaspar
* Benjamin Bach
* Claudio Salazar
* Cesar Flores
* Elias Dorneles
Expand Down
1 change: 1 addition & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ x.x.x (xxxx-xx-xx)
------------------
New features:

* Danish language support.
* Japanese language support.


Expand Down
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ Supported languages
* Belarusian
* Chinese
* Czech
* Danish
* Dutch
* English
* Tagalog/Filipino
Expand Down
108 changes: 108 additions & 0 deletions data/languagefiles/da.yaml
Original file line number Diff line number Diff line change
@@ -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

1 change: 1 addition & 0 deletions data/languages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions tests/test_languages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down Expand Up @@ -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"),
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 1769c1f

Please sign in to comment.