LIMITED TIME OFFER! I’m ready for my next adventure as a DevRel advocate / Technical Evangelist / IT Talespinner. If that sounds like something you need, drop me a line in email or on LinkedIn |
---|
In my last post on PHP Zmanim, I said the next thing I’d write about were astronomy calculations. I still plan to do that, but something came up recently that caught my attention, so I’m going to talk about that instead. I still plan to get to the astronomy stuff.
Sephardi vs Ashkenazi
No, not kitniyot. No, not how to hang your mezuzzah. No, not whether you have to use water challah or if egg challah is ok. I’m talking about the “T” sound in certain words.
Consider:
Bereshis | Bereshit |
---|---|
Ki Seitzei | Ki Teitzei |
Teves | Tevet |
There are more, but (if you read/speak Hebrew, or have been part of orthodox Jewish communities for any length of time) you get the point. These two traditions have different ways of pronouncing certain sounds, and therefore the English transliteration changes. And like any tradition, those who adhere to one or the other can be passionate about insisting on the “correct” usage.
PHP Zmanim, on it’s own, is “coded” using Ashkenazi style transliterations. But that doesn’t mean you can’t change that, and do so fairly easily. In the next few sections I’m going to show you how to take the pre-existing transliterations for dates, holidays, and Torah Portion titles and convert them so that they appear in whatever way YOU want.
Step 1: Create Your Map
For month names, Torah portion titles, holidays, and more, PHP Zmanim has a map of values. Let’s start with the easiest one – Months.
This is just a simple array of values:
transliteratedMonths = ["Nissan", "Iyar", "Sivan", "Tammuz", "Av", "Elul", "Tishrei", "Cheshvan","Kislev", "Teves", "Shevat", "Adar", "Adar II", "Adar I"];
In order to “fix” this and use the transliteration you want (in this case, it’s probably only “Teves” that has to change), you’d first re-create the array:
$transliteratedMonths = ["Nissan", "Iyar", "Sivan", "Tammuz", "Av", "Elul", "Tishrei", "Cheshvan","Kislev", "Tevet", "Shevat", "Adar", "Adar II", "Adar I"];
Step 2: Set Up Your Calendar
For holidays, you’ll use that the jewishCalendar object (which we covered in the previous blog post).
First we set the year, month, and day variables and create a Jewish calendar object:
$year = 2025;
$month = 1;
$day = 10;
$jewishCalendar = Zmanim::jewishCalendar(Carbon::createFromDate($theyear, $themonth, $theday));
Put it All together
Next we initialize the PHP ZManim format and then push the new transliterated months into PHP Zmanim:
$format = Zmanim::format();
$format->setTransliteratedMonthList($transliteratedMonths);
Finally, we take that output that format to a variable:
$zmandate = json_decode('"' . $format->format($jewishCalendar) . '"');
return $zmandate;
The result would be
10 Tevet 5785
And yes, if you are wondering, in 2025, the day numbers (1, 2, 3, etc) in the month of Tevet and the month of January match up.
Happy Holidays!
Holiday transliterations are handled similarly, even if there are a few minor differences.
Start off with the same initial setup of the date and calendar object:
$year = 2025;
$month = 1;
$day = 10;
$jewishCalendar = Zmanim::jewishCalendar(Carbon::createFromDate($theyear, $themonth, $theday));
Next, we’ll set the holiday transliterations the same way we did for months::
$transliteratedHolidays = ["Erev Pesach", "Pesach", "Chol Hamoed Pesach", "Pesach Sheni", "Erev Shavuot", "Shavuot", "Shiva Asar B'Tammuz", "Tisha B'Av", "Tu B'Av", "Erev Rosh Hashana", "Rosh Hashana", "Tzom Gedalyah", "Erev Yom Kippur", "Yom Kippur", "Erev Succot", "Succot", "Chol Hamoed Succot", "Hoshana Rabba", "Shemini Atzeret", "Simchat Torah", "Erev Chanukah", "Chanukah", "Tenth of Tevet", "Tu Bishvat", "Taanit Esther", "Purim", "Shushan Purim", "Purim Katan", "Rosh Chodesh", "Yom HaShoah", "Yom Hazikaron", "Yom Ha'atzmaut", "Yom Yerushalayim", "Lag B'Omer","Shushan Purim Katan", "Isru Chag"];
Next we initialize the PHP ZManim format and then push the new transliterated months into PHP Zmanim:
$format = Zmanim::format();
$format-$format->setTransliteratedHolidayList($transliteratedHolidays);
Finally, we use the calendar information and (if it’s a holiday) get the output:
$zmanholiday = $format->formatYomTov($jewishCalendar);
Echoing $zmanholiday
would look like this:
Tenth of Tevet
NOTE: For those who aren’t familiar, “The Tenth of Tevet” (or “Asarah B’Tevet”) is fast day, and has it’s own special set of observances.
What’s in a Name?
Our last example deals with the transliteration of Torah portion names – whether one renders the first portion in Torah “Bereshis” or “Beresheet”. For this, PHP Zmanim uses an array of key-value pairs, where all you need to do is change the value, and leave the key alone. Here’s what it looks like unchanged:
$this->transliteratedParshaMap = [
Parsha::NONE => "",
Parsha::BERESHIS => "Bereshis",
Parsha::NOACH => "Noach",
Parsha::LECH_LECHA => "Lech Lecha",
Parsha::VAYERA => "Vayera",
Parsha::CHAYEI_SARA => "Chayei Sara",
Parsha::TOLDOS => "Toldos",
(and so on. I'm not printing the full list here)
(And here’s the edits I’m making for my (Sephardic) synagogue:
$transliteratedParshaMap = [
Parsha::NONE => "",
Parsha::BERESHIS => "Beresheet",
Parsha::NOACH => "Noach",
Parsha::LECH_LECHA => "Lech Lecha",
Parsha::VAYERA => "Vayera",
Parsha::CHAYEI_SARA => "Chayei Sara",
Parsha::TOLDOS => "Toldot",
(etc)
Using this within your code follows the same pattern we’ve established with dates and holidays.
Before we start coding, it’s important to note that you have to ensure the “Parsha” class is being used by your code:
use PhpZmanim\HebrewCalendar\Parsha;
It’s also important for you to know that PHP Zmanim will only output a Torah Portion if the date given is a Saturday, so you might need to take any given date and find the upcoming (or previous) Saturday in order to get the right result.
Once those items are handled, you start by establishing the calendar object as with our other examples:
$getyear = 2024;
$getday = 26;
$getmonth = 10;
$jewishCalendar = Zmanim::jewishCalendar(Carbon::createFromDate($theyear, $themonth, $theday));
Create the new transliteration variable (note that this is only partially rendered. You can find the full key-value array at (as of the time of this writing) line 169 in the PHP Zmanim github repo)
$transliteratedParshaMap = [
Parsha::NONE => "",
Parsha::BERESHIS => "Beresheet",
Parsha::NOACH => "Noach",
Parsha::LECH_LECHA => "Lech Lecha",
Parsha::VAYERA => "Vayera",
Parsha::CHAYEI_SARA => "Chayei Sara",
Parsha::TOLDOS => "Toldot",
(etc)
Next we initialize the format and then push the new transliterated array:
$format = Zmanim::format();
$format->setTransliteratedParshiosList($transliteratedParshaMap);
Finally, we use the calendar information to grab the correct Torah potion transliterated the way we want it:
$output = json_decode('"' . $format->formatParsha($jewishCalendar) . '"');
Echo-ing the output would give us:
Beresheet
What More is There to Say?
For some, this all might seem like an un-necessary amount of work for a few spelling differences. For folks who haven’t spent a lot of time in groups where different Jewish cultures mix, it can be jarring to find out just how passionate people feel about these things.
Now, remind me again about the “proper” way to pronounce GIF?