| 1 |
% Language definition file (part of polyglossia v2.10 -- 2026/04/18) |
| 2 |
% |
| 3 |
\ProvidesFile{gloss-arabic.ldf}[polyglossia: module for Arabic] |
| 4 |
\RequireBidi |
| 5 |
\RequirePackage{arabicnumbers} |
| 6 |
\RequirePackage{hijrical} |
| 7 |
|
| 8 |
\PolyglossiaSetup{arabic}{ |
| 9 |
bcp47=ar, |
| 10 |
bcp47-language=ar, |
| 11 |
bcp47-script=Arab, |
| 12 |
bcp47-region=YE, |
| 13 |
script=Arabic, |
| 14 |
direction=RL, |
| 15 |
langtag=ARA, |
| 16 |
scripttag=arab, |
| 17 |
hyphennames={nohyphenation}, |
| 18 |
envname=Arabic, |
| 19 |
localnumeral=arabicnumerals, |
| 20 |
Localnumeral=arabicnumerals |
| 21 |
%TODO localalph={abjad,abjad} |
| 22 |
} |
| 23 |
|
| 24 |
% BCP-47 compliant aliases |
| 25 |
\setlanguagealias*{arabic}{ar} |
| 26 |
\setlanguagealias*[locale=mashriq]{arabic}{ar-IQ} |
| 27 |
\setlanguagealias*[locale=default]{arabic}{ar-YE} |
| 28 |
\setlanguagealias*[locale=mashriq]{arabic}{ar-LB} |
| 29 |
\setlanguagealias*[locale=mashriq]{arabic}{ar-JO} |
| 30 |
\setlanguagealias*[locale=default]{arabic}{afb} |
| 31 |
\setlanguagealias*[locale=mauritania]{arabic}{ar-MR} |
| 32 |
\setlanguagealias*[locale=default]{arabic}{arz} |
| 33 |
\setlanguagealias*[locale=morocco]{arabic}{ary} |
| 34 |
\setlanguagealias*[locale=algeria]{arabic}{arq} |
| 35 |
\setlanguagealias*[locale=tunisia]{arabic}{aeb} |
| 36 |
\setlanguagealias*[locale=mashriq]{arabic}{ar-SY} |
| 37 |
\setlanguagealias*[locale=libya]{arabic}{ayl} |
| 38 |
\setlanguagealias*[locale=default]{arabic}{apd} |
| 39 |
\setlanguagealias*[locale=mashriq]{arabic}{ar-PS} |
| 40 |
|
| 41 |
\newif\ifeastern@numerals |
| 42 |
\newif\if@hijrical |
| 43 |
\newif\ifarabic@customsep\arabic@customsepfalse |
| 44 |
|
| 45 |
\DeclareKeys[polyglossia/gloss/arabic] |
| 46 |
{ |
| 47 |
hijricorrection.code = \gdef\arabic@hijri@correction{#1}, |
| 48 |
hijricorrection.default:n = 0, |
| 49 |
sectionsep.code = \gdef\xpg@sepmark{#1}\arabic@customseptrue, |
| 50 |
sectionsep.default:n = ., |
| 51 |
abjadalph.if = arabic@abjadalph, |
| 52 |
abjadalph.default:n = true, |
| 53 |
abjadjimnotail.if = abjad@jim@notail, |
| 54 |
abjadjimnotail.default:n = true, |
| 55 |
numerals.choice:, |
| 56 |
numerals / mashriq.code = |
| 57 |
{% |
| 58 |
\eastern@numeralstrue |
| 59 |
}, |
| 60 |
numerals / maghrib.code = |
| 61 |
{% |
| 62 |
\eastern@numeralsfalse |
| 63 |
}, |
| 64 |
numerals / eastern.code = |
| 65 |
{% |
| 66 |
\eastern@numeralstrue |
| 67 |
}, |
| 68 |
numerals / western.code = |
| 69 |
{% |
| 70 |
\eastern@numeralsfalse |
| 71 |
}, |
| 72 |
numerals.default:n = mashriq, |
| 73 |
numerals/unknown.code = \xpg@warning{Unknown Arabic numerals option `#1'}, |
| 74 |
locale.choice:, |
| 75 |
locale / default.code = |
| 76 |
{% |
| 77 |
\eastern@numeralstrue |
| 78 |
\def\abjad@one{ا}% |
| 79 |
\SetLanguageKeys{arabic}{bcp47=ar-YE,bcp47-language=ar}% |
| 80 |
\gdef\@@arabic@month{\@arabic@month{#1}}% |
| 81 |
}, |
| 82 |
locale / mashriq.code = |
| 83 |
{% |
| 84 |
\eastern@numeralstrue |
| 85 |
\def\abjad@one{ا}% |
| 86 |
\SetLanguageKeys{arabic}{bcp47=ar-IQ,bcp47-language=ar}% |
| 87 |
\gdef\@@arabic@month{\@arabic@month{#1}}% |
| 88 |
}, |
| 89 |
locale / libya.code = |
| 90 |
{% |
| 91 |
\eastern@numeralstrue |
| 92 |
\def\abjad@one{ا}% |
| 93 |
\SetLanguageKeys{arabic}{bcp47=ayl,bcp47-language=ar,bcp47-region=LY}% |
| 94 |
\gdef\@@arabic@month{\@arabic@month{#1}}% |
| 95 |
}, |
| 96 |
locale / algeria.code = |
| 97 |
{% |
| 98 |
\eastern@numeralsfalse |
| 99 |
\def\abjad@one{أ}% |
| 100 |
\SetLanguageKeys{arabic}{bcp47=arq,bcp47-language=ar,bcp47-region=DZ,bcp47-extension-u=nu-latn}% |
| 101 |
\gdef\@@arabic@month{\@arabic@month{#1}}% |
| 102 |
}, |
| 103 |
locale / tunisia.code = |
| 104 |
{% |
| 105 |
\eastern@numeralsfalse |
| 106 |
\def\abjad@one{أ}% |
| 107 |
\SetLanguageKeys{arabic}{bcp47=aeb,bcp47-language=ar,bcp47-region=TN,bcp47-extension-u=nu-latn}% |
| 108 |
\gdef\@@arabic@month{\@arabic@month{#1}}% |
| 109 |
}, |
| 110 |
locale / morocco.code = |
| 111 |
{% |
| 112 |
\eastern@numeralsfalse |
| 113 |
\def\abjad@one{أ}% |
| 114 |
\SetLanguageKeys{arabic}{bcp47=ary,bcp47-language=ar,bcp47-region=MA,bcp47-extension-u=nu-latn}% |
| 115 |
\gdef\@@arabic@month{\@arabic@month{#1}}% |
| 116 |
}, |
| 117 |
locale / mauritania.code = |
| 118 |
{% |
| 119 |
\eastern@numeralstrue |
| 120 |
\def\abjad@one{ا}% |
| 121 |
\SetLanguageKeys{arabic}{bcp47=ar-MR,bcp47-language=ar,bcp47-region=MR}% |
| 122 |
\gdef\@@arabic@month{\@arabic@month{#1}}% |
| 123 |
}, |
| 124 |
locale.default:n = default, |
| 125 |
locale/unknown.code = \xpg@warning{Unknown Arabic locale `#1'}, |
| 126 |
calendar.choice:, |
| 127 |
calendar / gregorian.code = |
| 128 |
{% |
| 129 |
\@hijricalfalse |
| 130 |
}, |
| 131 |
calendar / hijri.code = |
| 132 |
{% |
| 133 |
\@hijricaltrue |
| 134 |
}, |
| 135 |
calendar / islamic.code = |
| 136 |
{% |
| 137 |
\@hijricaltrue |
| 138 |
}, |
| 139 |
calendar.default:n = gregorian, |
| 140 |
calendar/unknown.code = \xpg@warning{Unknown Arabic calendar option `#1'} |
| 141 |
} |
| 142 |
|
| 143 |
% Register default options |
| 144 |
\InitializeGlossOptions{arabic}{locale=default,calendar=gregorian,numerals=mashriq,hijricorrection=0,abjadjimnotail=false} |
| 145 |
% Register alias options |
| 146 |
\SetLanguageAliasValues{arabic}{calendar}{islamic,hijri} |
| 147 |
|
| 148 |
\def\arabicgregmonth@default#1{\ifcase#1% |
| 149 |
% Egypt, Sudan, Yemen and Golf states |
| 150 |
\or يناير\or فبراير\or مارس\or أبريل\or مايو\or يونيو\or يوليو\or أغسطس\or سبتمبر\or أكتوبر\or نوفمبر\or ديسمبر\fi} |
| 151 |
\def\arabicgregmonth@mashriq#1{\ifcase#1% |
| 152 |
% Iraq Syria Jordan Lebanon Palestine |
| 153 |
\or كانون الثاني\or شباط\or آذار\or نيسان\or أيار\or حزيران\or تموز\or آب\or أيلول\or تشرين الأول\or تشرين الثاني\or كانون الأول\fi} |
| 154 |
\def\arabicgregmonth@libya#1{\ifcase#1% |
| 155 |
%Lybia «تعرف في ليبيا بأسماء عربية وضعها معمر القذافي ترمز إلى فصول السنة وبعض الشخصيات التاريخية» (ar.wikipedia.org) |
| 156 |
\or أي النار\or النوار\or الربيع\or الطير\or الماء\or الصيف\or ناصر\or هانيبال\or الفاتح\or التمور\or الحرث\or الكانون\fi} |
| 157 |
\def\arabicgregmonth@morocco#1{\ifcase#1% |
| 158 |
\or يناير\or فبراير\or مارس\or أبريل\or ماي\or يونيو\or يوليوز\or غشت\or شتنبر\or أكتوبر\or نونبر\or دجنبر\fi} |
| 159 |
\def\arabicgregmonth@algeria#1{\ifcase#1% |
| 160 |
% Tunisia and Algeria |
| 161 |
\or جانفي\or فيفري\or مارس\or أفريل\or ماي\or جوان\or جويلية\or أوت\or سبتمبر\or أكتوبر\or نوفمبر\or ديسمبر\fi} |
| 162 |
\let\arabicgregmonth@tunisia\arabicgregmonth@algeria |
| 163 |
\def\arabicgregmonth@mauritania#1{\ifcase#1% |
| 164 |
\or يناير\or فبراير\or مارس\or إبريل\or مايو\or يونيو\or يوليو\or أغشت\or شتمبر\or أكتوبر\or نوفمبر\or دجمبر\fi} |
| 165 |
|
| 166 |
\def\@arabic@month#1{% |
| 167 |
\@ifundefined{arabicgregmonth@#1}% |
| 168 |
{\xpg@warning{Option `locale=#1' is not defined for Arabic: using `default' instead}% |
| 169 |
\arabicgregmonth@default}% |
| 170 |
{\expandafter\csname arabicgregmonth@#1\endcsname}% |
| 171 |
} |
| 172 |
|
| 173 |
%\Hijritoday is now locale-aware and will format the date with this macro: |
| 174 |
\DefineFormatHijriDate{arabic}{\@ensure@RTL{\arabicnumber{\value{Hijriday}}% |
| 175 |
\space\HijriMonthArabic{\value{Hijrimonth}}\space\arabicnumber{\value{Hijriyear}}}} |
| 176 |
|
| 177 |
\def\captionsarabic{% |
| 178 |
\def\prefacename{\@ensure@RTL{مدخل}}% |
| 179 |
\def\refname{\@ensure@RTL{المراجع}}% |
| 180 |
\def\abstractname{\@ensure@RTL{ملخص}}% |
| 181 |
\def\bibname{\@ensure@RTL{المصادر}}% |
| 182 |
\def\chaptername{\@ensure@RTL{باب}}% |
| 183 |
\def\appendixname{\@ensure@RTL{الملاحق}}% |
| 184 |
\def\contentsname{\@ensure@RTL{المحتويات}}% |
| 185 |
%\def\contentsname{\@ensure@RTL{الفهرس}}% |
| 186 |
\def\listfigurename{\@ensure@RTL{قائمة الأشكال}}% |
| 187 |
\def\listtablename{\@ensure@RTL{قائمة الجداول}}% |
| 188 |
\def\indexname{\@ensure@RTL{الفهرس}}% |
| 189 |
\def\figurename{\@ensure@RTL{شكل}}% |
| 190 |
\def\tablename{\@ensure@RTL{جدول}}% |
| 191 |
\def\partname{\@ensure@RTL{القسم}}% |
| 192 |
\def\enclname{\@ensure@RTL{المرفقات}}%<-- Needs translation |
| 193 |
\def\ccname{\@ensure@RTL{نسخة ل}}% << |
| 194 |
\def\headtoname{\@ensure@RTL{إلى}}%<-- Needs translation |
| 195 |
\def\pagename{\@ensure@RTL{صفحة}}% |
| 196 |
\def\seename{\@ensure@RTL{راجع}}%\alefhamza\nun\za\ra |
| 197 |
\def\alsoname{\@ensure@RTL{راجع أيضًا}}%<<\alefhamza\nun\za\ra |
| 198 |
\def\proofname{\@ensure@RTL{برهان}}% |
| 199 |
\def\glossaryname{\@ensure@RTL{قاموس}}%<< |
| 200 |
} |
| 201 |
\def\datearabic{% |
| 202 |
\def\today{% |
| 203 |
\if@hijrical |
| 204 |
\Hijritoday[\arabic@hijri@correction]% |
| 205 |
\else% |
| 206 |
\if@RTL |
| 207 |
\arabicnumber\day\space\@@arabic@month{\month}% |
| 208 |
\space\arabicnumber\year% |
| 209 |
\else% in LR environment we format the gregorian date within \textenglish |
| 210 |
\iflanguageloaded{english}{\textenglish{\today}}%else US format |
| 211 |
{\normalfontlatin\ifcase\month\or January\or February\or March\or April\or May\or June\or |
| 212 |
July\or August\or September\or October\or November\or December\fi |
| 213 |
\space\number\day,\space\number\year}% |
| 214 |
\fi |
| 215 |
\fi}} |
| 216 |
|
| 217 |
% Use \providecommand here as the ldf file might |
| 218 |
% be reloaded via aeb (BCP). |
| 219 |
\providecommand{\arabicnumerals}[2]{\arabicnumber{#2}} |
| 220 |
|
| 221 |
\def\arabicnumber#1{% |
| 222 |
\ifeastern@numerals |
| 223 |
\@ensure@LTR{\arabicdigits{\number#1}}% |
| 224 |
\else |
| 225 |
\number#1% |
| 226 |
\fi} |
| 227 |
|
| 228 |
\def\@ornatebracearabic#1{\RL{\char"FD3F\@arabic#1\char"FD3E}} |
| 229 |
\def\@ornatebracealph#1{\RL{\char"FD3F\@alph#1\char"FD3E}} |
| 230 |
|
| 231 |
\def\abjadalph#1{\expandafter\arabic@abjad@alph{\number#1}} |
| 232 |
|
| 233 |
% This is a poor man's Arabic alphanumeric. It just uses the alphabet and |
| 234 |
% thus ends at 28. |
| 235 |
\def\arabic@abjad@alph#1{\ifcase#1% |
| 236 |
\or ا\or ب\or\abjad@three\or د\or و\or ه\or ز% |
| 237 |
\or ح\or ط\or ي\or ك\or ل\or م\or ن% |
| 238 |
\or س\or ع\or ف\or ص\or ق\or ر\or ش% |
| 239 |
\or ت\or ث\or خ\or ذ\or ض\or ظ\or غ% |
| 240 |
\else\xpg@ill@value{#1}{arabic@abjad@alph}\fi |
| 241 |
} |
| 242 |
|
| 243 |
\def\abjadmaghribi#1{% |
| 244 |
\ifnum#1>1999\xpg@ill@value{#1}{abjad}% |
| 245 |
\else |
| 246 |
\ifnum#1<\z@\space\xpg@ill@value{#1}{abjad}% |
| 247 |
\else |
| 248 |
\ifnum#1<10\expandafter\abj@num@i\number#1% |
| 249 |
\else |
| 250 |
\ifnum#1<100\expandafter\abj@maghribi@num@ii\number#1% |
| 251 |
\else |
| 252 |
\ifnum#1<\@m\expandafter\abj@maghribi@num@iii\number#1% |
| 253 |
\else |
| 254 |
\ifnum#1<\@M\expandafter\abj@maghribi@num@iv\number#1% |
| 255 |
\fi |
| 256 |
\fi |
| 257 |
\fi |
| 258 |
\fi |
| 259 |
\fi |
| 260 |
\fi |
| 261 |
} |
| 262 |
|
| 263 |
%maghribi س -> ص ص -> ض ش -> س ض -> ظ ظ -> غ غ -> ش |
| 264 |
\def\abj@maghribi@num@ii#1{% |
| 265 |
\ifcase#1\abjad@zero\or ي\or ك\or ل\or م\or ن% |
| 266 |
\or ص\or ع\or ف\or ض\fi |
| 267 |
\abj@num@i} |
| 268 |
\def\abj@maghribi@num@iii#1{% |
| 269 |
\ifcase#1\or ق\or ر\or س\or ت\or ث% |
| 270 |
\or خ\or ذ\or ظ\or غ\fi |
| 271 |
\abj@maghribi@num@ii} |
| 272 |
\def\abj@maghribi@num@iv#1{% |
| 273 |
\ifcase#1\or ش\fi |
| 274 |
\abj@maghribi@num@iii} |
| 275 |
|
| 276 |
\def\arabic@numbers{% |
| 277 |
\ifarabic@abjadalph |
| 278 |
\let\@alph\abjadalph |
| 279 |
\let\@Alph\abjadalph |
| 280 |
\else |
| 281 |
\let\@alph\abjad |
| 282 |
\let\@Alph\abjad |
| 283 |
\fi |
| 284 |
} |
| 285 |
|
| 286 |
\def\noarabic@numbers{% |
| 287 |
\let\@alph\latin@alph |
| 288 |
\let\@Alph\latin@Alph |
| 289 |
} |
| 290 |
|
| 291 |
% Store original definition |
| 292 |
\let\xpg@save@arabic\@arabic |
| 293 |
|
| 294 |
\def\arabic@globalnumbers{% |
| 295 |
\let\@arabic\arabicnumber |
| 296 |
\renewcommand\thefootnote{\localnumeral*{footnote}}% |
| 297 |
\renewcommand\theequation{\localnumeral*{equation}}% |
| 298 |
} |
| 299 |
|
| 300 |
\def\noarabic@globalnumbers{% |
| 301 |
\let\@arabic\xpg@save@arabic |
| 302 |
} |
| 303 |
|
| 304 |
\def\arabic@xetex@capsformat{% |
| 305 |
\let\xpg@save@sepmark\@SepMark |
| 306 |
\SepMark{\xpg@sepmark} |
| 307 |
} |
| 308 |
|
| 309 |
\def\noarabic@xetex@capsformat{% |
| 310 |
\ifcsname xpg@save@sepmark\endcsname |
| 311 |
\SepMark{\xpg@save@sepmark} |
| 312 |
\fi |
| 313 |
} |
| 314 |
|
| 315 |
\def\arabic@luatex@capsformat{% |
| 316 |
% |
| 317 |
% change chapter and part headings |
| 318 |
\ifarabic@customsep |
| 319 |
\ifcsname chapter\endcsname |
| 320 |
\let\xpg@save@thesection\thesection |
| 321 |
\renewcommand*\thesection{\thechapter\xpg@sepmark\@arabic\c@section} |
| 322 |
\let\xpg@save@theequation\theequation |
| 323 |
\renewcommand*\theequation{% |
| 324 |
\ifnum \c@chapter>\z@ \thechapter\xpg@sepmark\fi\@arabic\c@equation} |
| 325 |
\let\xpg@save@thefigure\thefigure |
| 326 |
\renewcommand*\thefigure{% |
| 327 |
\ifnum\c@chapter>\z@\thechapter\xpg@sepmark\fi\@arabic\c@figure} |
| 328 |
\let\xpg@save@thetable\thetable |
| 329 |
\renewcommand*\thetable{% |
| 330 |
\ifnum\c@chapter>\z@\thechapter\xpg@sepmark\fi\@arabic\c@table} |
| 331 |
\fi |
| 332 |
\let\xpg@save@thesubsection\thesubsection |
| 333 |
\renewcommand\thesubsection |
| 334 |
{\thesection\xpg@sepmark\@arabic\c@subsection} |
| 335 |
\let\xpg@save@thesubsubsection\thesubsubsection |
| 336 |
\renewcommand\thesubsubsection{\thesubsection\xpg@sepmark\@arabic\c@subsubsection} |
| 337 |
\let\xpg@save@theparagraph\theparagraph |
| 338 |
\renewcommand\theparagraph |
| 339 |
{\thesubsubsection\xpg@sepmark\@arabic\c@paragraph} |
| 340 |
\let\xpg@save@thesubparagraph\thesubparagraph |
| 341 |
\renewcommand\thesubparagraph{\theparagraph\xpg@sepmark\@arabic\c@subparagraph} |
| 342 |
\fi % (end \ifarabic@customsep) |
| 343 |
} |
| 344 |
|
| 345 |
\def\noarabic@luatex@capsformat{% |
| 346 |
\ifcsname xpg@save@thesection\endcsname |
| 347 |
\let\thesection\xpg@save@thesection |
| 348 |
\fi |
| 349 |
\ifcsname xpg@save@theequation\endcsname |
| 350 |
\let\theequation\xpg@save@theequation |
| 351 |
\fi |
| 352 |
\ifcsname xpg@save@thefigure\endcsname |
| 353 |
\let\thefigure\xpg@save@thefigure |
| 354 |
\fi |
| 355 |
\ifcsname xpg@save@thetable\endcsname |
| 356 |
\let\thetable\xpg@save@thetable |
| 357 |
\fi |
| 358 |
\ifcsname xpg@save@thesubsection\endcsname |
| 359 |
\let\thesubsection\xpg@save@thesubsection |
| 360 |
\ifcsname xpg@save@thesubsubsection\endcsname |
| 361 |
\let\thesubsubsection\xpg@save@thesubsubsection |
| 362 |
\fi |
| 363 |
\fi |
| 364 |
\ifcsname xpg@save@theparagraph\endcsname |
| 365 |
\let\theparagraph\xpg@save@theparagraph |
| 366 |
\fi |
| 367 |
\ifcsname xpg@save@thesubparagraph\endcsname |
| 368 |
\let\thesubparagraph\xpg@save@thesubparagraph |
| 369 |
\fi |
| 370 |
} |
| 371 |
|
| 372 |
\def\blockextras@arabic{% |
| 373 |
\ifarabic@customsep |
| 374 |
\ifxetex |
| 375 |
\arabic@xetex@capsformat |
| 376 |
\else |
| 377 |
\arabic@luatex@capsformat |
| 378 |
\fi |
| 379 |
\fi |
| 380 |
} |
| 381 |
|
| 382 |
\def\noextras@arabic{% |
| 383 |
\ifarabic@customsep |
| 384 |
\ifxetex |
| 385 |
\noarabic@xetex@capsformat |
| 386 |
\else |
| 387 |
\noarabic@luatex@capsformat |
| 388 |
\fi |
| 389 |
\fi |
| 390 |
} |
| 391 |
|
| 392 |
\endinput |