| 1 |
% Language definition file (part of polyglossia v2.10 -- 2026/04/18) |
| 2 |
% |
| 3 |
\ProvidesFile{gloss-persian.ldf}[polyglossia: module for Persian] |
| 4 |
|
| 5 |
\RequireBidi |
| 6 |
\RequirePackage{arabicnumbers} |
| 7 |
\RequirePackage{farsical} |
| 8 |
\RequirePackage{hijrical} |
| 9 |
\PolyglossiaSetup{persian}{ |
| 10 |
bcp47=fa, |
| 11 |
bcp47-language=fa, |
| 12 |
bcp47-script=Arab, |
| 13 |
babelname=farsi, |
| 14 |
script=Arabic, |
| 15 |
direction=RL, |
| 16 |
scripttag=arab, |
| 17 |
langtag=FAR, |
| 18 |
hyphennames={nohyphenation}, |
| 19 |
localnumeral=farsinumerals, |
| 20 |
Localnumeral=farsinumerals |
| 21 |
} |
| 22 |
|
| 23 |
% BCP-47 compliant aliases |
| 24 |
\setlanguagealias*{persian}{fa} |
| 25 |
|
| 26 |
% Babel and backwards compat. alias |
| 27 |
\setlanguagealias{persian}{farsi} |
| 28 |
|
| 29 |
\newif\if@western@numerals |
| 30 |
\newif\ifpersian@customsep\persian@customsepfalse |
| 31 |
\def\xpg@sepmark{} |
| 32 |
|
| 33 |
%TODO add option for CALENDAR |
| 34 |
|
| 35 |
\DeclareKeys[polyglossia/gloss/persian] |
| 36 |
{ |
| 37 |
sectionsep.code = \gdef\xpg@sepmark{#1}\persian@customseptrue, |
| 38 |
sectionsep.default:n = ., |
| 39 |
abjadjimnotail.if = abjad@jim@notail, |
| 40 |
abjadjimnotail.default:n = true, |
| 41 |
locale.store = \@persian@locale, |
| 42 |
locale.default:n = default, |
| 43 |
numerals.choice:, |
| 44 |
numerals / eastern.code = |
| 45 |
{% |
| 46 |
\@western@numeralsfalse |
| 47 |
\SetLanguageKeys{persian}{bcp47-extension-u=nu-arab}% |
| 48 |
}, |
| 49 |
numerals / western.code = |
| 50 |
{% |
| 51 |
\@western@numeralstrue |
| 52 |
\SetLanguageKeys{persian}{bcp47-extension-u=nu-latn}% |
| 53 |
}, |
| 54 |
numerals.default:n = eastern, |
| 55 |
numerals/unknown.code = \xpg@warning{Unknown Persian numerals option `#1'} |
| 56 |
} |
| 57 |
|
| 58 |
% Register default options |
| 59 |
\InitializeGlossOptions{persian}{locale=default,numerals=eastern,abjadjimnotail=false} |
| 60 |
|
| 61 |
\def\farsigregmonth#1{\ifcase#1% |
| 62 |
\or ژانویه\or فوریه\or مارس\or آوریل\or مه\or ژوئن\or ژوئیه\or اوت\or سپتامبر\or اکتبر\or نوامبر\or دسامبر\fi} |
| 63 |
\def\farsimonth#1{\ifcase#1% |
| 64 |
\or کانون ثانی\or شباط\or اذار%%or ادار |
| 65 |
\or نیسان\or ایار\or حزیران\or تموز\or آب\or ایلول\or تشرین اول\or تشرین ثانی\or کانون اول\fi} |
| 66 |
|
| 67 |
%\Hijritoday is now locale-aware and will format the date with this macro: |
| 68 |
\DefineFormatHijriDate{persian}{\@ensure@RTL{% |
| 69 |
\farsinumber{\value{Hijriday}}\space\HijriMonthArabic{\value{Hijrimonth}}\space\farsinumber{\value{Hijriyear}}}} |
| 70 |
|
| 71 |
\def\captionspersian{% |
| 72 |
\def\prefacename{\@ensure@RTL{پیشگفتار}}% |
| 73 |
\def\refname{\@ensure@RTL{مراجع}}% |
| 74 |
\def\abstractname{\@ensure@RTL{چکیده}}% |
| 75 |
\def\bibname{\@ensure@RTL{کتابنامه}}% |
| 76 |
\def\chaptername{\@ensure@RTL{فصل}}% |
| 77 |
\def\appendixname{\@ensure@RTL{پیوست}}% |
| 78 |
\def\contentsname{\@ensure@RTL{فهرست مطالب}}% |
| 79 |
\def\listfigurename{\@ensure@RTL{لیست تصاویر}}% |
| 80 |
\def\listtablename{\@ensure@RTL{لیست جداول}}% |
| 81 |
\def\indexname{\@ensure@RTL{نمایه}}% |
| 82 |
\def\figurename{\@ensure@RTL{شكل}}% |
| 83 |
\def\tablename{\@ensure@RTL{جدول}}% |
| 84 |
\def\partname{\@ensure@RTL{بخش}}% |
| 85 |
\def\enclname{\@ensure@RTL{پیوست}}% |
| 86 |
\def\ccname{\@ensure@RTL{رونوشت}}% |
| 87 |
\def\headtoname{\@ensure@RTL{به}}% |
| 88 |
\def\pagename{\@ensure@RTL{صفحة}}% |
| 89 |
\def\seename{\@ensure@RTL{ببینید}}% |
| 90 |
\def\alsoname{\@ensure@RTL{نیز ببینید}}% |
| 91 |
\def\proofname{\@ensure@RTL{برهان}}% |
| 92 |
\def\glossaryname{\@ensure@RTL{دانشنامه}}% |
| 93 |
} |
| 94 |
\def\datepersian{% |
| 95 |
\def\today{\@ensure@RTL{\farsinumber\day\space\farsigregmonth{\month}\space\farsinumber\year}}% |
| 96 |
} |
| 97 |
|
| 98 |
\newcommand{\farsinumerals}[2]{\farsinumber{#2}} |
| 99 |
|
| 100 |
\def\farsinumber#1{% |
| 101 |
\if@western@numerals |
| 102 |
\number#1% |
| 103 |
\else |
| 104 |
\IfCharIsAvailableTF{06F0}% |
| 105 |
{\@ensure@LTR{\farsidigits{\number#1}}}% |
| 106 |
{\@ensure@LTR{\arabicdigits{\number#1}}}% |
| 107 |
\fi |
| 108 |
} |
| 109 |
|
| 110 |
%\def\farsinum#1{\expandafter\farsinumber\csname c@#1\endcsname} |
| 111 |
%\def\farsibracenum#1{(\expandafter\farsinumber\csname c@#1\endcsname)} |
| 112 |
%\def\farsiornatebracenum#1{\char"FD3E\expandafter\farsinumber\csname c@#1\endcsname\char"FD3F} |
| 113 |
%\def\farsialph#1{\expandafter\@farsialph\csname c@#1\endcsname} |
| 114 |
|
| 115 |
\def\persian@numbers{% |
| 116 |
\let\@alph\abjad% |
| 117 |
\let\@Alph\abjad% |
| 118 |
} |
| 119 |
|
| 120 |
\def\nopersian@numbers{% |
| 121 |
\let\@alph\@latinalph% |
| 122 |
\let\@Alph\@latinAlph% |
| 123 |
} |
| 124 |
|
| 125 |
\def\persian@globalnumbers{% |
| 126 |
\let\@arabic\farsinumber% |
| 127 |
\renewcommand\thefootnote{\localnumeral*{footnote}}% |
| 128 |
\renewcommand\theequation{\localnumeral*{equation}}% |
| 129 |
} |
| 130 |
|
| 131 |
% Store original definition |
| 132 |
\let\xpg@save@arabic\@arabic |
| 133 |
|
| 134 |
\def\nopersian@globalnumbers{ |
| 135 |
\let\@arabic\xpg@save@arabic% |
| 136 |
} |
| 137 |
|
| 138 |
\def\persian@xetex@capsformat{% |
| 139 |
\let\xpg@save@sepmark\@SepMark% |
| 140 |
\SepMark{\xpg@sepmark} |
| 141 |
} |
| 142 |
|
| 143 |
\def\nopersian@xetex@capsformat{% |
| 144 |
\ifcsname xpg@save@sepmark\endcsname% |
| 145 |
\SepMark{\xpg@save@sepmark} |
| 146 |
\fi% |
| 147 |
} |
| 148 |
|
| 149 |
\def\persian@luatex@capsformat{% |
| 150 |
% |
| 151 |
% change chapter and part headings |
| 152 |
\ifpersian@customsep |
| 153 |
\ifcsname chapter\endcsname% |
| 154 |
\let\xpg@save@thesection\thesection% |
| 155 |
\renewcommand*\thesection{\thechapter\xpg@sepmark\@arabic\c@section} |
| 156 |
\let\xpg@save@theequation\theequation% |
| 157 |
\renewcommand*\theequation{% |
| 158 |
\ifnum \c@chapter>\z@ \thechapter\xpg@sepmark\fi\@arabic\c@equation} |
| 159 |
\let\xpg@save@thefigure\thefigure% |
| 160 |
\renewcommand*\thefigure{% |
| 161 |
\ifnum\c@chapter>\z@\thechapter\xpg@sepmark\fi\@arabic\c@figure} |
| 162 |
\let\xpg@save@thetable\thetable% |
| 163 |
\renewcommand*\thetable{% |
| 164 |
\ifnum\c@chapter>\z@\thechapter\xpg@sepmark\fi\@arabic\c@table} |
| 165 |
\fi% |
| 166 |
\let\xpg@save@thesubsection\thesubsection% |
| 167 |
\renewcommand\thesubsection |
| 168 |
{\thesection\xpg@sepmark\@arabic\c@subsection} |
| 169 |
\let\xpg@save@thesubsubsection\thesubsubsection% |
| 170 |
\renewcommand\thesubsubsection{\thesubsection\xpg@sepmark\@arabic\c@subsubsection} |
| 171 |
\let\xpg@save@theparagraph\theparagraph% |
| 172 |
\renewcommand\theparagraph |
| 173 |
{\thesubsubsection\xpg@sepmark\@arabic\c@paragraph} |
| 174 |
\let\xpg@save@thesubparagraph\thesubparagraph% |
| 175 |
\renewcommand\thesubparagraph{\theparagraph\xpg@sepmark\@arabic\c@subparagraph} |
| 176 |
\fi% (end \ifpersiancustomsep) |
| 177 |
} |
| 178 |
|
| 179 |
\def\nopersian@luatex@capsformat{% |
| 180 |
\ifcsname xpg@save@thesection\endcsname% |
| 181 |
\let\thesection\xpg@save@thesection% |
| 182 |
\fi% |
| 183 |
\ifcsname xpg@save@theequation\endcsname% |
| 184 |
\let\theequation\xpg@save@theequation% |
| 185 |
\fi% |
| 186 |
\ifcsname xpg@save@thefigure\endcsname% |
| 187 |
\let\thefigure\xpg@save@thefigure% |
| 188 |
\fi% |
| 189 |
\ifcsname xpg@save@thetable\endcsname% |
| 190 |
\let\thetable\xpg@save@thetable% |
| 191 |
\fi% |
| 192 |
\ifcsname xpg@save@thesubsection\endcsname% |
| 193 |
\let\thesubsection\xpg@save@thesubsection% |
| 194 |
\ifcsname xpg@save@thesubsubsection\endcsname% |
| 195 |
\let\thesubsubsection\xpg@save@thesubsubsection% |
| 196 |
\fi% |
| 197 |
\fi% |
| 198 |
\ifcsname xpg@save@theparagraph\endcsname% |
| 199 |
\let\theparagraph\xpg@save@theparagraph% |
| 200 |
\fi% |
| 201 |
\ifcsname xpg@save@thesubparagraph\endcsname% |
| 202 |
\let\thesubparagraph\xpg@save@thesubparagraph% |
| 203 |
\fi% |
| 204 |
} |
| 205 |
|
| 206 |
\def\blockextras@persian{% |
| 207 |
\ifpersian@customsep |
| 208 |
\ifxetex |
| 209 |
\persian@xetex@capsformat |
| 210 |
\else |
| 211 |
\persian@luatex@capsformat |
| 212 |
\fi |
| 213 |
\fi |
| 214 |
} |
| 215 |
% |
| 216 |
\def\noextras@persian{% |
| 217 |
\ifpersian@customsep |
| 218 |
\ifxetex |
| 219 |
\nopersian@xetex@capsformat |
| 220 |
\else |
| 221 |
\nopersian@luatex@capsformat |
| 222 |
\fi |
| 223 |
\fi |
| 224 |
} |
| 225 |
|
| 226 |
\endinput |