| 1 |
% Language definition file (part of polyglossia v2.10 -- 2026/04/18) |
| 2 |
% |
| 3 |
%%% Adapted from a file contributed by Kamal Abdali |
| 4 |
\ProvidesFile{gloss-urdu.ldf}[polyglossia: module for Urdu] |
| 5 |
|
| 6 |
\RequireBidi |
| 7 |
\RequirePackage{arabicnumbers} |
| 8 |
\RequirePackage{hijrical} |
| 9 |
|
| 10 |
\PolyglossiaSetup{urdu}{ |
| 11 |
bcp47=ur, |
| 12 |
bcp47-language=ur, |
| 13 |
bcp47-script=Arab, |
| 14 |
script=Arabic, |
| 15 |
direction=RL, |
| 16 |
scripttag=arab, |
| 17 |
langtag=URD, |
| 18 |
hyphennames={urdu,nohyphenation}, |
| 19 |
localnumeral=urdunumerals, |
| 20 |
Localnumeral=urdunumerals |
| 21 |
%TODO localalph={abjad,abjad} |
| 22 |
} |
| 23 |
|
| 24 |
% BCP-47 compliant aliases |
| 25 |
\setlanguagealias*{urdu}{ur} |
| 26 |
|
| 27 |
\newif\if@western@numerals |
| 28 |
\newif\ifurdu@customsep\urdu@customsepfalse |
| 29 |
\def\xpg@sepmark{} |
| 30 |
\newif\if@hijrical |
| 31 |
|
| 32 |
\DeclareKeys[polyglossia/gloss/urdu] |
| 33 |
{ |
| 34 |
abjadjimnotail.if = abjad@jim@notail, |
| 35 |
abjadjimnotail.default:n = true, |
| 36 |
sectionsep.code = \gdef\xpg@sepmark{#1}\urdu@customseptrue, |
| 37 |
sectionsep.default:n = ., |
| 38 |
hijricorrection.code = \gdef\urdu@hijri@correction{#1}, |
| 39 |
hijricorrection.default:n = 0, |
| 40 |
calendar.choice:, |
| 41 |
calendar / gregorian.code = |
| 42 |
{% |
| 43 |
\@hijricalfalse |
| 44 |
}, |
| 45 |
calendar / hijri.code = |
| 46 |
{% |
| 47 |
\@hijricaltrue |
| 48 |
}, |
| 49 |
calendar.default:n = gregorian, |
| 50 |
calendar/unknown.code = \xpg@warning{Unknown Urdu calendar option `#1'}, |
| 51 |
numerals.choice:, |
| 52 |
numerals / eastern.code = |
| 53 |
{% |
| 54 |
\@western@numeralsfalse |
| 55 |
\SetLanguageKeys{urdu}{bcp47-extension-u=nu-arab}% |
| 56 |
}, |
| 57 |
numerals / western.code = |
| 58 |
{% |
| 59 |
\@western@numeralstrue |
| 60 |
\SetLanguageKeys{urdu}{bcp47-extension-u=nu-latn}% |
| 61 |
}, |
| 62 |
numerals.default:n = eastern, |
| 63 |
numerals/unknown.code = \xpg@warning{Unknown Urdu numerals option `#1'} |
| 64 |
} |
| 65 |
|
| 66 |
% This should set the defaults |
| 67 |
\SetGlossOptions{urdu}{calendar,numerals,hijricorrection} |
| 68 |
|
| 69 |
\def\urdugregmonth#1{\ifcase#1% |
| 70 |
\or جنوری\or فروری\or مارچ\or اپریل\or مئی\or جون\or جولائی\or اگست\or ستمبر\or اکتوبر\or نومبر\or دسمبر\fi} |
| 71 |
|
| 72 |
\def\urduhijrimonth#1{\ifcase#1% |
| 73 |
\or محرّم\or صفر\or ربیع الاوّل\or ربیع الثّانی\or جمادی الاوّل\or جمادی الثّانی\or رجب\or شعبان\or رمضان\or شوّال\or ذیقعدہ\or ذی الحجّہ\fi} |
| 74 |
|
| 75 |
%\Hijritoday is now locale-aware and will format the date with this macro: |
| 76 |
\DefineFormatHijriDate{urdu}{\@ensure@RTL{% |
| 77 |
\urdunumber{\value{Hijriday}}؍\space\urduhijrimonth{\value{Hijrimonth}}\space\urdunumber{\value{Hijriyear}}}} |
| 78 |
|
| 79 |
\def\captionsurdu{% |
| 80 |
\def\refname{\@ensure@RTL{حوالہ جات}}% |
| 81 |
\def\abstractname{\@ensure@RTL{ملخّص}}% |
| 82 |
\def\bibname{\@ensure@RTL{کتابیات}}% |
| 83 |
\def\prefacename{\@ensure@RTL{دیباچہ}}% |
| 84 |
\def\chaptername{\@ensure@RTL{باب}}% |
| 85 |
\def\appendixname{\@ensure@RTL{ضمیمہ}}% |
| 86 |
\def\contentsname{\@ensure@RTL{فہرست عنوانات}}% |
| 87 |
\def\listfigurename{\@ensure@RTL{فہرست اشکال}}% |
| 88 |
\def\listtablename{\@ensure@RTL{فہرست جداول}}% |
| 89 |
\def\indexname{\@ensure@RTL{اشاریہ}}% |
| 90 |
\def\figurename{\@ensure@RTL{شكل}}% |
| 91 |
\def\tablename{\@ensure@RTL{جدول}}% |
| 92 |
%\def\thepart{}% |
| 93 |
\def\partname{\@ensure@RTL{حصّہ}}% |
| 94 |
\def\pagename{\@ensure@RTL{صفحہ}}% |
| 95 |
\def\seename{\@ensure@RTL{ملاحظہ ہو}}% |
| 96 |
\def\alsoname{\@ensure@RTL{ایضاً}}% |
| 97 |
\def\enclname{\@ensure@RTL{منسلک}}% |
| 98 |
\def\ccname{\@ensure@RTL{نقل}}% |
| 99 |
\def\headtoname{\@ensure@RTL{بملاحظہ}}% |
| 100 |
\def\proofname{\@ensure@RTL{ثبوت}}% |
| 101 |
\def\glossaryname{\@ensure@RTL{لغت}}% |
| 102 |
\def\sectionname{\@ensure@RTL{فصل}}% |
| 103 |
} |
| 104 |
|
| 105 |
\def\dateurdu{% |
| 106 |
\def\today{% |
| 107 |
\if@hijrical |
| 108 |
\Hijritoday[\urdu@hijri@correction]% |
| 109 |
\else |
| 110 |
\@ensure@RTL{\urdunumber\day؍\space\urdugregmonth{\month}% |
| 111 |
\space\urdunumber\year}% |
| 112 |
\fi}% |
| 113 |
} |
| 114 |
|
| 115 |
\def\urdunumber#1{% |
| 116 |
\if@western@numerals |
| 117 |
\number#1% |
| 118 |
\else |
| 119 |
%%FIXME use farsidigits instead??? |
| 120 |
\@ensure@LTR{\protect\arabicdigits{\number#1}}% |
| 121 |
\fi} |
| 122 |
|
| 123 |
\def\urdu@numbers{% |
| 124 |
\let\@alph\abjad% |
| 125 |
\let\@Alph\abjad% |
| 126 |
} |
| 127 |
|
| 128 |
\def\nourdu@numbers{% |
| 129 |
\let\@alph\latin@alph% |
| 130 |
\let\@Alph\latin@Alph% |
| 131 |
} |
| 132 |
|
| 133 |
\newcommand{\urdunumerals}[2]{\urdunumber{#2}} |
| 134 |
|
| 135 |
% Store original definition |
| 136 |
\let\xpg@save@arabic\@arabic |
| 137 |
|
| 138 |
\def\urdu@globalnumbers{% |
| 139 |
\let\@arabic\urdunumber% |
| 140 |
% For some reason \thefootnote needs to be set separately: |
| 141 |
\renewcommand\thefootnote{\localnumeral*{footnote}}% |
| 142 |
} |
| 143 |
|
| 144 |
\def\nourdu@globalnumbers{ |
| 145 |
\let\@arabic\xpg@save@arabic% |
| 146 |
} |
| 147 |
|
| 148 |
\def\urdu@xetex@capsformat{% |
| 149 |
\let\xpg@save@sepmark\@SepMark% |
| 150 |
\SepMark{\xpg@sepmark} |
| 151 |
} |
| 152 |
|
| 153 |
\def\nourdu@xetex@capsformat{% |
| 154 |
\ifcsname xpg@save@sepmark\endcsname% |
| 155 |
\SepMark{\xpg@save@sepmark} |
| 156 |
\fi% |
| 157 |
} |
| 158 |
|
| 159 |
\def\urdu@luatex@capsformat{% |
| 160 |
% |
| 161 |
% change chapter and part headings |
| 162 |
\ifurdu@customsep |
| 163 |
\ifcsname chapter\endcsname% |
| 164 |
\let\xpg@save@thesection\thesection% |
| 165 |
\renewcommand*\thesection{\thechapter\xpg@sepmark\@arabic\c@section} |
| 166 |
\let\xpg@save@theequation\theequation% |
| 167 |
\renewcommand*\theequation{% |
| 168 |
\ifnum \c@chapter>\z@ \thechapter\xpg@sepmark\fi\@arabic\c@equation} |
| 169 |
\let\xpg@save@thefigure\thefigure% |
| 170 |
\renewcommand*\thefigure{% |
| 171 |
\ifnum\c@chapter>\z@\thechapter\xpg@sepmark\fi\@arabic\c@figure} |
| 172 |
\let\xpg@save@thetable\thetable% |
| 173 |
\renewcommand*\thetable{% |
| 174 |
\ifnum\c@chapter>\z@\thechapter\xpg@sepmark\fi\@arabic\c@table} |
| 175 |
\fi% |
| 176 |
\let\xpg@save@thesubsection\thesubsection% |
| 177 |
\renewcommand\thesubsection |
| 178 |
{\thesection\xpg@sepmark\@arabic\c@subsection} |
| 179 |
\let\xpg@save@thesubsubsection\thesubsubsection% |
| 180 |
\renewcommand\thesubsubsection{\thesubsection\xpg@sepmark\@arabic\c@subsubsection} |
| 181 |
\let\xpg@save@theparagraph\theparagraph% |
| 182 |
\renewcommand\theparagraph |
| 183 |
{\thesubsubsection\xpg@sepmark\@arabic\c@paragraph} |
| 184 |
\let\xpg@save@thesubparagraph\thesubparagraph% |
| 185 |
\renewcommand\thesubparagraph{\theparagraph\xpg@sepmark\@arabic\c@subparagraph} |
| 186 |
\fi% (end \ifurdu@customsep) |
| 187 |
} |
| 188 |
|
| 189 |
\def\nourdu@luatex@capsformat{% |
| 190 |
\ifcsname xpg@save@thesection\endcsname% |
| 191 |
\let\thesection\xpg@save@thesection% |
| 192 |
\fi% |
| 193 |
\ifcsname xpg@save@theequation\endcsname% |
| 194 |
\let\theequation\xpg@save@theequation% |
| 195 |
\fi% |
| 196 |
\ifcsname xpg@save@thefigure\endcsname% |
| 197 |
\let\thefigure\xpg@save@thefigure% |
| 198 |
\fi% |
| 199 |
\ifcsname xpg@save@thetable\endcsname% |
| 200 |
\let\thetable\xpg@save@thetable% |
| 201 |
\fi% |
| 202 |
\ifcsname xpg@save@thesubsection\endcsname% |
| 203 |
\let\thesubsection\xpg@save@thesubsection% |
| 204 |
\ifcsname xpg@save@thesubsubsection\endcsname% |
| 205 |
\let\thesubsubsection\xpg@save@thesubsubsection% |
| 206 |
\fi% |
| 207 |
\fi% |
| 208 |
\ifcsname xpg@save@theparagraph\endcsname% |
| 209 |
\let\theparagraph\xpg@save@theparagraph% |
| 210 |
\fi% |
| 211 |
\ifcsname xpg@save@thesubparagraph\endcsname% |
| 212 |
\let\thesubparagraph\xpg@save@thesubparagraph% |
| 213 |
\fi% |
| 214 |
} |
| 215 |
|
| 216 |
\def\blockextras@urdu{% |
| 217 |
\ifurdu@customsep |
| 218 |
\ifxetex |
| 219 |
\urdu@xetex@capsformat |
| 220 |
\else |
| 221 |
\urdu@luatex@capsformat |
| 222 |
\fi |
| 223 |
\fi |
| 224 |
} |
| 225 |
% |
| 226 |
\def\noextras@urdu{% |
| 227 |
\ifurdu@customsep |
| 228 |
\ifxetex |
| 229 |
\nourdu@xetex@capsformat |
| 230 |
\else |
| 231 |
\nourdu@luatex@capsformat |
| 232 |
\fi |
| 233 |
\fi |
| 234 |
} |
| 235 |
|
| 236 |
\endinput |
| 237 |
|