Skip to content

Conversation

@rafiw
Copy link
Contributor

@rafiw rafiw commented Jan 10, 2026

Add comprehensive Hebrew translation support including book names, verse numbers using Hebrew letters, and reading summaries.

New Features:

  • Hebrew translations for all Torah, Nevi'im, and Ketuvim book names
  • Hebrew numerals (gematria) for chapter and verse references
  • Hebrew translations for holiday and special reading names
  • Language parameter added to core API functions
  • Special handling for numbers 15 and 16 to avoid spelling God's name

Core Changes:

  • Add numberToHebrew() function for converting numbers to Hebrew numerals
  • Add formatVerseToHebrew() to format verse references
  • Add translateAliyah() and translateAliyahOrArray() helper functions
  • Add translateLeyning() to translate complete Leyning objects
  • Extend getLeyningForParsha() to accept language parameter
  • Extend getLeyningForHoliday() to accept language parameter
  • Extend getLeyningOnDate() to accept language parameter

Data:

  • Add po/he.po with 160+ Hebrew translations
  • Add HEBREW_NUMERALS mapping for gematria conversion

Tests:

  • Add 147 new test cases for Hebrew translations
  • Test formatVerseToHebrew() with edge cases and special numbers
  • Test formatAliyahShort() in both English and Hebrew
  • Test Hebrew translations for parshiot, holidays, and haftarot

API Changes (backward compatible):

  • All translation functions default to English ('en')
  • Existing code continues to work without modifications
  • New optional language parameter on public functions

Example usage:
const reading = getLeyningForParsha('Pinchas', 'he'); // reading.summary = 'בְּמִדְבַּר כה:י-ל:א' // reading.fullkriyah['1'].k = 'בְּמִדְבַּר' // reading.haftara = 'מְלָכִים א יח:מו-יט:כא'

rafiw added 2 commits January 10, 2026 23:50
Add comprehensive Hebrew translation support including book names,
verse numbers using Hebrew letters, and reading summaries.

New Features:
- Hebrew translations for all Torah, Nevi'im, and Ketuvim book names
- Hebrew numerals (gematria) for chapter and verse references
- Hebrew translations for holiday and special reading names
- Language parameter added to core API functions
- Special handling for numbers 15 and 16 to avoid spelling God's name

Core Changes:
- Add numberToHebrew() function for converting numbers to Hebrew numerals
- Add formatVerseToHebrew() to format verse references
- Add translateAliyah() and translateAliyahOrArray() helper functions
- Add translateLeyning() to translate complete Leyning objects
- Extend getLeyningForParsha() to accept language parameter
- Extend getLeyningForHoliday() to accept language parameter
- Extend getLeyningOnDate() to accept language parameter

Data:
- Add po/he.po with 160+ Hebrew translations
- Add HEBREW_NUMERALS mapping for gematria conversion

Tests:
- Add 147 new test cases for Hebrew translations
- Test formatVerseToHebrew() with edge cases and special numbers
- Test formatAliyahShort() in both English and Hebrew
- Test Hebrew translations for parshiot, holidays, and haftarot

API Changes (backward compatible):
- All translation functions default to English ('en')
- Existing code continues to work without modifications
- New optional language parameter on public functions

Example usage:
  const reading = getLeyningForParsha('Pinchas', 'he');
  // reading.summary = 'בְּמִדְבַּר כה:י-ל:א'
  // reading.fullkriyah['1'].k = 'בְּמִדְבַּר'
  // reading.haftara = 'מְלָכִים א יח:מו-יט:כא'
@rafiw
Copy link
Contributor Author

rafiw commented Jan 11, 2026

@mjradwin tell me if I need to change things. I tried to make so new languages will be easy to add.

@mjradwin
Copy link
Member

Thank you. I am starting to review. At a minimum we would want to reuse the gematriya function already implemented instead of adding numberToHebrew

https://hebcal.github.io/api/hdate/functions/gematriya.html

You would have to replace the geresh or gershayim characters but this is easy to do

@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
24.4% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants