Debian Codegraph @

texmf-dist/tex/latex/polyglossia/gloss-hebrew.ldf

raw
1 % Language definition file (part of polyglossia v2.10 -- 2026/04/18)
2 %
3 \ProvidesFile{gloss-hebrew.ldf}[polyglossia: module for Hebrew]
4
5 \RequireBidi
6 \RequirePackage{hebrewcal}
7
8 \PolyglossiaSetup{hebrew}{
9 bcp47=he,
10 bcp47-language=hr,
11 bcp47-region=HE,
12 bcp47-script=Hebr,
13 script=Hebrew,
14 direction=RL,
15 scripttag=hebr,
16 langtag=IWR,
17 hyphennames={nohyphenation},
18 localnumeral=hebrewnumerals,
19 Localnumeral=hebrewnumerals
20 %TODO localalph={hebrewnumeral,Hebrewnumeral}
21 %digits = hebrewnumber
22 }
23
24 % BCP-47 compliant aliases
25 \setlanguagealias*{hebrew}{he}
26
27 \newif\if@calendar@hebrew
28 \newif\if@hebrew@numerals
29
30 \DeclareKeys[polyglossia/gloss/hebrew]
31 {
32 marcheshvan.meta:nn = {hebrewcal}{marcheshvan=#1},
33 marcheshvan.default:n = true,
34 transliteration.meta:nn = {hebrewcal}{transliteration=#1},
35 transliteration.default:n = alt,
36 fullyear.meta:nn = {hebrewcal}{fullyear=#1},
37 fullyear.default:n = true,
38 calendar.choice:,
39 calendar / hebrew.code =
40 {%
41 \@calendar@hebrewtrue
42 },
43 calendar / gregorian.code =
44 {%
45 \@calendar@hebrewfalse
46 },
47 calendar.default:n = gregorian,
48 calendar/unknown.code = \xpg@warning{Unknown Hebrew calendar `#1'},
49 numerals.choice:,
50 numerals / hebrew.code =
51 {%
52 \@hebrew@numeralstrue
53 \SetLanguageKeys{hebrew}{bcp47-extension-u=nu-hebr}%
54 },
55 numerals / arabic.code =
56 {%
57 \@hebrew@numeralsfalse
58 \SetLanguageKeys{hebrew}{bcp47-extension-u=nu-latn}%
59 },
60 numerals.default:n = arabic,
61 numerals/unknown.code = \xpg@warning{Unknown Hebrew numerals value `#1'}
62 }
63
64 % Register default options
65 \InitializeGlossOptions{hebrew}{numerals=arabic,calendar=gregorian,marcheshvan=false,fullyear=false}
66
67 \def\captionshebrew{%
68 \def\prefacename{מבוא}%
69 \def\refname{מקורות}%
70 \def\abstractname{תקציר}%
71 \def\bibname{ביבליוגרפיה}%
72 \def\chaptername{פרק}%
73 \def\appendixname{נספח}%
74 \def\contentsname{תוכן העניינים}%
75 \def\listfigurename{רשימת האיורים}%
76 \def\listtablename{רשימת הטבלאות}%
77 \def\indexname{מפתח}%
78 \def\figurename{איור}%
79 \def\tablename{טבלה}%
80 \def\partname{חלק}%
81 \def\enclname{רצ"ב}%
82 \def\ccname{העתקים}%
83 \def\headtoname{אל}%
84 \def\pagename{עמוד}%
85 \def\psname{נ.ב.}%
86 \def\seename{ראה}%
87 \def\alsoname{ראה גם}% check
88 \def\proofname{הוכחה}%
89 \def\glossaryname{מילון מונחים}% check
90 }
91 \def\datehebrew{%
92 \def\today{%
93 \if@calendar@hebrew
94 \hebrewtoday
95 \else
96 \hebrewnumber\day
97 \space ב\hebrewgregmonth{\month}\space
98 \hebrewnumber\year
99 \fi
100 }%
101 }
102
103 \def\hebrewgregmonth#1{\ifcase#1%
104 \or ינואר% יאנואר
105 \or פברואר\or מרץ% מרס / מארס
106 \or אפריל\or מאי% מי
107 \or יוני\or יולי\or אוגוסט %אבגוסט
108 \or ספטמבר\or אוקטובר\or נובמבר\or דצמבר\fi}
109
110 \input{babel-hebrewalph.def}
111
112 \newcommand{\hebrewnumerals}[2]{\hebrewnumber{#2}}
113
114 \def\hebrewnumber#1{%
115 \if@hebrew@numerals
116 \hebrewnumeral{#1}%
117 \else
118 \number#1%
119 \fi
120 }
121
122 \ifxetex
123 % Bidi inserts an RTL mark (0x200f) between number and number separator (- .),
124 % forcing numbers to RTL. This is wrong for Hebrew.
125 % So we defunc the respective command with XeTeX.
126 \let\xpg@orig@DigitsDotDashInterCharToks\DigitsDotDashInterCharToks
127
128 \def\hebrew@ltr@numbers{%
129 \def\DigitsDotDashInterCharToks{}%
130 }
131
132 \def\nohebrew@ltr@numbers{%
133 % Restore bidi's \DigitsDotDashInterCharToks
134 \let\DigitsDotDashInterCharToks\xpg@orig@DigitsDotDashInterCharToks
135 }
136 \else
137 % Only dummy commands (nothing to do here) for LuaTeX
138 \def\hebrew@ltr@numbers{}
139 \def\nohebrew@ltr@numbers{}
140 \fi
141
142 \def\hebrew@numbers{%
143 \let\@alph\hebrewnumeral
144 \let\@Alph\Hebrewnumeral
145 % Prevent bidi from setting the numbers RTL
146 \hebrew@ltr@numbers
147 }
148
149 \def\nohebrew@numbers{%
150 \let\@alph\latin@alph
151 \let\@Alph\latin@Alph
152 % Restore previous bidi numbers definition
153 \nohebrew@ltr@numbers
154 }
155
156 \def\hebrew@globalnumbers{%
157 \let\@arabic\hebrewnumber
158 \renewcommand\thefootnote{\localnumeral*{footnote}}%
159 % Prevent bidi from setting the numbers RTL
160 \hebrew@ltr@numbers
161 }
162
163 % Store original definition
164 \let\xpg@save@arabic\@arabic
165
166 \def\nohebrew@globalnumbers{%
167 \let\@arabic\xpg@save@arabic
168 }
169
170 \endinput