Add Norwegian locale and corresponding test (failing as pr issue #146) #147
Changes from all commits
499c088
2d6f979
addb287
baf202d
3bac878
d4f2284
b836be6
6cd26f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.soywiz.klock.locale | ||
|
||
import com.soywiz.klock.DayOfWeek | ||
import com.soywiz.klock.KlockLocale | ||
|
||
val KlockLocale.Companion.norwegian get() = NorwegianKlockLocale | ||
|
||
open class NorwegianKlockLocale : KlockLocale() { | ||
|
||
companion object : NorwegianKlockLocale() | ||
|
||
override val ISO639_1 = "nb" | ||
|
||
override val firstDayOfWeek = DayOfWeek.Monday | ||
|
||
override val daysOfWeek = listOf( | ||
"søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag" | ||
) | ||
|
||
override val months = listOf( | ||
"januar", | ||
"februar", | ||
"mars", | ||
"april", | ||
"mai", | ||
"juni", | ||
"juli", | ||
"august", | ||
"september", | ||
"oktober", | ||
"november", | ||
"desember" | ||
) | ||
|
||
override val formatDateTimeMedium = format("dd.MM.y HH:mm:ss") | ||
override val formatDateTimeShort = format("dd.MM.yy HH:mm") | ||
|
||
override val formatDateFull = format("EEEE, d. MMMM y") | ||
override val formatDateLong = format("d. MMMM y") | ||
override val formatDateMedium = format("dd.MM.y") | ||
override val formatDateShort = format("dd.MM.yy") | ||
|
||
override val formatTimeMedium = format("HH:mm:ss") | ||
override val formatTimeShort = format("HH:mm") | ||
|
||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,11 +11,11 @@ class KlockLocaleTest { | |
fun testSpanishLocale() { | ||
assertEquals( | ||
""" | ||
Mié, 13 Mar 2019 21:36:45 UTC | ||
mié, 13 mar 2019 21:36:45 UTC | ||
13/03/2019 21:36:45 | ||
13/03/19 21:36 | ||
Miércoles, 13 de Marzo de 2019 | ||
13 de Marzo de 2019 | ||
miércoles, 13 de marzo de 2019 | ||
13 de marzo de 2019 | ||
13/03/2019 | ||
13/03/19 | ||
21:36:45 | ||
|
@@ -29,12 +29,12 @@ class KlockLocaleTest { | |
fun testFrenchLocale() { | ||
assertEquals( | ||
""" | ||
Mer, 13 Mar 2019 21:36:45 UTC | ||
13 Mar 2019 21:36:45 | ||
mer, 13 mar 2019 21:36:45 UTC | ||
13 mar 2019 21:36:45 | ||
13/03/2019 21:36 | ||
Mercredi 13 Mars 2019 | ||
13 Mars 2019 | ||
13 Mar 2019 | ||
mercredi 13 mars 2019 | ||
13 mars 2019 | ||
13 mar 2019 | ||
13/03/2019 | ||
21:36:45 | ||
21:36 | ||
|
@@ -61,6 +61,24 @@ class KlockLocaleTest { | |
) | ||
} | ||
|
||
@Test | ||
fun testNorwegianLocale() { | ||
assertEquals( | ||
""" | ||
ons, 13 mar 2019 21:36:45 UTC | ||
13.03.2019 21:36:45 | ||
13.03.19 21:36 | ||
onsdag, 13. mars 2019 | ||
13. mars 2019 | ||
13.03.2019 | ||
13.03.19 | ||
21:36:45 | ||
21:36 | ||
""".trimIndent(), | ||
multiFormat(NorwegianKlockLocale, KlockLocale.norwegian) | ||
) | ||
} | ||
|
||
@Test | ||
fun testJapaneseLocale() { | ||
assertEquals( | ||
|
@@ -83,12 +101,12 @@ class KlockLocaleTest { | |
fun testDutchLocale() { | ||
assertEquals( | ||
""" | ||
Woe, 13 Maa 2019 21:36:45 UTC | ||
13 Maa 2019 21:36:45 | ||
woe, 13 maa 2019 21:36:45 UTC | ||
13 maa 2019 21:36:45 | ||
13-03-19 21:36 | ||
Woensdag 13 Maart 2019 | ||
13 Maart 2019 | ||
13 Maa 2019 | ||
woensdag 13 maart 2019 | ||
13 maart 2019 | ||
13 maa 2019 | ||
13-03-2019 | ||
21:36:45 | ||
21:36 | ||
|
@@ -101,12 +119,12 @@ class KlockLocaleTest { | |
fun testPortugueseLocale() { | ||
assertEquals( | ||
""" | ||
Qua, 13 Mar 2019 21:36:45 UTC | ||
13 de Mar de 2019 21:36:45 | ||
qua, 13 mar 2019 21:36:45 UTC | ||
13 de mar de 2019 21:36:45 | ||
13/03/2019 21:36 | ||
Quarta-feira, 13 de Março de 2019 | ||
13 de Março de 2019 | ||
13 de Mar de 2019 | ||
quarta-feira, 13 de março de 2019 | ||
13 de março de 2019 | ||
13 de mar de 2019 | ||
13/03/2019 | ||
21:36:45 | ||
21:36 | ||
|
@@ -119,12 +137,12 @@ class KlockLocaleTest { | |
fun testRussianLocale() { | ||
assertEquals( | ||
""" | ||
Ср, 13 Мар 2019 21:36:45 UTC | ||
13 Мар 2019 г. 21:36:45 | ||
ср, 13 мар 2019 21:36:45 UTC | ||
13 мар 2019 г. 21:36:45 | ||
13.03.2019 21:36 | ||
Среда, 13 Марта 2019 г. | ||
13 Марта 2019 г. | ||
13 Мар 2019 г. | ||
среда, 13 марта 2019 г. | ||
Dambakk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
13 марта 2019 г. | ||
13 мар 2019 г. | ||
13.03.2019 | ||
21:36:45 | ||
21:36 | ||
|
@@ -173,12 +191,12 @@ class KlockLocaleTest { | |
fun testUkrainianLocale() { | ||
assertEquals( | ||
""" | ||
Ср, 13 Бер 2019 21:36:45 UTC | ||
13 Бер 2019 р. 21:36:45 | ||
ср, 13 бер 2019 21:36:45 UTC | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For Ukrainian, the day of the week should start with an upper letter: "Ср" instead of "ср". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi!
|
||
13 бер 2019 р. 21:36:45 | ||
13.03.2019 21:36 | ||
Середа, 13 Березня 2019 р. | ||
13 Березня 2019 р. | ||
13 Бер 2019 р. | ||
середа, 13 березня 2019 р. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The full format of the day of the week should start with an upper letter as well. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi!
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm cross-checking with how Java DateTime does formatting and gets an exception:
Can you confirm that Java is wrong and that it should be uppercased? |
||
13 березня 2019 р. | ||
13 бер 2019 р. | ||
13.03.2019 | ||
21:36:45 | ||
21:36 | ||
|
@@ -226,7 +244,7 @@ class KlockLocaleTest { | |
fun testTemporalSetDefault() { | ||
assertEquals("Wed, 13 Mar 2019 21:36:45 UTC", date.toString()) | ||
KlockLocale.setTemporarily(KlockLocale.spanish) { | ||
assertEquals("Mié, 13 Mar 2019 21:36:45 UTC", date.toString()) | ||
assertEquals("mié, 13 mar 2019 21:36:45 UTC", date.toString()) | ||
} | ||
assertEquals("Wed, 13 Mar 2019 21:36:45 UTC", date.toString()) | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The day of the week ("ср") should start with an upper letter ("Ср")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! Can you confirm that all weekdays in two-letter short form should start with an upper case letter?
Can you type them here so it gets correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like that?