1
0
mirror of https://github.com/wulkanowy/wulkanowy.git synced 2024-11-22 03:56:46 -06:00

Add Kashubian language (#2579)

This commit is contained in:
Rafał Borcz 2024-05-31 10:14:48 +02:00 committed by GitHub
parent 7f6a2435d0
commit d0ad5028d8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 35 additions and 7 deletions

1
.gitignore vendored
View File

@ -71,6 +71,7 @@ captures/
.idea/deploymentTargetDropDown.xml .idea/deploymentTargetDropDown.xml
.idea/deploymentTargetSelector.xml .idea/deploymentTargetSelector.xml
.idea/kotlinc.xml .idea/kotlinc.xml
.idea/studiobot.xml
# Keystore files # Keystore files
*.jks *.jks

View File

@ -1,14 +1,32 @@
package io.github.wulkanowy.utils package io.github.wulkanowy.utils
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.time.* import java.time.DayOfWeek.FRIDAY
import java.time.DayOfWeek.* import java.time.DayOfWeek.MONDAY
import java.time.DayOfWeek.SATURDAY
import java.time.DayOfWeek.SUNDAY
import java.time.Instant
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.Month
import java.time.ZoneId
import java.time.ZoneOffset
import java.time.format.DateTimeFormatter import java.time.format.DateTimeFormatter
import java.time.temporal.TemporalAdjusters.* import java.time.temporal.TemporalAdjusters.firstInMonth
import java.util.* import java.time.temporal.TemporalAdjusters.next
import java.time.temporal.TemporalAdjusters.previous
import java.util.Locale
private const val DEFAULT_DATE_PATTERN = "dd.MM.yyyy" private const val DEFAULT_DATE_PATTERN = "dd.MM.yyyy"
fun getDefaultLocaleWithFallback(): Locale {
val locale = Locale.getDefault()
if (locale.language == "csb") {
return Locale.forLanguageTag("pl")
}
return locale
}
fun LocalDate.toTimestamp(): Long = atStartOfDay() fun LocalDate.toTimestamp(): Long = atStartOfDay()
.toInstant(ZoneOffset.UTC) .toInstant(ZoneOffset.UTC)
.toEpochMilli() .toEpochMilli()
@ -23,7 +41,7 @@ fun String.toLocalDate(format: String = DEFAULT_DATE_PATTERN): LocalDate =
LocalDate.parse(this, DateTimeFormatter.ofPattern(format)) LocalDate.parse(this, DateTimeFormatter.ofPattern(format))
fun LocalDate.toFormattedString(pattern: String = DEFAULT_DATE_PATTERN): String = fun LocalDate.toFormattedString(pattern: String = DEFAULT_DATE_PATTERN): String =
format(DateTimeFormatter.ofPattern(pattern)) format(DateTimeFormatter.ofPattern(pattern, getDefaultLocaleWithFallback()))
fun Instant.toFormattedString( fun Instant.toFormattedString(
pattern: String = DEFAULT_DATE_PATTERN, pattern: String = DEFAULT_DATE_PATTERN,
@ -31,7 +49,7 @@ fun Instant.toFormattedString(
): String = atZone(tz).format(DateTimeFormatter.ofPattern(pattern)) ): String = atZone(tz).format(DateTimeFormatter.ofPattern(pattern))
fun Month.getFormattedName(): String { fun Month.getFormattedName(): String {
val formatter = SimpleDateFormat("LLLL", Locale.getDefault()) val formatter = SimpleDateFormat("LLLL", getDefaultLocaleWithFallback())
val date = LocalDateTime.now().withMonth(value) val date = LocalDateTime.now().withMonth(value)
return formatter.format(date.toInstant(ZoneOffset.UTC).toEpochMilli()).capitalise() return formatter.format(date.toInstant(ZoneOffset.UTC).toEpochMilli()).capitalise()
@ -76,7 +94,7 @@ inline val LocalDate.previousOrSameSchoolDay: LocalDate
} }
inline val LocalDate.weekDayName: String inline val LocalDate.weekDayName: String
get() = format(DateTimeFormatter.ofPattern("EEEE", Locale.getDefault())) get() = format(DateTimeFormatter.ofPattern("EEEE", getDefaultLocaleWithFallback()))
inline val LocalDate.monday: LocalDate get() = with(MONDAY) inline val LocalDate.monday: LocalDate get() = with(MONDAY)

View File

@ -19,6 +19,7 @@
<item>Deutsch</item> <item>Deutsch</item>
<item>Čeština</item> <item>Čeština</item>
<item>Slovenčina</item> <item>Slovenčina</item>
<item>Kaszëbsczi</item>
</string-array> </string-array>
<string-array name="services_interval_entries"> <string-array name="services_interval_entries">
<item>15 minut</item> <item>15 minut</item>

View File

@ -19,6 +19,7 @@
<item>Deutsch</item> <item>Deutsch</item>
<item>Čeština</item> <item>Čeština</item>
<item>Slovenčina</item> <item>Slovenčina</item>
<item>Kaszëbsczi</item>
</string-array> </string-array>
<string-array name="services_interval_entries"> <string-array name="services_interval_entries">
<item>15 minutów</item> <item>15 minutów</item>

View File

@ -19,6 +19,7 @@
<item>Deutsch</item> <item>Deutsch</item>
<item>Čeština</item> <item>Čeština</item>
<item>Slovenčina</item> <item>Slovenčina</item>
<item>Kaszëbsczi</item>
</string-array> </string-array>
<string-array name="services_interval_entries"> <string-array name="services_interval_entries">
<item>15 Minuten</item> <item>15 Minuten</item>

View File

@ -19,6 +19,7 @@
<item>Deutsch</item> <item>Deutsch</item>
<item>Čeština</item> <item>Čeština</item>
<item>Slovenčina</item> <item>Slovenčina</item>
<item>Kaszëbsczi</item>
</string-array> </string-array>
<string-array name="services_interval_entries"> <string-array name="services_interval_entries">
<item>15 minut</item> <item>15 minut</item>

View File

@ -19,6 +19,7 @@
<item>Deutsch</item> <item>Deutsch</item>
<item>Čeština</item> <item>Čeština</item>
<item>Slovenčina</item> <item>Slovenčina</item>
<item>Kaszëbsczi</item>
</string-array> </string-array>
<string-array name="services_interval_entries"> <string-array name="services_interval_entries">
<item>15 минут</item> <item>15 минут</item>

View File

@ -19,6 +19,7 @@
<item>Deutsch</item> <item>Deutsch</item>
<item>Čeština</item> <item>Čeština</item>
<item>Slovenčina</item> <item>Slovenčina</item>
<item>Kaszëbsczi</item>
</string-array> </string-array>
<string-array name="services_interval_entries"> <string-array name="services_interval_entries">
<item>15 minút</item> <item>15 minút</item>

View File

@ -19,6 +19,7 @@
<item>Deutsch</item> <item>Deutsch</item>
<item>Čeština</item> <item>Čeština</item>
<item>Slovenčina</item> <item>Slovenčina</item>
<item>Kaszëbsczi</item>
</string-array> </string-array>
<string-array name="services_interval_entries"> <string-array name="services_interval_entries">
<item>15 хвилин</item> <item>15 хвилин</item>

View File

@ -40,6 +40,7 @@
<item>Deutsch</item> <item>Deutsch</item>
<item>Čeština</item> <item>Čeština</item>
<item>Slovenčina</item> <item>Slovenčina</item>
<item>Kaszëbsczi</item>
</string-array> </string-array>
<string-array name="app_language_values" translatable="false"> <string-array name="app_language_values" translatable="false">
<item>system</item> <item>system</item>
@ -50,6 +51,7 @@
<item>de</item> <item>de</item>
<item>cs</item> <item>cs</item>
<item>sk</item> <item>sk</item>
<item>csb</item>
</string-array> </string-array>
<string-array name="services_interval_entries"> <string-array name="services_interval_entries">