summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/polyglossia/gloss-hebrew.ldf
blob: 2c69288d6358338006e5f19419025536cd85ada9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
\ProvidesFile{gloss-hebrew.ldf}[polyglossia: module for hebrew]

\RequireBidi
\RequirePackage{hebrewcal}

\PolyglossiaSetup{hebrew}{
  bcp47=he,
  script=Hebrew,
  direction=RL,
  scripttag=hebr,
  langtag=IWR,
  hyphennames={nohyphenation},
  fontsetup=true,
  localnumeral=hebrewnumerals
  %TODO localalph={hebrewnumeral,Hebrewnumeral}
  %digits = hebrewnumber
}

% BCP-47 compliant aliases
\setlanguagealias*{hebrew}{he}

\newif\if@calendar@hebrew
\def\tmp@hebrew{hebrew}
\define@key{hebrew}{calendar}[gregorian]{%
	\message{Setting \string\if@calendar@hebrew}
	\def\@tmpa{#1}%
	\ifx\@tmpa\tmp@hebrew%
    \@calendar@hebrewtrue%
	\else%
    \@calendar@hebrewfalse%
	\fi}

\newif\if@xpg@hebrew@marcheshvan
\@xpg@hebrew@marcheshvanfalse

\define@boolkey{hebrew}[@xpg@hebrew@]{marcheshvan}[true]{}

% hebrewcal.sty also defines the boolean key fullyear (default=false)

\newif\if@hebrew@numerals
\def\tmp@hebrew{hebrew}
\define@key{hebrew}{numerals}[arabic]{%
	\def\@tmpa{#1}%
	\ifx\@tmpa\tmp@hebrew%
	  \@hebrew@numeralstrue%
	\else%
    \@hebrew@numeralsfalse%
	\fi}

\setkeys{hebrew}{numerals}

% Register default options
\xpg@initialize@gloss@options{hebrew}{numerals=arabic,calendar=gregorian,marcheshvan=false}

\def\captionshebrew{%
  \def\prefacename{מבוא}%
  \def\refname{מקורות}%
  \def\abstractname{תקציר}%
  \def\bibname{ביבליוגרפיה}%
  \def\chaptername{פרק}%
  \def\appendixname{נספח}%
  \def\contentsname{תוכן העניינים}%
  \def\listfigurename{רשימת האיורים}%
  \def\listtablename{רשימת הטבלאות}%
  \def\indexname{מפתח}%
  \def\figurename{איור}%
  \def\tablename{טבלה}%
  \def\partname{חלק}%
  \def\enclname{רצ"ב}%
  \def\ccname{העתקים}%
  \def\headtoname{אל}%
  \def\pagename{עמוד}%
  \def\psname{נ.ב.}%
  \def\seename{ראה}%
  \def\alsoname{ראה גם}% check
  \def\proofname{הוכחה}
  \def\glossaryname{מילון מונחים}% check
}
\def\datehebrew{%
  \def\today{%
    \if@calendar@hebrew%
      \hebrewtoday%
    \else%
      \hebrewnumber\day%
      \space ב\hebrewgregmonth{\month}\space%
      \hebrewnumber\year%
     \fi}%
}

\def\hebrewgregmonth#1{\ifcase#1%
  \or ינואר% יאנואר
    \or פברואר\or מרץ% מרס / מארס
    \or אפריל\or מאי% מי
    \or יוני\or יולי\or אוגוסט %אבגוסט
    \or ספטמבר\or אוקטובר\or נובמבר\or דצמבר\fi}

\input{babel-hebrewalph.def}

\newcommand{\hebrewnumerals}[2]{\hebrewnumber{#2}}

\def\hebrewnumber#1{%
   \if@hebrew@numerals
     \hebrewnumeral{#1}%
   \else
     \number#1%
   \fi
}

\ifxetex
  \let\xpg@orig@DigitsDotDashInterCharToks\DigitsDotDashInterCharToks%
\fi

\def\hebrew@ltr@numbers{%
    \ifxetex
       % Bidi inserts an RTL mark (0x200f) between number and number separator (- .),
       % forcing numbers to RTL. This is wrong for Hebrew.
       % So we defunc the respective command.
       \renewcommand*{\DigitsDotDashInterCharToks}{}
    \fi%
}

\def\nohebrew@ltr@numbers{%
    \ifxetex
      % Restore bidi's \DigitsDotDashInterCharToks
      \let\DigitsDotDashInterCharToks\xpg@orig@DigitsDotDashInterCharToks%
    \fi%
}

\def\hebrew@numbers{%
   \let\@alph\hebrewnumeral%
   \let\@Alph\Hebrewnumeral%
   % Prevent bidi from setting the numbers RTL
   \hebrew@ltr@numbers%
}

\def\nohebrew@numbers{%
  \let\@alph\latin@alph%
  \let\@Alph\latin@Alph%
  % Restore previous bidi numbers definition
  \nohebrew@ltr@numbers
}

\def\hebrew@globalnumbers{%
   \let\@arabic\hebrewnumber%
   \renewcommand\thefootnote{\localnumeral*{footnote}}%
   % Prevent bidi from setting the numbers RTL
   \hebrew@ltr@numbers%
}

% Store original definition
\let\xpg@save@arabic\@arabic

\def\nohebrew@globalnumbers{%
  \let\@arabic\xpg@save@arabic%
}

% Save original \MakeUppercase definition
\let\xpg@save@MakeUppercase\MakeUppercase

\def\blockextras@hebrew{%
   \def\MakeUppercase##1{##1}%
}

\def\noextras@hebrew{%
   % restore original \MakeUppercase definition
   \let\MakeUppercase\xpg@save@MakeUppercase%
}

\endinput