Skip to content

Commit

Permalink
fix: add Bulgaria holidays (#48)
Browse files Browse the repository at this point in the history
  • Loading branch information
pradeep-tgl authored Sep 25, 2023
1 parent 9d06357 commit 7088de9
Show file tree
Hide file tree
Showing 7 changed files with 253 additions and 0 deletions.
1 change: 1 addition & 0 deletions config/test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ config :holidefs,
:at,
:au,
:be,
:bg,
:ca,
:ch,
:co,
Expand Down
1 change: 1 addition & 0 deletions lib/holidefs.ex
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ defmodule Holidefs do
at: "Austria",
au: "Australia",
be: "Belgium",
bg: "Bulgaria",
br: "Brazil",
ca: "Canada",
ch: "Switzerland",
Expand Down
5 changes: 5 additions & 0 deletions lib/holidefs/definition/custom_functions.ex
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ defmodule Holidefs.Definition.CustomFunctions do
DateCalculator.gregorian_orthodox_easter(year)
end

@doc false
def julian_orthodox_easter(year, _) do
DateCalculator.julian_orthodox_easter(year)
end

@doc false
def us_inauguration_day(year, rule) when rem(year, 4) == 1 do
{:ok, date} = Date.new(year, rule.month, 20)
Expand Down
138 changes: 138 additions & 0 deletions priv/calendars/definitions/bg.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
# Bulgaria holiday definitions.
#
# Updated: 2015-04-01.
# Source: http://en.wikipedia.org/wiki/Public_holidays_in_Bulgaria
---
months:
0:
- name: Разпети петък
regions: [bg]
function: julian_orthodox_easter(year)
function_modifier: -2
- name: Велика събота
regions: [bg]
function: julian_orthodox_easter(year)
function_modifier: -1
- name: Възкресение Христово. Великден
regions: [bg]
function: julian_orthodox_easter(year)
- name: Възкресение Христово. Великден
regions: [bg]
function: julian_orthodox_easter(year)
function_modifier: 1
1:
- name: Нова година
regions: [bg]
mday: 1
3:
- name: Освобожението на България
regions: [bg]
mday: 3
5:
- name: Ден на труда
regions: [bg]
mday: 1
- name: Гергьовден. Ден на храбростта
regions: [bg]
mday: 6
- name: Ден на славянската писменост
regions: [bg]
mday: 24
9:
- name: Ден на Съединението
regions: [bg]
mday: 6
- name: Ден на Независимостта
regions: [bg]
mday: 22
11:
- name: Ден на Народните будители
regions: [bg]
mday: 1
12:
- name: Бъдни вечер
regions: [bg]
mday: 24
- name: Рождество Христово. Коледа
regions: [bg]
mday: 25
- name: Рождество Христово. Коледа
regions: [bg]
mday: 26

tests:
- given:
date: '2015-01-01'
regions: ["bg"]
expect:
name: "Нова година"
- given:
date: '2015-03-03'
regions: ["bg"]
expect:
name: 'Освобожението на България'
- given:
date: '2015-03-28'
regions: ["bg"]
expect:
name: 'Разпети петък'
- given:
date: '2015-03-29'
regions: ["bg"]
expect:
name: 'Велика събота'
- given:
date: '2015-03-30'
regions: ["bg"]
expect:
name: 'Възкресение Христово. Великден'
- given:
date: '2015-03-31'
regions: ["bg"]
expect:
name: 'Възкресение Христово. Великден'
- given:
date: '2015-05-01'
regions: ["bg"]
expect:
name: 'Ден на труда'
- given:
date: '2015-05-06'
regions: ["bg"]
expect:
name: "Гергьовден. Ден на храбростта"
- given:
date: '2015-05-24'
regions: ["bg"]
expect:
name: 'Ден на славянската писменост'
- given:
date: '2015-09-06'
regions: ["bg"]
expect:
name: 'Ден на Съединението'
- given:
date: '2015-09-22'
regions: ["bg"]
expect:
name: 'Ден на Независимостта'
- given:
date: '2015-11-01'
regions: ["bg"]
expect:
name: "Ден на Народните будители"
- given:
date: '2015-12-24'
regions: ["bg"]
expect:
name: 'Бъдни вечер'
- given:
date: '2015-12-25'
regions: ["bg"]
expect:
name: 'Рождество Христово. Коледа'
- given:
date: '2015-12-26'
regions: ["bg"]
expect:
name: 'Рождество Христово. Коледа'
57 changes: 57 additions & 0 deletions priv/gettext/bg.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Generated by `mix holidefs.gettext.extract`
# for the locale BG - Bulgaria
msgid ""
msgstr ""


msgid "Разпети петък"
msgstr ""


msgid "Велика събота"
msgstr ""


msgid "Възкресение Христово. Великден"
msgstr ""


msgid "Нова година"
msgstr ""


msgid "Освобожението на България"
msgstr ""


msgid "Ден на труда"
msgstr ""


msgid "Гергьовден. Ден на храбростта"
msgstr ""


msgid "Ден на славянската писменост"
msgstr ""


msgid "Ден на Съединението"
msgstr ""


msgid "Ден на Независимостта"
msgstr ""


msgid "Ден на Народните будители"
msgstr ""


msgid "Бъдни вечер"
msgstr ""


msgid "Рождество Христово. Коледа"
msgstr ""

50 changes: 50 additions & 0 deletions priv/gettext/en/LC_MESSAGES/bg.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
## `msgid`s in this file come from POT (.pot) files.
##
## Do not add, change, or remove `msgid`s manually here as
## they're tied to the ones in the corresponding POT file
## (with the same domain).
##
## Use `mix gettext.extract --merge` or `mix gettext.merge`
## to merge POT files into PO files.
msgid ""
msgstr ""
"Language: en\n"

msgid "Разпети петък"
msgstr "Good Friday"

msgid "Велика събота"
msgstr "Holy Saturday"

msgid "Възкресение Христово. Великден"
msgstr "Easter"

msgid "Нова година"
msgstr "New Year's Day"

msgid "Освобожението на България"
msgstr "Liberation Day"

msgid "Ден на труда"
msgstr "Labour Day"

msgid "Гергьовден. Ден на храбростта"
msgstr "St. George's Day"

msgid "Ден на славянската писменост"
msgstr "Slavic Literacy Day"

msgid "Ден на Съединението"
msgstr "Unification Day"

msgid "Ден на Независимостта"
msgstr "The Independence Day"

msgid "Ден на Народните будители"
msgstr "Revival Leader's Day"

msgid "Бъдни вечер"
msgstr "Christmas Eve"

msgid "Рождество Христово. Коледа"
msgstr "Christmas"
1 change: 1 addition & 0 deletions test/holidefs_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ defmodule HolidefsTest do
at: "Austria",
au: "Australia",
be: "Belgium",
bg: "Bulgaria",
br: "Brazil",
hr: "Croatia",
us: "United States",
Expand Down

0 comments on commit 7088de9

Please sign in to comment.