summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/polyglossia/gloss-urdu.ldf
blob: 028f0cdd885fdd33eb6d002ff3810db5bd32c3fa (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
%%% Adapted from a file contributed by Kamal Abdali
\ProvidesFile{gloss-urdu.ldf}[polyglossia: module for Urdu]
\RequirePackage{bidi}
\RequirePackage{arabicnumbers}
\RequirePackage{hijrical}

\PolyglossiaSetup{urdu}{
  script=Arabic,
  direction=RL,
  scripttag=arab,
  langtag=URD,
  hyphennames={urdu,nohyphenation},
  fontsetup=true
  %TODO localalph={abjad,abjad}
  %TODO localnumber=urdunumber
}

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

%% TODO USE boolkey instead !!!
%this is needed for \abjad in arabicnumbers.sty
\def\tmp@true{true}
\define@key{urdu}{abjadjimnotail}[true]{%
  \def\@tmpa{#1}%
  \ifx\@tmpa\tmp@true\abjad@jim@notailtrue%
  \else
    \abjad@jim@notailfalse
  \fi}

\newif\if@hijrical
\def\tmp@hijri{hijri}
\define@key{urdu}{calendar}[gregorian]{%
  \def\@tmpa{#1}%
  \ifx\@tmpa\tmp@hijri\@hijricaltrue%
    \else\@hijricalfalse%
  \fi}

\define@key{urdu}{hijricorrection}[0]{%
  \gdef\@hijri@correction{#1}}%

% This should set the defaults
\setkeys{urdu}{calendar,numerals,hijricorrection}

\def\urdugregmonth#1{\ifcase#1%
  \or جنوری\or فروری\or مارچ\or اپریل\or مئی\or جون\or جولائی\or اگست\or  ستمبر\or اکتوبر\or نومبر\or دسمبر\fi}

\def\urduhijrimonth#1{\ifcase#1%
 \or محرّم\or صفر\or ربیع الاوّل\or ربیع الثّانی\or جمادی الاوّل\or جمادی الثّانی\or رجب\or شعبان\or  رمضان\or شوّال\or ذیقعدہ\or ذی الحجّہ\fi}

%\Hijritoday is now locale-aware and will format the date with this macro:
\DefineFormatHijriDate{urdu}{\@ensure@RTL{%
  \urdunumber{\value{Hijriday}}؍\space\urduhijrimonth{\value{Hijrimonth}}\space\urdunumber{\value{Hijriyear}}}}

\def\captionsurdu{%
  \def\refname{\@ensure@RTL{حوالہ جات}}%
  \def\abstractname{\@ensure@RTL{ملخّص}}%
  \def\bibname{\@ensure@RTL{کتابیات}}%
  \def\prefacename{\@ensure@RTL{دیباچہ}}%
  \def\chaptername{\@ensure@RTL{باب}}%
  \def\appendixname{\@ensure@RTL{ضمیمہ}}%
  \def\contentsname{\@ensure@RTL{فہرست عنوانات}}%
  \def\listfigurename{\@ensure@RTL{فہرست اشکال}}%
  \def\listtablename{\@ensure@RTL{فہرست جداول}}%
  \def\indexname{\@ensure@RTL{اشاریہ}}%
  \def\figurename{\@ensure@RTL{شكل}}%
  \def\tablename{\@ensure@RTL{جدول}}%
  %\def\thepart{}%
  \def\partname{\@ensure@RTL{حصّہ}}%
  \def\pagename{\@ensure@RTL{صفحہ}}%
  \def\seename{\@ensure@RTL{ملاحظہ ہو}}%
  \def\alsoname{\@ensure@RTL{ایضاً}}%
  \def\enclname{\@ensure@RTL{منسلک}}%
  \def\ccname{\@ensure@RTL{نقل}}%
  \def\headtoname{\@ensure@RTL{بملاحظہ}}%
  \def\proofname{\@ensure@RTL{ثبوت}}%
  \def\glossaryname{\@ensure@RTL{لغت}}%
  \def\sectionname{\@ensure@RTL{فصل}}%
}

\def\dateurdu{%
  \def\today{%
    \if@hijrical
     \Hijritoday[\@hijri@correction]%
    \else
      \@ensure@RTL{\urdunumber\day؍\space\urdugregmonth{\month}%
         \space\urdunumber\year}%
    \fi}%
}

\def\urdunumber#1{%
  \if@western@numerals
    \number#1%
  \else
    %%FIXME use farsidigits instead???
    \protect\arabicdigits{\number#1}%
  \fi}

\def\urdu@numbers{%
  \let\@latinalph\@alph%
  \let\@latinAlph\@Alph%
  \let\@alph\abjad%
  \let\@Alph\abjad%
  }

\def\nourdu@numbers{%
  \let\@alph\@latinalph%
  \let\@Alph\@latinAlph%
  }

\def\urdu@globalnumbers{%
  \let\orig@arabic\@arabic%
  \let\@arabic\urdunumber%
  % For some reason \thefootnote needs to be set separately:
  \renewcommand\thefootnote{\protect\urdunumber{\c@footnote}}%
  }

\def\nourdu@globalnumbers{
  \let\@arabic\orig@arabic%
  \renewcommand\thefootnote{\protect\number{\c@footnote}}%
  }

\def\blockextras@urdu{%
  \let\@@MakeUppercase\MakeUppercase%
  \def\MakeUppercase##1{##1}%
  }

\def\noextras@urdu{%
  \let\MakeUppercase\@@MakeUppercase%
  }

\endinput