From e9400f0d40f62e5ec744c86619a380dc066f99ff Mon Sep 17 00:00:00 2001 From: CM Date: Fri, 24 May 2024 14:22:34 +0630 Subject: [PATCH] 1.0.9.RELEASE --- README.md | 6 +- VERSION.md | 5 + pom.xml | 2 +- .../java/mmcalendar/HolidayCalculator.java | 141 ++++++++++++------ src/main/java/mmcalendar/Language.java | 2 +- .../java/mmcalendar/LanguageTranslator.java | 22 ++- src/main/java/mmcalendar/MyanmarDate.java | 2 +- src/main/java/mmcalendar/MyanmarMonths.java | 2 +- src/test/java/Usage.java | 22 --- .../mmcalendar/HolidayCalculatorTest.java | 15 +- .../java/mmcalendar/JavaDateTimeTest.java | 4 +- .../mmcalendar/LanguageTranslatorTest.java | 2 +- .../mmcalendar/MyanmarCalendarKernelTest.java | 4 +- src/test/java/mmcalendar/MyanmarDateTest.java | 2 +- .../java/mmcalendar/MyanmarMonthsTest.java | 16 +- .../MyanmarThingyanDateTimeTest.java | 2 +- 16 files changed, 164 insertions(+), 85 deletions(-) create mode 100644 VERSION.md delete mode 100644 src/test/java/Usage.java diff --git a/README.md b/README.md index 8fee2fb..9c2be0e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ -[![GitHublicense](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/chanmratekoko/mmcalendar/blob/master/LICENSE) [![Maven Central](https://img.shields.io/badge/Maven%20Central-1.0.6.RELEASE-blue.svg)](https://search.maven.org/remote_content?g=com.github.chanmratekoko&a=myanmar-calendar&v=LATEST) +[![GitHublicense](https://img.shields.io/github/license/mashape/apistatus.svg)](https://github.com/chanmratekoko/mmcalendar/blob/master/LICENSE) [![Maven Central](https://img.shields.io/badge/Maven%20Central-1.0.9.RELEASE-blue.svg)](https://search.maven.org/remote_content?g=com.github.chanmratekoko&a=myanmar-calendar&v=LATEST) # Myanmar Calendar **Myanmar Calendar** library for Android and Java applications. @@ -15,7 +15,7 @@ Usage com.github.chanmratekoko myanmar-calendar - 1.0.8.RELEASE + 1.0.9.RELEASE ``` @@ -23,7 +23,7 @@ Usage - Add this to your app `build.gradle`: ```gradle -compile 'com.github.chanmratekoko:myanmar-calendar:1.0.8.RELEASE' +compile 'com.github.chanmratekoko:myanmar-calendar:1.0.9.RELEASE' ``` **3. jar file** diff --git a/VERSION.md b/VERSION.md new file mode 100644 index 0000000..6d3a126 --- /dev/null +++ b/VERSION.md @@ -0,0 +1,5 @@ +### 1.0.9.RELEASE + +* Change Buddhist Era Calculations +* Update Holidays For 2024 +* Bug Fix Myanmar Month Names translations. \ No newline at end of file diff --git a/pom.xml b/pom.xml index 6f82e0b..b7492f6 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ 4.0.0 com.github.chanmratekoko myanmar-calendar - 1.0.8.RELEASE + 1.0.9.RELEASE Myanmar Calendar The Myanmar Calendar Library provides precise calculations for the traditional Burmese calendar system, diff --git a/src/main/java/mmcalendar/HolidayCalculator.java b/src/main/java/mmcalendar/HolidayCalculator.java index bfb0e53..64c659c 100644 --- a/src/main/java/mmcalendar/HolidayCalculator.java +++ b/src/main/java/mmcalendar/HolidayCalculator.java @@ -29,17 +29,20 @@ private HolidayCalculator() { * Chinese New Year */ private static final int[] GH_CHINESE_NEW_YEAR = {2456689, 2456690, 2457073, 2457074, 2457427, 2457428, 2457782, - 2457783, 2458166, 2458167}; + 2457783, 2458166, 2458520, 2458874, 2459257, 2459612, 2459967, 2460351, + 2460705, 2461089, 2461443, 2461797, 2462181, 2462536}; /** * Diwali (ghDiwali) */ - private static final int[] GH_DIWALI = {2456599, 2456953, 2457337, 2457691, 2458045, 2458429}; + private static final int[] GH_DIWALI = {2456599, 2456953, 2457337, 2457691, 2458045, 2458430, 2458784, 2459168, + 2459523, 2459877}; /** * EID ghEid */ - private static final int[] GH_EID = {2456513, 2456867, 2457221, 2457576, 2457930, 2458285}; + private static final int[] GH_EID = {2456513, 2456867, 2457221, 2457576, 2457930, 2458285, 2458640, 2459063, + 2459416, 2459702, 2460125, 2460261}; /** * Check for English Holiday @@ -53,25 +56,25 @@ static List englishHoliday(int gy, int gm, int gd) { List holiday = new ArrayList<>(); - if (gy >= 2018 && gm == 1 && gd == 1) { - holiday.add("New Year Day"); + if ((gy >= 2018 && gy <= 2021) && gm == 1 && gd == 1) { + holiday.add("New Year's Day"); } else if (gy >= 1948 && gm == 1 && gd == 4) { holiday.add("Independence Day"); } else if (gy >= 1947 && gm == 2 && gd == 12) { holiday.add("Union Day"); } else if (gy >= 1958 && gm == 3 && gd == 2) { - holiday.add("Peasants Day"); + holiday.add("Peasants' Day"); } else if (gy >= 1945 && gm == 3 && gd == 27) { holiday.add("Resistance Day"); } else if (gy >= 1923 && gm == 5 && gd == 1) { holiday.add("Labour Day"); } else if (gy >= 1947 && gm == 7 && gd == 19) { - holiday.add("Martyrs Day"); + holiday.add("Martyrs' Day"); } else if (gm == 12 && gd == 25) { holiday.add("Christmas Day"); } else if (gy == 2017 && gm == 12 && gd == 30) { holiday.add("Holiday"); - } else if (gy >= 2017 && gm == 12 && gd == 31) { + } else if ((gy >= 2017 && gy <= 2021) && gm == 12 && gd == 31) { holiday.add("Holiday"); } @@ -108,7 +111,7 @@ else if ((mmonth == 7) && (moonPhase == 1)) { } else if ((myear >= 1282) && (mmonth == 8) && (monthDay == 25)) { holiday.add("National Day"); } else if ((mmonth == 10) && (monthDay == 1)) { - holiday.add("Karen New Year Day"); + holiday.add("Karen New Year's Day"); } else if ((mmonth == 12) && (moonPhase == 1)) { holiday.add("Tabaung Pwe"); } @@ -147,7 +150,7 @@ public static List thingyan(double jdn, double myear, int monthType) { atn = Math.round(ja); if (Math.abs(jdn - (atn + 1)) < 0.0000001) { - holiday.add("Myanmar New Year Day"); + holiday.add("Myanmar New Year's Day"); } if ((myear + monthType) >= bgntg) { @@ -162,6 +165,12 @@ public static List thingyan(double jdn, double myear, int monthType) { } else if (((myear + monthType) >= 1369) && ((myear + monthType) < 1379) && ((jdn == (akn - 2)) || ((jdn >= (atn + 2)) && (jdn <= (akn + 7))))) { holiday.add("Holiday"); + } else if ((((myear + monthType) >= 1384) && (myear + monthType) <= 1385) + && ((jdn == (akn - 5)) || (jdn == (akn - 4)) || (jdn == (akn - 3)) || (jdn == (akn - 2)))) { + holiday.add("Holiday"); + } else if ((myear + monthType) >= 1386 + && (((jdn >= (atn + 2)) && (jdn <= (akn + 7))))) { + holiday.add("Holiday"); } } @@ -188,6 +197,28 @@ public static List getOtherHolidays(double jd) { return holiday; } + private static List getSubstituteHoliday(double jd) { + + List holiday = new ArrayList<>(); + + int[] substituteHoliday = { + // 2019 + 2458768, 2458772, 2458785, 2458800, + // 2020 + 2458855, 2458918, 2458950, 2459051, 2459062, + 2459152, 2459156, 2459167, 2459181, 2459184, + // 2021 + 2459300, 2459303, 2459323, 2459324, + 2459335, 2459548, 2459573, + }; + + if (BinarySearchUtil.search(jd, substituteHoliday) >= 0) { + holiday.add("Holiday"); + } + + return holiday; + } + /** * Anniversary day * @@ -202,43 +233,43 @@ private static List getAnniversaryDay(double jd, CalendarType calendarTy calendarType = CalendarType.ENGLISH; } - List holiday = new ArrayList<>(); + List anniversary = new ArrayList<>(); WesternDate wd = WesternDate.of(jd, calendarType); double doe = dateOfEaster(wd.getYear()); if ((wd.getYear() <= 2017) && (wd.getMonth() == 1) && (wd.getDay() == 1)) { - holiday.add("New Year Day"); + anniversary.add("New Year Day"); } else if ((wd.getYear() >= 1915) && (wd.getMonth() == 2) && (wd.getDay() == 13)) { - holiday.add("G. Aung San BD"); + anniversary.add("G. Aung San BD"); } else if ((wd.getYear() >= 1969) && (wd.getMonth() == 2) && (wd.getDay() == 14)) { - holiday.add("Valentines Day"); + anniversary.add("Valentines Day"); } else if ((wd.getYear() >= 1970) && (wd.getMonth() == 4) && (wd.getDay() == 22)) { - holiday.add("Earth Day"); + anniversary.add("Earth Day"); } else if ((wd.getYear() >= 1392) && (wd.getMonth() == 4) && (wd.getDay() == 1)) { - holiday.add("April Fools Day"); + anniversary.add("April Fools' Day"); } else if ((wd.getYear() >= 1948) && (wd.getMonth() == 5) && (wd.getDay() == 8)) { - holiday.add("Red Cross Day"); + anniversary.add("Red Cross Day"); } else if ((wd.getYear() >= 1994) && (wd.getMonth() == 10) && (wd.getDay() == 5)) { - holiday.add("World Teachers Day"); + anniversary.add("World Teachers' Day"); } else if ((wd.getYear() >= 1947) && (wd.getMonth() == 10) && (wd.getDay() == 24)) { - holiday.add("United Nations Day"); + anniversary.add("United Nations Day"); } else if ((wd.getYear() >= 1753) && (wd.getMonth() == 10) && (wd.getDay() == 31)) { - holiday.add("Halloween"); + anniversary.add("Halloween"); } if ((wd.getYear() >= 1876) && (jd == doe)) { - holiday.add("Easter"); + anniversary.add("Easter"); } else if ((wd.getYear() >= 1876) && (jd == (doe - 2))) { - holiday.add("Good Friday"); + anniversary.add("Good Friday"); } else if (BinarySearchUtil.search(jd, GH_EID_2) >= 0) { - holiday.add("Eid"); + anniversary.add("Eid"); } if (BinarySearchUtil.search(jd, GH_CHINESE_NEW_YEAR) >= 0) { - holiday.add("Chinese New Year"); + anniversary.add("Chinese New Year's"); } - return holiday; + return anniversary; } /** @@ -284,12 +315,12 @@ private static List getMyanmarAnniversaryDay(double myear, int mmonth, i List holiday = new ArrayList<>(); if ((myear >= 1309) && (mmonth == 11) && (monthDay == 16)) { - holiday.add("Mon National Day"); + holiday.add("'Mon' National Day"); } // the ancient founding of Hanthawady else if ((mmonth == 9) && (monthDay == 1)) { - holiday.add("Shan New Year Day"); + holiday.add("Shan New Year's Day"); if (myear >= 1306) { - holiday.add("Authors Day"); + holiday.add("Authors' Day"); } } // Nadaw waxing moon 1 else if ((mmonth == 3) && (moonPhase == 1)) { @@ -299,10 +330,10 @@ else if ((mmonth == 6) && (moonPhase == 1)) { holiday.add("Garudhamma Day"); } // Tawthalin full moon else if ((myear >= 1356) && (mmonth == 10) && (moonPhase == 1)) { - holiday.add("Mothers Day"); + holiday.add("Mothers' Day"); } // Pyatho full moon else if ((myear >= 1370) && (mmonth == 12) && (moonPhase == 1)) { - holiday.add("Fathers Day"); + holiday.add("Fathers' Day"); } // Tabaung full moon else if ((mmonth == 5) && (moonPhase == 1)) { holiday.add("Metta Day"); @@ -322,7 +353,16 @@ else if ((mmonth == 5) && (monthDay == 23)) { * @return List of holiday String */ public static List getHoliday(MyanmarDate myanmarDate) { - return getHoliday(myanmarDate, Config.getInstance().getCalendarType()); + return getHoliday(myanmarDate, Config.getInstance().getLanguage()); + } + + /** + * @param myanmarDate MyanmarDate + * @param language Language + * @return List of holiday String + */ + public static List getHoliday(MyanmarDate myanmarDate, Language language) { + return getHoliday(myanmarDate, Config.getInstance().getCalendarType(), language); } /** @@ -330,7 +370,7 @@ public static List getHoliday(MyanmarDate myanmarDate) { * @param calendarType CalendarType * @return List of holiday String */ - public static List getHoliday(MyanmarDate myanmarDate, CalendarType calendarType) { + public static List getHoliday(MyanmarDate myanmarDate, CalendarType calendarType, Language language) { WesternDate westernDate = WesternDate.of(myanmarDate.getJulianDayNumber(), calendarType); // Office Off @@ -342,10 +382,18 @@ public static List getHoliday(MyanmarDate myanmarDate, CalendarType cale List holiday = new ArrayList<>(); - holiday.addAll(hde); - holiday.addAll(hdm); - holiday.addAll(hdt); - holiday.addAll(hdo); + holiday.addAll(LanguageTranslator.translateSentenceList(hde, Language.ENGLISH, language)); + + holiday.addAll(LanguageTranslator.translateSentenceList(hdm, Language.ENGLISH, language)); + + holiday.addAll(LanguageTranslator.translateSentenceList(hdt, Language.ENGLISH, language)); + + holiday.addAll(LanguageTranslator.translateSentenceList(hdo, Language.ENGLISH, language)); + + if (westernDate.getYear() >= 2019 && westernDate.getYear() <= 2021) { + List substituteHoliday = getSubstituteHoliday(myanmarDate.getJulianDayNumber()); + holiday.addAll(LanguageTranslator.translateSentenceList(substituteHoliday, Language.ENGLISH, language)); + } return holiday; } @@ -363,7 +411,16 @@ public static boolean isHoliday(MyanmarDate myanmarDate) { * @return List of holiday String */ public static List getAnniversary(MyanmarDate myanmarDate) { - return getAnniversary(myanmarDate, Config.getInstance().getCalendarType()); + return getAnniversary(myanmarDate, Config.getInstance().getCalendarType(), Config.getInstance().getLanguage()); + } + + /** + * @param myanmarDate MyanmarDate Object + * @param language Language + * @return List of holiday String + */ + public static List getAnniversary(MyanmarDate myanmarDate, Language language) { + return getAnniversary(myanmarDate, Config.getInstance().getCalendarType(), language); } /** @@ -371,16 +428,16 @@ public static List getAnniversary(MyanmarDate myanmarDate) { * @param calendarType CalendarType * @return List of holiday String */ - public static List getAnniversary(MyanmarDate myanmarDate, CalendarType calendarType) { + public static List getAnniversary(MyanmarDate myanmarDate, CalendarType calendarType, Language language) { List ecd = getAnniversaryDay(myanmarDate.getJulianDayNumber(), calendarType); // anniversary day List mcd = getMyanmarAnniversaryDay(myanmarDate.getYearValue(), myanmarDate.getMonth(), myanmarDate.getDayOfMonth(), myanmarDate.getMoonPhaseValue()); - List holiday = new ArrayList<>(); + List anniversary = new ArrayList<>(); - holiday.addAll(ecd); - holiday.addAll(mcd); + anniversary.addAll(LanguageTranslator.translateSentenceList(ecd, Language.ENGLISH, language)); + anniversary.addAll(LanguageTranslator.translateSentenceList(mcd, Language.ENGLISH, language)); - return holiday; + return anniversary; } } diff --git a/src/main/java/mmcalendar/Language.java b/src/main/java/mmcalendar/Language.java index 2a83f06..faffeeb 100644 --- a/src/main/java/mmcalendar/Language.java +++ b/src/main/java/mmcalendar/Language.java @@ -11,7 +11,7 @@ public enum Language { ZAWGYI(2, "၊ ", "။ "), MON(3, "၊ ", "။ "), TAI(4, "၊ ", "။ "), - KAREN(5, "၊ ", "။ "); + SGAW_KAREN(5, "၊ ", "။ "); private final int languageIndex; diff --git a/src/main/java/mmcalendar/LanguageTranslator.java b/src/main/java/mmcalendar/LanguageTranslator.java index 40dcc53..6343fdd 100644 --- a/src/main/java/mmcalendar/LanguageTranslator.java +++ b/src/main/java/mmcalendar/LanguageTranslator.java @@ -1,5 +1,8 @@ package mmcalendar; +import java.util.List; +import java.util.stream.Collectors; + /** * Language Translator * @@ -59,7 +62,7 @@ public class LanguageTranslator { {"Mahayatkyan", "မဟာရက်ကြမ်း", "မဟာရက္ၾကမ္း", "ကိုန်ဟွံခိုဟ်", "မဟာရက်ကြမ်း", "မဟာရက်ကြမ်း"}, {"Nagapor", "နဂါးပေါ်", "နဂါးေပၚ", "နာ်မံက်", "နဂါးပေါ်", "နဂါးပေါ်"}, {"Shanyat", "ရှမ်းရက်", "ရွမ္းရက္", "တ္ၚဲဒတန်", "ရှမ်းရက်", "ရှမ်းရက်"}, - {"Mooon", "မွန်", "မြန္", "ပၠန်", "မွၼ်း", "မွန်"}, + {"'Mon'", "မွန်", "မြန္", "ပၠန်", "မွၼ်း", "မွန်"}, {"G. Aung San BD", "ဗိုလ်ချုပ်မွေးနေ့", "ဗိုလ္ခ်ဳပ္ေမြးေန႔", "တ္ၚဲသၟိၚ်ဗၟာ အံၚ်သာန်ဒှ်မၞိဟ်", "ဝၼ်းၵိူတ်ၸွမ်သိုၵ်", "ဗိုလ်ချုပ်မွေးနေ့"}, {"Valentines", "ချစ်သူများ", "ခ်စ္သူမ်ား", "ဝုတ်ဗၠာဲ", "ၵေႃႈႁၵ်ႉ", "ချစ်သူများ"}, {"Earth", "ကမ္ဘာမြေ", "ကမၻာေျမ", "ဂၠးကဝ်", "လိၼ်မိူင်း", "ကမ္ဘာမြေ"}, @@ -205,7 +208,7 @@ private LanguageTranslator() { */ private static String translateSentence(String str, int fromLn, int toLn) { for (String[] dic : CATALOG) { - str = str.replace(dic[fromLn], dic[toLn]); + str = str.replaceAll(dic[fromLn], dic[toLn]); } return str; } @@ -237,6 +240,21 @@ private static String translate(String str, int fromLn, int toLn) { return str; } + /** + * Translate sentence to the specific language + * + * @param list Sentence List + * @param from Translate Language from + * @param to Translate Language to + * @return translated result + */ + public static List translateSentenceList(List list, Language from, Language to) { + return list.stream() + .map(it -> + LanguageTranslator.translateSentence(it, from, to) + ).collect(Collectors.toList()); + } + /** * Translate sentence to the specific language * diff --git a/src/main/java/mmcalendar/MyanmarDate.java b/src/main/java/mmcalendar/MyanmarDate.java index de581cb..d9e1ff8 100644 --- a/src/main/java/mmcalendar/MyanmarDate.java +++ b/src/main/java/mmcalendar/MyanmarDate.java @@ -414,7 +414,7 @@ public String getMonthName(Language language) { .append(" "); } - stringBuilder.append(LanguageTranslator.translate(EMA[this.mmonth], language)); + stringBuilder.append(LanguageTranslator.translateSentence(EMA[this.mmonth], Language.ENGLISH, language)); return stringBuilder.toString(); } diff --git a/src/main/java/mmcalendar/MyanmarMonths.java b/src/main/java/mmcalendar/MyanmarMonths.java index 30a2ffa..b80a2c1 100644 --- a/src/main/java/mmcalendar/MyanmarMonths.java +++ b/src/main/java/mmcalendar/MyanmarMonths.java @@ -51,7 +51,7 @@ public List getMonthNameList(Language language) { } List temp = new ArrayList<>(); for (String string : monthNameList) { - temp.add(LanguageTranslator.translate(string, language)); + temp.add(LanguageTranslator.translateSentence(string, Language.ENGLISH, language)); } return temp; } diff --git a/src/test/java/Usage.java b/src/test/java/Usage.java deleted file mode 100644 index d76bcf2..0000000 --- a/src/test/java/Usage.java +++ /dev/null @@ -1,22 +0,0 @@ -import mmcalendar.HolidayCalculator; -import mmcalendar.Language; -import mmcalendar.MyanmarCalendarKernel; -import mmcalendar.MyanmarDate; - -import java.util.List; - -public class Usage { - public static void main(String[] args) { -// String header = MyanmarCalendarKernel.getCalendarHeader(1380, 2, Language.ENGLISH); -// System.out.println(header); - - // Output : သာသနာနှစ် ၂၅၆၇ - ၂၅၆၈ ခု မြန်မာနှစ် ၁၃၈၅ - ၁၃၈၆ ခု တပေါင်း - တန်ခူး -// String header = MyanmarCalendarKernel.getCalendarHeaderForWesternStyle(2024, 4, Language.ENGLISH); -// System.out.println(header); - - List anniversary = HolidayCalculator.getAnniversary(MyanmarDate.of(2017,1 ,1)); - System.out.println(anniversary); - - } - -} diff --git a/src/test/java/mmcalendar/HolidayCalculatorTest.java b/src/test/java/mmcalendar/HolidayCalculatorTest.java index 24b898d..f25cfde 100644 --- a/src/test/java/mmcalendar/HolidayCalculatorTest.java +++ b/src/test/java/mmcalendar/HolidayCalculatorTest.java @@ -24,10 +24,17 @@ public void myanmarHoliday() { assertEquals(actualList, holiday); } + @Test + public void unionDay() { + MyanmarDate unionDayDate = MyanmarDate.of(2024, 2, 12); + String unionDay = HolidayCalculator.getHoliday(unionDayDate, Language.MYANMAR).get(0); + assertEquals("ပြည်ထောင်စု နေ့", unionDay); + } + @Test public void thingyan() { List thingyan = HolidayCalculator.thingyan(2460052, 1385, 0); - List actualList = Collections.singletonList("Myanmar New Year Day"); + List actualList = Collections.singletonList("Myanmar New Year's Day"); assertEquals(actualList, thingyan); } @@ -35,7 +42,7 @@ public void thingyan() { public void getHoliday() { MyanmarDate myanmarDate = MyanmarDate.of(2460052); List thingyan = HolidayCalculator.getHoliday(myanmarDate); - List actualList = Collections.singletonList("Myanmar New Year Day"); + List actualList = Collections.singletonList("Myanmar နှစ်ဆန်း နေ့"); assertEquals(actualList, thingyan); } @@ -49,11 +56,11 @@ public void isHoliday() { @Test public void getAnniversary() { MyanmarDate newYearDate = MyanmarDate.of(2017, 1, 1); - String newYear = HolidayCalculator.getAnniversary(newYearDate).get(0); + String newYear = HolidayCalculator.getAnniversary(newYearDate, Language.ENGLISH).get(0); assertEquals("New Year Day", newYear); MyanmarDate aungSanBDDate = MyanmarDate.of(2024, 2, 13); - String aungSanBD = HolidayCalculator.getAnniversary(aungSanBDDate).get(0); + String aungSanBD = HolidayCalculator.getAnniversary(aungSanBDDate, Language.ENGLISH).get(0); assertEquals("G. Aung San BD", aungSanBD); } } diff --git a/src/test/java/mmcalendar/JavaDateTimeTest.java b/src/test/java/mmcalendar/JavaDateTimeTest.java index bed7396..8669c7c 100644 --- a/src/test/java/mmcalendar/JavaDateTimeTest.java +++ b/src/test/java/mmcalendar/JavaDateTimeTest.java @@ -10,14 +10,14 @@ public class JavaDateTimeTest { @Test public void checkCurrentCalendarDateInMyanmar() { MyanmarDate myanmarDate = MyanmarDate.now(); - Assert.assertEquals(1385, myanmarDate.getYearValue()); + Assert.assertEquals(1386, myanmarDate.getYearValue()); } @Test public void checkWithSystemTimeCalendar() { LocalDateTime localDateTime = LocalDateTime.now(); MyanmarDate myanmarDate = MyanmarDate.of(localDateTime); - Assert.assertEquals(1385, myanmarDate.getYearValue()); + Assert.assertEquals(1386, myanmarDate.getYearValue()); WesternDate westernDate = WesternDate.of(myanmarDate.getJulianDayNumber(), CalendarType.ENGLISH); Assert.assertEquals(2024, westernDate.getYear()); diff --git a/src/test/java/mmcalendar/LanguageTranslatorTest.java b/src/test/java/mmcalendar/LanguageTranslatorTest.java index 55c8bb9..2c4741b 100644 --- a/src/test/java/mmcalendar/LanguageTranslatorTest.java +++ b/src/test/java/mmcalendar/LanguageTranslatorTest.java @@ -20,7 +20,7 @@ public void translateTwo() { String zawgyi = LanguageTranslator.translate("Year", Language.ZAWGYI); String mon = LanguageTranslator.translate("Year", Language.MON); String tai = LanguageTranslator.translate("Year", Language.TAI); - String karen = LanguageTranslator.translate("Year", Language.KAREN); + String karen = LanguageTranslator.translate("Year", Language.SGAW_KAREN); assertEquals("နှစ်", myanmar); assertEquals("ႏွစ္", zawgyi); diff --git a/src/test/java/mmcalendar/MyanmarCalendarKernelTest.java b/src/test/java/mmcalendar/MyanmarCalendarKernelTest.java index ddba135..7a8b6d7 100644 --- a/src/test/java/mmcalendar/MyanmarCalendarKernelTest.java +++ b/src/test/java/mmcalendar/MyanmarCalendarKernelTest.java @@ -98,7 +98,7 @@ public void getCalendarHeaderForWesternStyle() { @Test public void getCalendarHeader() { String head = MyanmarCalendarKernel.getCalendarHeader(1380, 2); - String actual = "သာသနာနှစ် ၂၅၆၁ - ၂၅၆၂ ခု၊ မြန်မာနှစ် ၁၃၇၉ - ၁၃၈၀ ခု၊ နှောင်းကဆုန် - ကဆုန်"; + String actual = "သာသနာနှစ် ၂၅၆၁ - ၂၅၆၂ ခု၊ မြန်မာနှစ် ၁၃၇၉ - ၁၃၈၀ ခု၊ နှောင်း ကဆုန် - ကဆုန်"; Assert.assertEquals(actual, head); } @@ -107,7 +107,7 @@ public void getCalendarHeader2() { String monthName = "Tagu"; int monthIndex = MyanmarDateKernel.searchMyanmarMonthNumber(monthName); String head = MyanmarCalendarKernel.getCalendarHeader(1385, monthIndex); - String actual = "သာသနာနှစ် ၂၅၆၆ ခု၊ မြန်မာနှစ် ၁၃၈၄ - ၁၃၈၅ ခု၊ နှောင်းတန်ခူး - တန်ခူး"; + String actual = "သာသနာနှစ် ၂၅၆၆ ခု၊ မြန်မာနှစ် ၁၃၈၄ - ၁၃၈၅ ခု၊ နှောင်း တန်ခူး - တန်ခူး"; Assert.assertEquals(actual, head); } diff --git a/src/test/java/mmcalendar/MyanmarDateTest.java b/src/test/java/mmcalendar/MyanmarDateTest.java index a307ff7..902a5a0 100644 --- a/src/test/java/mmcalendar/MyanmarDateTest.java +++ b/src/test/java/mmcalendar/MyanmarDateTest.java @@ -53,7 +53,7 @@ public void outputsInMyanmarBurmese() { MyanmarDate myanmarDate = MyanmarDate.of(1989, 4, 15); final String format = "S s k, B y k, M p f r En"; Language language = Language.MYANMAR; - String aspectMyanmarResult = "သာသနာနှစ် ၂၅၃၂ ခု, မြန်မာနှစ် ၁၃၅၀ ခု, နှောင်းတန်ခူး လဆန်း ၁၀ ရက် စနေနေ့"; + String aspectMyanmarResult = "သာသနာနှစ် ၂၅၃၂ ခု, မြန်မာနှစ် ၁၃၅၀ ခု, နှောင်း တန်ခူး လဆန်း ၁၀ ရက် စနေနေ့"; Assert.assertEquals(aspectMyanmarResult, myanmarDate.format(format, language)); assertTrue(myanmarDate.isWeekend()); assertEquals("Late", myanmarDate.getMnt(Language.ENGLISH)); diff --git a/src/test/java/mmcalendar/MyanmarMonthsTest.java b/src/test/java/mmcalendar/MyanmarMonthsTest.java index 2afc99c..b3e683d 100644 --- a/src/test/java/mmcalendar/MyanmarMonthsTest.java +++ b/src/test/java/mmcalendar/MyanmarMonthsTest.java @@ -51,7 +51,7 @@ public void getAllMonthNamesTai() { List myanmarNameList = myanmarMonths.getMonthNameList(Language.TAI); final String[] taiMonthNames = {"ႁႃႈ", "ႁူၵ်း", "ၸဵတ်း", "ပႅတ်ႇ", "ၵဝ်ႈ", - "သိပ်း", "သိပ်းဢဵတ်း", "သိပ်းသွင်", "ၸဵင်", "ၵမ်", "သၢမ်", "သီႇ", "ဝၢႆးႁႃႈ", + "သိပ်း", "သိပ်းဢဵတ်း", "သိပ်းသွင်", "ၸဵင်", "ၵမ်", "သၢမ်", "သီႇ", "ဝၢႆး ႁႃႈ", }; assertArrayEquals(taiMonthNames, myanmarNameList.toArray()); @@ -78,6 +78,20 @@ public void getAllMonthNamesLate() { assertArrayEquals(monthNames, myanmarMonths.getMonthNameList(Language.ENGLISH).toArray()); } + @Test + public void getAllMonthNamesLateMM() { + int myear = 1385; + MyanmarMonths myanmarMonths = MyanmarCalendarKernel.calculateRelatedMyanmarMonths(myear, 13); + + final String[] monthNames = { + "တန်ခူး", "ကဆုန်", "နယုန်", "ပ ဝါဆို", "ဒု ဝါဆို", "ဝါခေါင်", + "တော်သလင်း", "သီတင်းကျွတ်", + "တန်ဆောင်မုန်း", "နတ်တော်", "ပြာသို", "တပို့တွဲ", "တပေါင်း", "နှောင်း တန်ခူး", + }; + + assertArrayEquals(monthNames, myanmarMonths.getMonthNameList(Language.MYANMAR).toArray()); + } + public static List calculateRelatedMyanmarMonthNames(int myear) { return MyanmarCalendarKernel.calculateRelatedMyanmarMonths(myear, 0).getMonthNameList(); } diff --git a/src/test/java/mmcalendar/MyanmarThingyanDateTimeTest.java b/src/test/java/mmcalendar/MyanmarThingyanDateTimeTest.java index aa1cb19..3f3b077 100644 --- a/src/test/java/mmcalendar/MyanmarThingyanDateTimeTest.java +++ b/src/test/java/mmcalendar/MyanmarThingyanDateTimeTest.java @@ -43,7 +43,7 @@ public void calculateDoubleAkyatDay() { MyanmarDate akyatDaate1 = thingyan.getAkyatDays()[0]; MyanmarDate akyatDaate2 = thingyan.getAkyatDays()[1]; - String monthName = LanguageTranslator.translate(akyatDaate1.getMonthName(), Language.MYANMAR, Language.ENGLISH); + String monthName = LanguageTranslator.translateSentence(akyatDaate1.getMonthName(), Language.MYANMAR, Language.ENGLISH); MyanmarDate expectedDay1 = MyanmarDate.create(akyatDaate1.getYearValue(), monthName, akyatDaate1.getDayOfMonth()); MyanmarDate expectedDay2 = MyanmarDate.create(akyatDaate2.getYearValue(), akyatDaate2.getMonth(), akyatDaate2.getDayOfMonth());