Skip to content

Commit 516bc34

Browse files
committed
Updated translation coverage
1 parent 3d61248 commit 516bc34

File tree

3 files changed

+48
-54
lines changed

3 files changed

+48
-54
lines changed

TRANSLATIONS.md

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,34 @@ See [Android Translations Converter](https://github.com/Crustack/android-transla
1919
<!-- translations:start -->
2020
| Language | Coverage |
2121
|----------|----------|
22-
| 🇺🇸 English | 100% (333/333) |
23-
| 🇪🇸 Catalan | 19% (65/333) |
24-
| 🇨🇿 Czech | 93% (313/333) |
25-
| 🇩🇰 Danish | 20% (69/333) |
26-
| 🇩🇪 German | 98% (327/333) |
27-
| 🇬🇷 Greek | 21% (72/333) |
28-
| 🇪🇸 Spanish | 94% (314/333) |
29-
| 🇫🇷 French | 98% (327/333) |
30-
| 🇭🇺 Hungarian | 19% (65/333) |
31-
| 🇮🇩 Indonesian | 22% (75/333) |
32-
| 🇮🇹 Italian | 87% (291/333) |
33-
| 🇯🇵 Japanese | 21% (73/333) |
34-
| 🇲🇲 Burmese | 27% (90/333) |
35-
| 🇳🇴 Norwegian Bokmål | 31% (106/333) |
36-
| 🇳🇱 Dutch | 63% (212/333) |
37-
| 🇳🇴 Norwegian Nynorsk | 31% (106/333) |
38-
| 🇵🇱 Polish | 90% (300/333) |
39-
| 🇧🇷 Portuguese (Brazil) | 93% (312/333) |
40-
| 🇵🇹 Portuguese (Portugal) | 21% (71/333) |
41-
| 🇷🇴 Romanian | 90% (301/333) |
42-
| 🇷🇺 Russian | 91% (305/333) |
43-
| 🇸🇰 Slovak | 19% (65/333) |
44-
| 🇸🇮 Slovenian | 32% (109/333) |
45-
| 🇸🇪 Swedish | 18% (63/333) |
46-
| 🇵🇭 Tagalog | 19% (65/333) |
47-
| 🇹🇷 Turkish | 21% (73/333) |
48-
| 🇺🇦 Ukrainian | 97% (326/333) |
49-
| 🇻🇳 Vietnamese | 32% (107/333) |
50-
| 🇨🇳 Chinese (Simplified) | 96% (323/333) |
51-
| 🇹🇼 Chinese (Traditional) | 88% (294/333) |
22+
| 🇺🇸 English | 100% (336/336) |
23+
| 🇪🇸 Catalan | 19% (65/336) |
24+
| 🇨🇿 Czech | 93% (313/336) |
25+
| 🇩🇰 Danish | 20% (69/336) |
26+
| 🇩🇪 German | 97% (327/336) |
27+
| 🇬🇷 Greek | 21% (72/336) |
28+
| 🇪🇸 Spanish | 93% (314/336) |
29+
| 🇫🇷 French | 97% (327/336) |
30+
| 🇭🇺 Hungarian | 19% (65/336) |
31+
| 🇮🇩 Indonesian | 22% (75/336) |
32+
| 🇮🇹 Italian | 86% (291/336) |
33+
| 🇯🇵 Japanese | 21% (73/336) |
34+
| 🇲🇲 Burmese | 26% (90/336) |
35+
| 🇳🇴 Norwegian Bokmål | 31% (106/336) |
36+
| 🇳🇱 Dutch | 63% (212/336) |
37+
| 🇳🇴 Norwegian Nynorsk | 31% (106/336) |
38+
| 🇵🇱 Polish | 89% (300/336) |
39+
| 🇧🇷 Portuguese (Brazil) | 92% (312/336) |
40+
| 🇵🇹 Portuguese (Portugal) | 21% (71/336) |
41+
| 🇷🇴 Romanian | 89% (301/336) |
42+
| 🇷🇺 Russian | 90% (305/336) |
43+
| 🇸🇰 Slovak | 19% (65/336) |
44+
| 🇸🇮 Slovenian | 32% (109/336) |
45+
| 🇸🇪 Swedish | 18% (63/336) |
46+
| 🇵🇭 Tagalog | 19% (65/336) |
47+
| 🇹🇷 Turkish | 21% (73/336) |
48+
| 🇺🇦 Ukrainian | 97% (326/336) |
49+
| 🇻🇳 Vietnamese | 31% (107/336) |
50+
| 🇨🇳 Chinese (Simplified) | 96% (323/336) |
51+
| 🇹🇼 Chinese (Traditional) | 87% (294/336) |
5252
<!-- translations:end -->

app/src/main/java/com/philkes/notallyx/data/model/ModelExtensions.kt

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -330,15 +330,9 @@ fun Reminder.toRepetitionText(context: Context): String {
330330
val dayOfMonth = calendar.get(Calendar.DAY_OF_MONTH)
331331
val isLastDayOfMonth = dayOfMonth == calendar.getActualMaximum(Calendar.DAY_OF_MONTH)
332332

333-
val prefix =
334-
if (rep.value == 1) ""
335-
else
336-
"${context.getString(R.string.every)} ${rep.value} ${context.getString(R.string.months)}"
337-
val postfix =
338-
if (isLastDayOfMonth)
339-
context.getString(R.string.of_the_month_last, context.getString(R.string.day))
340-
else context.getString(R.string.of_the_month, "$dayOfMonth.")
341-
return "$prefix $postfix"
333+
return if (isLastDayOfMonth)
334+
context.getString(R.string.of_the_month_last, context.getString(R.string.day))
335+
else context.getString(R.string.of_the_month, "$dayOfMonth.")
342336
}
343337
return rep.toText(context)
344338
}
@@ -347,10 +341,6 @@ fun Repetition.toText(context: Context): String {
347341
if (unit == RepetitionTimeUnit.MONTHS && occurrence != null && dayOfWeek != null) {
348342
val dayOfWeekStr =
349343
SimpleDateFormat("EEEE", Locale.getDefault())
350-
.apply {
351-
val cal = Calendar.getInstance()
352-
cal.set(Calendar.DAY_OF_WEEK, dayOfWeek!!)
353-
}
354344
.format(
355345
Calendar.getInstance().apply { set(Calendar.DAY_OF_WEEK, dayOfWeek!!) }.time
356346
)
@@ -451,13 +441,19 @@ fun Reminder.nextNotification(from: Date = Date()): Date? {
451441
next.add(Calendar.MONTH, rep.value)
452442
}
453443
}
444+
val calendar = dateTime.toCalendar()
445+
val field = repetition!!.unit.toCalendarField()
446+
val value = repetition!!.value
447+
448+
// If from is exactly at dateTime, we want the next one
449+
while (true) {
450+
calendar.add(field, value)
451+
if (calendar.time.after(from)) {
452+
break
453+
}
454+
}
454455

455-
val timeDifferenceMillis: Long = from.time - dateTime.time
456-
val intervalsPassed = timeDifferenceMillis / rep.toMillis()
457-
val unitsUntilNext = ((rep.value) * (intervalsPassed + 1)).toInt()
458-
val reminderStart = dateTime.toCalendar()
459-
reminderStart.add(rep.unit.toCalendarField(), unitsUntilNext)
460-
return reminderStart.time
456+
return calendar.time
461457
}
462458

463459
private fun findOccurrenceInMonth(

app/src/test/kotlin/com/philkes/notallyx/data/model/ReminderRepetitionTest.kt

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,14 @@ class ReminderRepetitionTest {
150150
}
151151

152152
@Test
153-
fun `nextNotification for Advanced Monthly - 1st Sunday when 1st is Monday`() {
154-
// Oct 2023: 1st is Sunday.
155-
// Nov 2023: 1st is Wednesday. 1st Sunday is Nov 5th.
156-
val start = createDate(2023, Calendar.OCTOBER, 1, 10, 0)
153+
fun `nextNotification for Advanced Monthly - 1st Sunday when 2nd is Monday`() {
154+
val start = createDate(2023, Calendar.OCTOBER, 2, 10, 0)
157155
val repetition =
158156
Repetition(1, RepetitionTimeUnit.MONTHS, occurrence = 1, dayOfWeek = Calendar.SUNDAY)
159157
val reminder = Reminder(1, start, repetition)
160158

161159
// From Oct 2nd
162-
val from = createDate(2023, Calendar.OCTOBER, 2, 9, 0)
160+
val from = createDate(2023, Calendar.OCTOBER, 2, 11, 0)
163161
val expected = createDate(2023, Calendar.NOVEMBER, 5, 10, 0)
164162
assertEquals(expected, reminder.nextNotification(from))
165163
}

0 commit comments

Comments
 (0)