Skip to content

Debloat any Android or Google TV over Wi-Fi and get an Apple TV-style home.

Launcher: lunar_date in Korean, on the Korean calendar (UTC+9)

onedge80c7229207ae
diff --git a/docs/workflows/translation.md b/docs/workflows/translation.md
index da02e65a7..3c7d4acba 100644
--- a/docs/workflows/translation.md
+++ b/docs/workflows/translation.md
@@ -15,9 +15,9 @@
- `fonts.xml`: point `font_body`, `font_regular` and the other `font_*` at the system families when the
bundled Outfit has no glyphs for the language's letters (`values-vi`, #833).
- `lunar.xml`: the lunar date format, the leap-month wording and the stem and branch names, for a
- language that names them itself (`values-zh-rCN`, `values-vi`). Keep `lunar_stems` at ten items and
- `lunar_branches` at twelve: `Lunar.java` indexes both by position, so a short list crashes the
- launcher on a TV running that language and nothing anywhere else.
+ language that names them itself (`values-zh-rCN`, `values-vi`, `values-ko`). Keep `lunar_stems` at ten
+ items and `lunar_branches` at twelve: `Lunar.java` indexes both by position, so a short list crashes
+ the launcher on a TV running that language and nothing anywhere else.
3. Add the locale to `launcher/app/src/main/res/xml/locales_config.xml`, in the tag form: a language
folder that is not registered there cannot be chosen for the launcher alone on Android 13+.
4. Add the language to the Languages list in `README.md`.
diff --git a/launcher/app/src/main/java/com/gathin/tvhome/Lunar.java b/launcher/app/src/main/java/com/gathin/tvhome/Lunar.java
index d6bf13a34..ea1242b18 100644
--- a/launcher/app/src/main/java/com/gathin/tvhome/Lunar.java
+++ b/launcher/app/src/main/java/com/gathin/tvhome/Lunar.java
@@ -16,10 +16,14 @@ final class Lunar {
private Lunar() {
}
- /** Hours east of UTC used for the calendar: lunar_utc_offset, or 7 for Vietnamese and 8 otherwise. */
+ /** Hours east of UTC used for the calendar: lunar_utc_offset, or 7 for Vietnamese, 9 for Korean and 8 otherwise. */
static int offsetFor(int configured, Locale locale) {
if (configured >= 0) return configured;
- return "vi".equals(locale.getLanguage()) ? 7 : 8;
+ switch (locale.getLanguage()) {
+ case "vi": return 7;
+ case "ko": return 9;
+ default: return 8;
+ }
}
/** Today's lunar date, formatted with the locale's strings. */
diff --git a/launcher/app/src/main/res/values-ko/lunar.xml b/launcher/app/src/main/res/values-ko/lunar.xml
new file mode 100644
index 000000000..f5713636d
--- /dev/null
+++ b/launcher/app/src/main/res/values-ko/lunar.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+ <string name="lunar_date_format">음력 %2$s월 %1$d일 · %3$s</string>
+ <string name="lunar_month_leap">윤%1$d</string>
+ <string name="lunar_year">%1$s%2$s년</string>
+ <string-array name="lunar_stems">
+ <item>갑</item><item>을</item><item>병</item><item>정</item><item>무</item>
+ <item>기</item><item>경</item><item>신</item><item>임</item><item>계</item>
+ </string-array>
+ <string-array name="lunar_branches">
+ <item>자</item><item>축</item><item>인</item><item>묘</item><item>진</item><item>사</item>
+ <item>오</item><item>미</item><item>신</item><item>유</item><item>술</item><item>해</item>
+ </string-array>
+</resources>
diff --git a/launcher/app/src/main/res/values/config.xml b/launcher/app/src/main/res/values/config.xml
index a9987423b..1f251563b 100644
--- a/launcher/app/src/main/res/values/config.xml
+++ b/launcher/app/src/main/res/values/config.xml
@@ -229,7 +229,7 @@
<!-- Show the Solar Hijri (Shamsi) date used in Iran and Afghanistan, e.g. "27 Mehr 1405", above the
Gregorian date. -->
<bool name="shamsi_date">false</bool>
- <!-- Lunisolar (Vietnamese / Chinese) date under the date; config.json lunar_date, lunar_utc_offset (7 or 8, default by locale). -->
+ <!-- Lunisolar (Vietnamese / Chinese / Korean) date under the date; config.json lunar_date, lunar_utc_offset (7, 8 or 9, default by locale). -->
<bool name="lunar_date">false</bool>
<!-- The date (with the Shamsi and lunar lines) on its own line under the clock instead of beside it, for a top bar
whose pills leave the date too little room. Can also be set with "date_below_clock" in a theme. -->
diff --git a/launcher/app/src/main/res/values/lunar.xml b/launcher/app/src/main/res/values/lunar.xml
index f3570c7d5..3de1aed02 100644
--- a/launcher/app/src/main/res/values/lunar.xml
+++ b/launcher/app/src/main/res/values/lunar.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- lunar_date (config.json, off by default): the lunisolar date under the date. Translated where the
- calendar is used (vi, zh-rCN, zh-rTW); other locales show the English names on purpose. -->
+ calendar is used (ko, vi, zh-rCN, zh-rTW); other locales show the English names on purpose. -->
<resources xmlns:tools="http://schemas.android.com/tools" tools:ignore="MissingTranslation">
<string name="lunar_date_format">Lunar %1$d/%2$s · %3$s</string>
<string name="lunar_month_leap">%1$d (leap)</string>
diff --git a/launcher/app/src/test/java/com/gathin/tvhome/LunarTest.java b/launcher/app/src/test/java/com/gathin/tvhome/LunarTest.java
index 0b4a11368..27e09cf2e 100644
--- a/launcher/app/src/test/java/com/gathin/tvhome/LunarTest.java
+++ b/launcher/app/src/test/java/com/gathin/tvhome/LunarTest.java
@@ -1,8 +1,10 @@
package com.gathin.tvhome;
import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import java.util.Locale;
import org.junit.Test;
/** Known lunar dates (Vietnamese calendar, UTC+7 unless noted). Arrays are {day, month, year, leap}. */
@@ -63,6 +65,22 @@ public class LunarTest {
assertArrayEquals(new int[]{1, 1, 1985, 0}, Lunar.fromSolar(20, 2, 1985, 8));
}
+ @Test
+ public void koreaAndChinaDifferIn1997And2027() {
+ // Seollal falls a day after the Chinese new year when the new moon is just after 15:00 UTC.
+ assertArrayEquals(new int[]{1, 1, 1997, 0}, Lunar.fromSolar(7, 2, 1997, 8));
+ assertArrayEquals(new int[]{30, 12, 1996, 0}, Lunar.fromSolar(7, 2, 1997, 9));
+ assertArrayEquals(new int[]{1, 1, 1997, 0}, Lunar.fromSolar(8, 2, 1997, 9));
+ assertArrayEquals(new int[]{1, 1, 2027, 0}, Lunar.fromSolar(6, 2, 2027, 8));
+ assertArrayEquals(new int[]{1, 1, 2027, 0}, Lunar.fromSolar(7, 2, 2027, 9));
+ }
+
+ @Test
+ public void koreanHolidays2026() {
+ assertArrayEquals(new int[]{1, 1, 2026, 0}, Lunar.fromSolar(17, 2, 2026, 9));
+ assertArrayEquals(new int[]{15, 8, 2026, 0}, Lunar.fromSolar(25, 9, 2026, 9));
+ }
+
@Test
public void dayBeforeANewMoonJustAfterMidnightIsTheThirtieth() {
// The new moon of 26 March 2009 16:06 UTC is 27 March in China; the day before was day 0, not 30/2.
@@ -82,4 +100,13 @@ public class LunarTest {
}
}
}
+
+ @Test
+ public void offsetFollowsTheLanguageUnlessConfigured() {
+ assertEquals(7, Lunar.offsetFor(-1, new Locale("vi")));
+ assertEquals(8, Lunar.offsetFor(-1, Locale.SIMPLIFIED_CHINESE));
+ assertEquals(9, Lunar.offsetFor(-1, Locale.KOREAN));
+ assertEquals(8, Lunar.offsetFor(-1, Locale.ENGLISH));
+ assertEquals(8, Lunar.offsetFor(8, Locale.KOREAN));
+ }
}
diff --git a/themes/README.md b/themes/README.md
index 0b416c67a..220ee7d31 100644
--- a/themes/README.md
+++ b/themes/README.md
@@ -83,7 +83,7 @@ A new key needs one there in the same pull request.
| `library_apps` | list of package names | Packages pre-seeded into the App library's "added" set at startup (config.xml `library_apps`, or a theme's `config.json`). They show on Home as if the owner had added them in the App library UI, and stay removable there (a removed one stays hidden); empty (off) by default |
| `shamsi_date` | bool | Show the Solar Hijri date above the Gregorian one |
| `lunar_date` | bool | Show the lunisolar date under the Gregorian one, e.g. `LUNAR 13/9 · YEAR OF THE HORSE`, or `13/9 ÂM LỊCH · BÍNH NGỌ` in Vietnamese; a leap month is marked. Off by default |
-| `lunar_utc_offset` | 0 to 14 | Hours east of UTC the lunar calendar is computed for: `7` is the Vietnamese calendar, `8` the Chinese one; they differ by a day now and then (and by a month in 1985). Unset: 7 when the TV is in Vietnamese, 8 otherwise |
+| `lunar_utc_offset` | 0 to 14 | Hours east of UTC the lunar calendar is computed for: `7` is the Vietnamese calendar, `8` the Chinese one, `9` the Korean one; they differ by a day now and then (and by a month in 1985). Unset: 7 when the TV is in Vietnamese, 9 in Korean, 8 otherwise |
| `date_below_clock` | bool | The date (with the Shamsi and lunar lines) on its own line under the clock instead of beside it, for a top bar whose pills leave the date too little room (`false` by default) |
| `locale` | string | The language the launcher shows itself in, as a language tag (`"vi"`, `"pt-BR"`), instead of the TV's: for firmware with no menu entry for a language the launcher speaks (a China-market Xiaomi offers Chinese and English only). Empty by default, which follows the TV |
| `greeting_name` | string | A name after the greeting, e.g. `"Mr. Trịnh"` for GOOD MORNING, MR. TRỊNH; empty for the greeting alone |