Skip to content

Commit bac92bc

Browse files
committed
Make Tanakh Yomi translations work correctly
1 parent 059379c commit bac92bc

9 files changed

+543
-68
lines changed

README.md

+107-22
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Supports several learning schedules
88
* Daf Yomi (Babylonian Talmud / Bavli) - `dafYomi`
99
* Mishna Yomi - `mishnaYomi`
1010
* Nach Yomi - `nachYomi`
11+
* Tanakh Yomi - `tanakhYomi`
1112
* Psalms / Tehillim (30 day cycle) - `psalms`
1213
* Yerushalmi Yomi (Jerusalem Talmud)
1314
* Vilna edition - `yerushalmi-vilna`
@@ -35,19 +36,18 @@ const hd = new HDate(dt);
3536
const ev = DailyLearning.lookup('dafYomi', hd);
3637
console.log(dt.toLocaleDateString(), hd.toString(), ev.render('en'));
3738
```
38-
3939
## Classes
4040

4141
<dl>
4242
<dt><a href="#DafPage">DafPage</a></dt>
4343
<dd><p>Represents a tractate and page number</p>
4444
</dd>
45-
<dt><a href="#DafYomi">DafYomi</a></dt>
46-
<dd><p>Returns the Daf Yomi for given date</p>
47-
</dd>
4845
<dt><a href="#DafPageEvent">DafPageEvent</a></dt>
4946
<dd><p>Event wrapper around a DafPage instance</p>
5047
</dd>
48+
<dt><a href="#DafYomi">DafYomi</a></dt>
49+
<dd><p>Returns the Daf Yomi for given date</p>
50+
</dd>
5151
<dt><a href="#DafYomiEvent">DafYomiEvent</a></dt>
5252
<dd><p>Event wrapper around a DafYomi instance</p>
5353
</dd>
@@ -83,6 +83,12 @@ and Ketuvim (Writings).</p>
8383
<dt><a href="#DafWeeklyEvent">DafWeeklyEvent</a></dt>
8484
<dd><p>Event wrapper around a daily weekly</p>
8585
</dd>
86+
<dt><a href="#TanakhYomi">TanakhYomi</a></dt>
87+
<dd><p>Returns the Daf Yomi for given date</p>
88+
</dd>
89+
<dt><a href="#TanakhYomiEvent">TanakhYomiEvent</a></dt>
90+
<dd><p>Event wrapper around a tanakhYomi</p>
91+
</dd>
8692
</dl>
8793

8894
## Constants
@@ -127,6 +133,9 @@ cycle began (2 February 1980 for Vilna,
127133
<dt><a href="#dafWeekly">dafWeekly(date)</a> ⇒ <code><a href="#DafPage">DafPage</a></code></dt>
128134
<dd><p>Daf-a-Week</p>
129135
</dd>
136+
<dt><a href="#tanakhYomi">tanakhYomi(date)</a> ⇒ <code><a href="#TanakhYomi">TanakhYomi</a></code></dt>
137+
<dd><p>Calculates Tanakh Yomi.</p>
138+
</dd>
130139
</dl>
131140

132141
## Typedefs
@@ -183,22 +192,6 @@ Formats (with translation) the dafyomi result as a string like "Pesachim 34"
183192
| --- | --- | --- |
184193
| [locale] | <code>string</code> | Optional locale name (defaults to active locale). |
185194

186-
<a name="DafYomi"></a>
187-
188-
## DafYomi
189-
Returns the Daf Yomi for given date
190-
191-
**Kind**: global class
192-
<a name="new_DafYomi_new"></a>
193-
194-
### new DafYomi(date)
195-
Initializes a daf yomi instance
196-
197-
198-
| Param | Type | Description |
199-
| --- | --- | --- |
200-
| date | <code>Date</code> \| <code>HDate</code> \| <code>number</code> | Gregorian or Hebrew date |
201-
202195
<a name="DafPageEvent"></a>
203196

204197
## DafPageEvent
@@ -207,19 +200,20 @@ Event wrapper around a DafPage instance
207200
**Kind**: global class
208201

209202
* [DafPageEvent](#DafPageEvent)
210-
* [new DafPageEvent(date, daf)](#new_DafPageEvent_new)
203+
* [new DafPageEvent(date, daf, mask)](#new_DafPageEvent_new)
211204
* [.render([locale])](#DafPageEvent+render) ⇒ <code>string</code>
212205
* [.renderBrief([locale])](#DafPageEvent+renderBrief) ⇒ <code>string</code>
213206
* [.url()](#DafPageEvent+url) ⇒ <code>string</code>
214207

215208
<a name="new_DafPageEvent_new"></a>
216209

217-
### new DafPageEvent(date, daf)
210+
### new DafPageEvent(date, daf, mask)
218211

219212
| Param | Type |
220213
| --- | --- |
221214
| date | <code>HDate</code> |
222215
| daf | [<code>DafPage</code>](#DafPage) |
216+
| mask | <code>number</code> |
223217

224218
<a name="DafPageEvent+render"></a>
225219

@@ -249,6 +243,22 @@ Returns Daf Yomi name without the 'Daf Yomi: ' prefix (e.g. "Pesachim 107").
249243
Returns a link to sefaria.org or dafyomi.org
250244

251245
**Kind**: instance method of [<code>DafPageEvent</code>](#DafPageEvent)
246+
<a name="DafYomi"></a>
247+
248+
## DafYomi
249+
Returns the Daf Yomi for given date
250+
251+
**Kind**: global class
252+
<a name="new_DafYomi_new"></a>
253+
254+
### new DafYomi(date)
255+
Initializes a daf yomi instance
256+
257+
258+
| Param | Type | Description |
259+
| --- | --- | --- |
260+
| date | <code>Date</code> \| <code>HDate</code> \| <code>number</code> | Gregorian or Hebrew date |
261+
252262
<a name="DafYomiEvent"></a>
253263

254264
## DafYomiEvent
@@ -685,6 +695,70 @@ Event wrapper around a daily weekly
685695

686696
### dafWeeklyEvent.getCategories() ⇒ <code>Array.&lt;string&gt;</code>
687697
**Kind**: instance method of [<code>DafWeeklyEvent</code>](#DafWeeklyEvent)
698+
<a name="TanakhYomi"></a>
699+
700+
## TanakhYomi
701+
Returns the Daf Yomi for given date
702+
703+
**Kind**: global class
704+
705+
* [TanakhYomi](#TanakhYomi)
706+
* [new TanakhYomi(name, blatt)](#new_TanakhYomi_new)
707+
* [.render([locale])](#TanakhYomi+render) ⇒ <code>string</code>
708+
709+
<a name="new_TanakhYomi_new"></a>
710+
711+
### new TanakhYomi(name, blatt)
712+
Initializes a daf yomi instance
713+
714+
715+
| Param | Type |
716+
| --- | --- |
717+
| name | <code>string</code> |
718+
| blatt | <code>number</code> |
719+
720+
<a name="TanakhYomi+render"></a>
721+
722+
### tanakhYomi.render([locale]) ⇒ <code>string</code>
723+
Formats (with translation) the dafyomi result as a string like "Pesachim 34"
724+
725+
**Kind**: instance method of [<code>TanakhYomi</code>](#TanakhYomi)
726+
727+
| Param | Type | Description |
728+
| --- | --- | --- |
729+
| [locale] | <code>string</code> | Optional locale name (defaults to active locale). |
730+
731+
<a name="TanakhYomiEvent"></a>
732+
733+
## TanakhYomiEvent
734+
Event wrapper around a tanakhYomi
735+
736+
**Kind**: global class
737+
738+
* [TanakhYomiEvent](#TanakhYomiEvent)
739+
* [new TanakhYomiEvent(date, daf)](#new_TanakhYomiEvent_new)
740+
* [.url()](#TanakhYomiEvent+url) ⇒ <code>string</code>
741+
* [.getCategories()](#TanakhYomiEvent+getCategories) ⇒ <code>Array.&lt;string&gt;</code>
742+
743+
<a name="new_TanakhYomiEvent_new"></a>
744+
745+
### new TanakhYomiEvent(date, daf)
746+
747+
| Param | Type |
748+
| --- | --- |
749+
| date | <code>HDate</code> |
750+
| daf | [<code>TanakhYomi</code>](#TanakhYomi) |
751+
752+
<a name="TanakhYomiEvent+url"></a>
753+
754+
### tanakhYomiEvent.url() ⇒ <code>string</code>
755+
Returns a link to sefaria.org or dafyomi.org
756+
757+
**Kind**: instance method of [<code>TanakhYomiEvent</code>](#TanakhYomiEvent)
758+
<a name="TanakhYomiEvent+getCategories"></a>
759+
760+
### tanakhYomiEvent.getCategories() ⇒ <code>Array.&lt;string&gt;</code>
761+
**Kind**: instance method of [<code>TanakhYomiEvent</code>](#TanakhYomiEvent)
688762
<a name="vilna"></a>
689763

690764
## vilna
@@ -778,6 +852,17 @@ Daf-a-Week
778852
| --- | --- | --- |
779853
| date | <code>HDate</code> \| <code>Date</code> \| <code>number</code> | Hebrew or Gregorian date |
780854

855+
<a name="tanakhYomi"></a>
856+
857+
## tanakhYomi(date) ⇒ [<code>TanakhYomi</code>](#TanakhYomi)
858+
Calculates Tanakh Yomi.
859+
860+
**Kind**: global function
861+
862+
| Param | Type | Description |
863+
| --- | --- | --- |
864+
| date | <code>HDate</code> \| <code>Date</code> \| <code>number</code> | Hebrew or Gregorian date |
865+
781866
<a name="MishnaYomi"></a>
782867

783868
## MishnaYomi : <code>Object</code>

package-lock.json

+19-19
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hebcal/learning",
3-
"version": "5.0.4",
3+
"version": "5.0.5",
44
"description": "Daily learning schedules: Daf Yomi, Mishna Yomi, etc",
55
"main": "dist/index.cjs",
66
"module": "dist/index.mjs",
@@ -38,7 +38,7 @@
3838
"build": "npm run po2json && npm run build:json2js && npm run build:rollup",
3939
"prepublish": "npm run build",
4040
"pretest": "npm run build",
41-
"readme": "npx -p jsdoc-to-markdown jsdoc2md dist/index.js",
41+
"readme": "cp dist/index.mjs tmp.js && npx -p jsdoc-to-markdown jsdoc2md tmp.js",
4242
"test": "ava"
4343
},
4444
"devDependencies": {

po/he.po

+16
Original file line numberDiff line numberDiff line change
@@ -652,3 +652,19 @@ msgstr "שער התורה"
652652

653653
msgid "Chasimas Hasefer"
654654
msgstr "חתימת הספר"
655+
656+
# Tanakh Yomi
657+
msgid "Kings"
658+
msgstr "מְלָכִים"
659+
660+
msgid "Minor Prophets"
661+
msgstr "תרי עשר"
662+
663+
msgid "Ezra and Nehemiah"
664+
msgstr "עֶזְרָא וְנְחֶמְיָה"
665+
666+
msgid "Chronicles"
667+
msgstr "דִברֵי הַיָמִים"
668+
669+
msgid "Samuel"
670+
msgstr "שְׁמוּאֵל"

src/MishnaYomiEvent.spec.js

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
import test from 'ava';
22
import {MishnaYomiEvent} from './MishnaYomiEvent.js';
3-
import {HDate, Locale} from '@hebcal/core';
4-
import poAshkenazi from './ashkenazi.po.js';
5-
import poHe from './he.po.js';
6-
7-
Locale.addTranslations('ashkenazi', poAshkenazi);
8-
Locale.addTranslations('a', poAshkenazi);
9-
Locale.addTranslations('he', poHe);
10-
Locale.addTranslations('h', poHe);
3+
import {HDate} from '@hebcal/core';
4+
import './locale.js';
115

126
test('MishnaYomiEvent-url', (t) => {
137
const my = [{k: 'Berakhot', v: '3:6'}, {k: 'Berakhot', v: '4:1'}];

src/locale.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import {Locale} from '@hebcal/core';
2+
import poHe from './he.po.js';
3+
import poAshkenazi from './ashkenazi.po.js';
4+
5+
Locale.addTranslations('he', poHe);
6+
Locale.addTranslations('h', poHe);
7+
Locale.addTranslations('ashkenazi', poAshkenazi);
8+
Locale.addTranslations('a', poAshkenazi);
9+
10+
const heStrs = poHe.contexts[''];
11+
const heNoNikud = {};
12+
for (const [key, val] of Object.entries(heStrs)) {
13+
heNoNikud[key] = [Locale.hebrewStripNikkud(val[0])];
14+
}
15+
const poHeNoNikud = {
16+
headers: poHe.headers,
17+
contexts: {'': heNoNikud},
18+
};
19+
Locale.addTranslations('he-x-NoNikud', poHeNoNikud);

0 commit comments

Comments
 (0)