Skip to content

Commit

Permalink
2020 China calendar discrepancies fix (#1645)
Browse files Browse the repository at this point in the history
Co-authored-by: DarkKnightYHJ <54981811+darkknightyhj@users.noreply.github.com>
  • Loading branch information
PPsyrius and DarkKnightYHJ committed Jan 20, 2024
1 parent 61bf023 commit 1cbd6c2
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 20 deletions.
17 changes: 15 additions & 2 deletions holidays/countries/china.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class China(ObservedHolidayBase, ChineseCalendarHolidays, InternationalHolidays,
- `2023 <https://www.gov.cn/gongbao/content/2023/content_5736714.htm>`_
- `2022 <https://www.gov.cn/gongbao/content/2021/content_5651728.htm>`_
- `2021 <https://www.gov.cn/gongbao/content/2020/content_5567750.htm>`_
- `2020 Extensions <https://www.gov.cn/zhengce/zhengceku/2020-01/27/content_5472352.htm>`_
- `2020 <https://www.gov.cn/gongbao/content/2019/content_5459138.htm>`_
- `2019 <https://www.gov.cn/gongbao/content/2018/content_5350046.htm>`_
- `2018 <https://www.gov.cn/gongbao/content/2017/content_5248221.htm>`_
Expand Down Expand Up @@ -206,6 +207,12 @@ class ChinaStaticHolidays:
# Day off (substituted from %s).
substituted_label = tr("休息日(%s日起取代)")

# Chinese New Year (Spring Festival).
chinese_new_year = tr("春节")

# Chinese New Year (Spring Festival) Extended Holiday.
chinese_new_year_extended = tr("春节延长假期")

# Dragon Boat Festival.
dragon_boat_festival = tr("端午节")

Expand Down Expand Up @@ -381,7 +388,10 @@ class ChinaStaticHolidays:
),
2020: (
(JAN, 24, JAN, 19), # Spring Festival
(JAN, 30, FEB, 1), # Spring Festival
# JAN, 30 in special_public_holidays_observed
(JAN, 31, chinese_new_year_extended), # Spring Festival Extended Holiday
(FEB, 1, chinese_new_year_extended), # Spring Festival Extended Holiday
(FEB, 2, chinese_new_year_extended), # Spring Festival Extended Holiday
(MAY, 4, APR, 26), # Labor Day
(MAY, 5, MAY, 9), # Labor Day
(JUN, 26, JUN, 28), # Dragon Boat Festival
Expand Down Expand Up @@ -430,5 +440,8 @@ class ChinaStaticHolidays:
special_public_holidays_observed = {
2012: (JUN, 22, dragon_boat_festival), # observed from Jun 23
2015: (OCT, 6, mid_autumn_festival), # observed from Sep 27
2020: (OCT, 6, mid_autumn_festival), # observed from Oct 1, overlap with National Day
2020: (
(JAN, 30, chinese_new_year), # Spring Festival (extended due to Covid-19 decree)
(OCT, 6, mid_autumn_festival), # observed from Oct 1, overlap with National Day
),
}
12 changes: 8 additions & 4 deletions holidays/locale/en_US/LC_MESSAGES/CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Python Holidays 0.41\n"
"Project-Id-Version: Python Holidays 0.42\n"
"POT-Creation-Date: 2023-09-28 19:23+0700\n"
"PO-Revision-Date: 2023-12-29 19:02+0200\n"
"Last-Translator: ~Jhellico <jhellico@gmail.com>\n"
"PO-Revision-Date: 2024-01-18 11:42+0700\n"
"Last-Translator: PPsyrius <ppsyrius@ppsyrius.dev>\n"
"Language-Team: Python Holidays localization team\n"
"Language: en_US\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"Generated-By: Lingua 4.15.0\n"
"X-Generator: Poedit 3.4\n"
"X-Generator: Poedit 3.4.2\n"

#. %s (observed).
#, c-format
Expand Down Expand Up @@ -85,3 +85,7 @@ msgid "中国人民抗日战争暨世界反法西斯战争胜利70周年纪念
msgstr ""
"70th Anniversary of the Victory of the Chinese People’s War of Resistance "
"against Japanese Aggression and the World Anti-Fascist War"

#. Chinese New Year (Spring Festival) Extended Holiday.
msgid "春节延长假期"
msgstr "Chinese New Year Extended Holiday"
12 changes: 8 additions & 4 deletions holidays/locale/th/LC_MESSAGES/CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Python Holidays 0.41\n"
"Project-Id-Version: Python Holidays 0.42\n"
"POT-Creation-Date: 2023-09-28 19:23+0700\n"
"PO-Revision-Date: 2023-12-30 17:46+0200\n"
"Last-Translator: ~Jhellico <jhellico@gmail.com>\n"
"PO-Revision-Date: 2024-01-18 11:42+0700\n"
"Last-Translator: PPsyrius <ppsyrius@ppsyrius.dev>\n"
"Language-Team: Python Holidays localization team\n"
"Language: th\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"Generated-By: Lingua 4.15.0\n"
"X-Generator: Poedit 3.4\n"
"X-Generator: Poedit 3.4.2\n"

#. %s (observed).
#, c-format
Expand Down Expand Up @@ -84,3 +84,7 @@ msgstr "วันหยุด (แทน %s)"
msgid "中国人民抗日战争暨世界反法西斯战争胜利70周年纪念日"
msgstr ""
"ครบรอบ 70 ปีแห่งการได้รับชัยชนะจากสงครามต่อต้านญี่ปุ่นและลัทธิฟาสซิสต์โลก"

#. Chinese New Year (Spring Festival) Extended Holiday.
msgid "春节延长假期"
msgstr "หยุดพิเศษวันตรุษจีน"
12 changes: 8 additions & 4 deletions holidays/locale/zh_CN/LC_MESSAGES/CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Python Holidays 0.41\n"
"Project-Id-Version: Python Holidays 0.42\n"
"POT-Creation-Date: 2023-09-28 19:23+0700\n"
"PO-Revision-Date: 2023-12-29 19:03+0200\n"
"Last-Translator: ~Jhellico <jhellico@gmail.com>\n"
"PO-Revision-Date: 2024-01-18 11:43+0700\n"
"Last-Translator: PPsyrius <ppsyrius@ppsyrius.dev>\n"
"Language-Team: Python Holidays localization team\n"
"Language: zh_CN\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"Generated-By: Lingua 4.15.0\n"
"X-Generator: Poedit 3.4\n"
"X-Generator: Poedit 3.4.2\n"

#. %s (observed).
#, c-format
Expand Down Expand Up @@ -83,3 +83,7 @@ msgstr ""
#. Aggression and the World Anti-Fascist War.
msgid "中国人民抗日战争暨世界反法西斯战争胜利70周年纪念日"
msgstr ""

#. Chinese New Year (Spring Festival) Extended Holiday.
msgid "春节延长假期"
msgstr ""
12 changes: 8 additions & 4 deletions holidays/locale/zh_TW/LC_MESSAGES/CN.po
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@
#
msgid ""
msgstr ""
"Project-Id-Version: Python Holidays 0.41\n"
"Project-Id-Version: Python Holidays 0.42\n"
"POT-Creation-Date: 2023-09-28 19:23+0700\n"
"PO-Revision-Date: 2023-12-29 19:04+0200\n"
"Last-Translator: ~Jhellico <jhellico@gmail.com>\n"
"PO-Revision-Date: 2024-01-18 11:43+0700\n"
"Last-Translator: PPsyrius <ppsyrius@ppsyrius.dev>\n"
"Language-Team: Python Holidays localization team\n"
"Language: zh_TW\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"Generated-By: Lingua 4.15.0\n"
"X-Generator: Poedit 3.4\n"
"X-Generator: Poedit 3.4.2\n"

#. %s (observed).
#, c-format
Expand Down Expand Up @@ -83,3 +83,7 @@ msgstr "休息日(%s日起取代)"
#. Aggression and the World Anti-Fascist War.
msgid "中国人民抗日战争暨世界反法西斯战争胜利70周年纪念日"
msgstr "中國人民抗日戰爭暨世界反法西斯戰爭勝利70週年紀念日"

#. Chinese New Year (Spring Festival) Extended Holiday.
msgid "春节延长假期"
msgstr "春節延長假期"
5 changes: 4 additions & 1 deletion snapshots/countries/CN_COMMON.json
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,10 @@
"2020-01-27": "Chinese New Year (Spring Festival)",
"2020-01-28": "Chinese New Year (Spring Festival) (observed)",
"2020-01-29": "Chinese New Year (Spring Festival) (observed)",
"2020-01-30": "Day off (substituted from 02/01/2020)",
"2020-01-30": "Chinese New Year (Spring Festival) (observed)",
"2020-01-31": "Chinese New Year Extended Holiday",
"2020-02-01": "Chinese New Year Extended Holiday",
"2020-02-02": "Chinese New Year Extended Holiday",
"2020-03-08": "International Women's Day",
"2020-04-04": "Tomb-Sweeping Day",
"2020-04-06": "Tomb-Sweeping Day (observed)",
Expand Down
6 changes: 5 additions & 1 deletion tests/countries/test_china.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@ def test_2019_public_holiday(self):

def test_2020_public_holiday(self):
# https://www.gov.cn/gongbao/content/2019/content_5459138.htm
# https://www.gov.cn/zhengce/zhengceku/2020-01/27/content_5472352.htm
self.assertHolidays(
China(categories=PUBLIC, years=2020),
("2020-01-01", "元旦"),
Expand All @@ -753,7 +754,10 @@ def test_2020_public_holiday(self):
("2020-01-27", "春节"),
("2020-01-28", "春节(观察日)"),
("2020-01-29", "春节(观察日)"),
("2020-01-30", "休息日(2020-02-01日起取代)"),
("2020-01-30", "春节(观察日)"),
("2020-01-31", "春节延长假期"),
("2020-02-01", "春节延长假期"),
("2020-02-02", "春节延长假期"),
("2020-04-04", "清明节"),
("2020-04-06", "清明节(观察日)"),
("2020-05-01", "劳动节"),
Expand Down

0 comments on commit 1cbd6c2

Please sign in to comment.