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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
|
% Language definition file (part of polyglossia v2.2 -- 2024/07/15)
%
\ProvidesFile{gloss-uyghur.ldf}[polyglossia: module for Uyghur]
%% Translations provided by Osman Tursun (Github Account: neouyghur)
\RequireBidi
\PolyglossiaSetup{uyghur}{
bcp47=ug,
bcp47-language=ug,
bcp47-script=Arab,
script=Arabic,
direction=RL,
scripttag=arab,
langtag=UYG,
hyphennames={nohyphenation},
fontsetup=true,
}
% BCP-47 compliant aliases
\setlanguagealias*{uyghur}{ug}
\newif\if@uyghur@swapcaptions
\newif\if@uyghur@swapheadings
\newif\if@uyghur@swapheaders
\newif\if@uyghur@ordchapter
\newif\if@uyghur@romchapter
\DeclareKeys[polyglossia/gloss/uyghur]
{
chapterformat.choice:,
chapterformat / ordinal.code =
{%
\@uyghur@ordchaptertrue
\@uyghur@romchapterfalse
},
chapterformat / roman.code =
{%
\@uyghur@ordchapterfalse
\@uyghur@romchaptertrue
},
chapterformat / arabic.code =
{%
\@uyghur@ordchapterfalse
\@uyghur@romchapterfalse
},
chapterformat.default:n = ordinal,
chapterformat/unknown.code = \xpg@warning{Unknown Uyghur chapterformat value `#1'},
swapstrings.choice:,
swapstrings / all.code =
{%
\@uyghur@swapcaptionstrue
\@uyghur@swapheadingstrue
\@uyghur@swapheaderstrue
},
swapstrings / captions.code =
{%
\@uyghur@swapcaptionstrue
\@uyghur@swapheadingsfalse
\@uyghur@swapheadersfalse
},
swapstrings / headings.code =
{%
\@uyghur@swapcaptionsfalse
\@uyghur@swapheadingstrue
\@uyghur@swapheadersfalse
},
swapstrings / headers.code =
{%
\@uyghur@swapcaptionsfalse
\@uyghur@swapheadingsfalse
\@uyghur@swapheaderstrue
},
swapstrings / hheaders.code =
{%
\@uyghur@swapcaptionsfalse
\@uyghur@swapheadingstrue
\@uyghur@swapheaderstrue
},
swapstrings / none.code =
{%
\@uyghur@swapcaptionsfalse
\@uyghur@swapheadingsfalse
\@uyghur@swapheadersfalse
},
swapstrings.default:n = all,
swapstrings/unknown.code = \xpg@warning{Unknown Uyghur swapstrings value `#1'}
}
% Register default options
\InitializeGlossOptions{uyghur}{swapstrings=all,chapterformat=ordinal}
\def\captionsuyghur{%
\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\subjectname{\@ensure@RTL{تېما}}%
}
% Save original capsformats
\let\xpg@save@fnum@table\fnum@table
\let\xpg@save@fnum@figure\fnum@figure
\def\uyghur@capsformat{%
%
% Change captions
\if@uyghur@swapcaptions
% change 'x.x ﺭﻩﺳﯩﻢ' to 'ﺭﻩﺳﯩﻢ-x.x'
\def\fnum@figure{\thefigure-\figurename}
%
% same for table
\def\fnum@table{\thetable-\tablename}
\fi
%
% change chapter and part headings
\if@uyghur@swapheadings
% With titlesec
\@ifundefined{titleformat}{%
% With KOMA
\@ifundefined{sectionformat}{%
% With memoir
\@ifundefined{@memptsize}{%
% With standard classes
\@ifundefined{@makechapterhead}{}{%
\let\xpg@save@chap@format\@makechapterhead%
\patchcmd{\@makechapterhead}%
{\@chapapp\space \thechapter}%
{\the@uyghur@chapter\space \@chapapp}%
{}%
{\xpg@warning{Failed to patch chapter for Uyghur}}%
}%
\@ifundefined{H@old@part}{% not hyperref
\@ifundefined{@part}{}{%
\let\xpg@save@part@format\@part%
\patchcmd{\@part}%
{\partname\nobreakspace\thepart}%
{\the@uyghur@part\nobreakspace\partname}%
{}%
{\@ifundefined{part}{}{\xpg@warning{Failed to patch part for Uyghur}}}%
}% (end \ifdefined\@part)
}{% Hyperref
\let\xpg@save@part@format\H@old@part%
\patchcmd{\H@old@part}%
{\partname\nobreakspace\thepart}%
{\the@uyghur@part\nobreakspace\partname}%
{}%
{\xpg@warning{Failed to patch part for Uyghur}}%
}% (end not hyperref)
}{% (\ifdefined\@memptsize)
\@ifundefined{@makechapterhead}{}{%
\let\xpg@save@chap@format\@makechapterhead%
\patchcmd{\@makechapterhead}{\printchaptername \chapternamenum \printchapternum}%
{\chapnumfont\the@uyghur@chapter\chapternamenum\printchaptername}%
{}%
{\xpg@warning{Failed to patch chapter for Uyghur}}%
}%
\@ifundefined{H@old@part}{% not hyperref
\@ifundefined{@part}{}{%
\let\xpg@save@part@format\@part%
\patchcmd{\@part}{\printpartname \partnamenum \printpartnum}%
{\chapnumfont\the@uyghur@part\partnamenum\printpartname}%
{}%
{\xpg@warning{Failed to patch part for Uyghur}}%
}%
}{% Hyperref
\let\xpg@save@part@format\H@old@part%
\patchcmd{\H@old@part}{\printpartname \partnamenum \printpartnum}%
{\chapnumfont\the@uyghur@part\partnamenum\printpartname}%
{}%
{\xpg@warning{Failed to patch part for Uyghur}}%
}%
}% (end \ifdefined\@memptsize)
}{% (\ifdefined\sectionformat)
\@ifundefined{partformat}{}{%
\let\xpg@save@part@format\partformat%
\renewcommand{\partformat}{\the@uyghur@part~\partname}%
}%
\@ifundefined{chapterformat}{}{%
\let\xpg@save@chap@format\chapterformat%
\renewcommand{\chapterformat}{\mbox{\the@uyghur@chapter%
\IfUsePrefixLine{\nobreakspace\chapapp}{\enskip}}}%
}%
}% (end \ifdefined\sectionformat)
}{% (\ifdefined\titleformat)
\@ifundefined{H@old@part}{% not hyperref
\@ifundefined{@part}{}{%
\let\xpg@save@part@format\@part%
\patchcmd{\@part}%
{\partname\nobreakspace\thepart}%
{\the@uyghur@part\nobreakspace\partname}%
{}%
{\xpg@warning{Failed to patch part for Uyghur}}%
}%
}{% Hyperref
\let\xpg@save@part@format\H@old@part%
\patchcmd{\H@old@part}%
{\partname\nobreakspace\thepart}%
{\the@uyghur@part\nobreakspace\partname}%
{}%
{\xpg@warning{Failed to patch part for Uyghur}}%
}%
\@ifundefined{chapter}{}{%
\titleformat\chapter[display]%
{\@ifundefined{ttl@fil}{\raggedright}{\ttl@fil}\ttl@fonts\ttl@sizes6}
{\the@uyghur@chapter\space\@chapapp}{.8\baselineskip}{\ttl@sizes\z@\ttl@passexplicit}
}%
}% (end \ifdefined\titleformat)
\fi% (end \if@uyghur@swapheadings)
%
% Change running headers
\if@uyghur@swapheaders
\@ifundefined{chapterformat}{%
\@ifundefined{@memptsize}{%
% With standard classes
\@ifundefined{chaptermark}{}{%
\ifpatchable{\chaptermark}%
{\@chapapp\ \thechapter.}%
{\let\xpg@save@chaptermark@format\chaptermark%
\patchcmd{\chaptermark}%
{\@chapapp\ \thechapter.}%
{\the@uyghur@chapter\ \@chapapp}%
{}%
{\xpg@warning{Failed to patch chaptermark for Uyghur}}}%
{}%
}% (end \ifdefined\sectionmark)
\@ifundefined{sectionmark}{}{%
\ifpatchable{\sectionmark}%
{\thesection.}%
{\let\xpg@save@sectionmark@format\sectionmark%
\patchcmd{\sectionmark}%
{\thesection.}%
{\thesection}%
{}%
{\xpg@warning{Failed to patch sectionmark for Uyghur}}%
}%
{}%
}% (end \ifdefined\chaptermark)
}{% (\ifdefined\@memptsize)
% With memoir
\let\xpg@save@chaptermark@format\chaptermark%
\renewcommand*\chaptermark[1]{%
\markboth{\memUChead{%
\ifnum \c@secnumdepth >\m@ne
\ifbool{@mainmatter}{%
\the@uyghur@chapter\ \@chapapp\ %
}{}%
\fi
##1}}{}}%
}% (end \ifdefined\@memptsize)
}{% (\ifdefined\chapterformat)
% With KOMA
\let\xpg@save@chaptermark@format\chaptermarkformat%
\renewcommand*\chaptermarkformat{%
\the@uyghur@chapter\ \IfChapterUsesPrefixLine{\chapapp\enskip}{}}
}% (end \ifdefined\chapterformat)
\fi% (end \if@uyghur@swapheaders)
}
\def\nouyghur@capsformat{%
%
% Reset changes of \uyghur@capsformat
\let\fnum@table\xpg@save@fnum@table%
\let\fnum@figure\xpg@save@fnum@figure%
%
% Reset chapter and part heading
\@ifundefined{titleformat}{%
\@ifundefined{sectionformat}{%
% With memoir and standard classes
\@ifundefined{xpg@save@part@format}{}{%
\@ifundefined{H@old@part}{%
\let\@part\xpg@save@part@format%
}{%
\let\H@old@part\xpg@save@part@format%
}%
}%
\@ifundefined{xpg@save@chap@format}{}{%
\let\@makechapterhead\xpg@save@chap@format
}%
}{%
% With KOMA
\@ifundefined{xpg@save@part@format}{}{%
\let\partformat\xpg@save@part@format
}%
\@ifundefined{xpg@save@chap@format}{}{%
\let\chapterformat\xpg@save@chap@format
}%
}% (end \ifdefined\sectionformat)
}{% (\ifdefined\titleformat)
% With titlesec
\@ifundefined{xpg@save@part@format}{}{%
\@ifundefined{H@old@part}{%
\let\@part\xpg@save@part@format%
}{%
\let\H@old@part\xpg@save@part@format%
}%
}%
\@ifundefined{chapter}{}{%
\titleformat\chapter[display]%
{\@ifundefined{ttl@fil}{\raggedright}{\ttl@fil}\ttl@fonts\ttl@sizes6}
{\@chapapp\space\thechapter}{.8\baselineskip}{\ttl@sizes\z@\ttl@passexplicit}
}%
}% (end \ifdefined\titleformat)
%
% Reset headers
\@ifundefined{chaptermarkformat}{%
\@ifundefined{chaptermark}{}{%
% With memoir and standard classes
\@ifundefined{xpg@save@chaptermark@format}{}{%
\let\chaptermark\xpg@save@chaptermark@format%
}%
}% (end \ifdefined\chaptermark)
\@ifundefined{sectionmark}{}{%
\@ifundefined{xpg@save@sectionmark@format}{}{%
\let\sectionmark\xpg@save@sectionmark@format%
}%
}% (end \ifdefined\sectionmark)
}{%
% With KOMA
\@ifundefined{xpg@save@chaptermark@format}{}{%
\let\chaptermarkformat\xpg@save@chaptermark@format%
}%
}% (end \ifdefined\chapterformat)
}
\def\blockextras@uyghur{%
\uyghur@capsformat%
}
\def\noextras@uyghur{%
\nouyghur@capsformat%
}
\ifxetex
\let\xpg@orig@DigitsDotDashInterCharToks\DigitsDotDashInterCharToks%
\fi
\def\uyghur@ltr@numbers{%
\ifxetex
% Bidi inserts an RTL mark (0x200f) between number and number separator (- .),
% forcing numbers to RTL. This is wrong for Uyghur, where numbers are left to right.
% So we defunc the respective command.
\renewcommand*{\DigitsDotDashInterCharToks}{}%
\fi%
}
\def\nouyghur@ltr@numbers{%
\ifxetex
% Restore bidi's \DigitsDotDashInterCharToks
\let\DigitsDotDashInterCharToks\xpg@orig@DigitsDotDashInterCharToks%
\fi%
}
\let\the@uyghur@part\thepart
\let\the@uyghur@chapter\thechapter
\def\uyghur@chapterformat{%
\@ifundefined{part}{}{%
\if@uyghur@ordchapter%
\renewcommand{\the@uyghur@part}{\uyghurord{part}}%
\fi%
\if@uyghur@romchapter%
\renewcommand{\the@uyghur@part}{\Roman{part}}%
\fi%
}%
\@ifundefined{chapter}{}{%
\if@uyghur@ordchapter%
\renewcommand{\the@uyghur@chapter}{\uyghurord{chapter}}%
\fi%
\if@uyghur@romchapter%
\renewcommand{\the@uyghur@chapter}{\Roman{chapter}}%
\fi%
}%
}
\def\uyghur@numbers{%
% Prevent bidi from setting the numbers RTL
\uyghur@ltr@numbers%
% Format chapter and part
\uyghur@chapterformat%
}
\def\nouyghur@numbers{%
% Restore previous bidi numbers definition
\nouyghur@ltr@numbers
}
\def\uyghur@globalnumbers{%
% Prevent bidi from setting the numbers RTL
\uyghur@ltr@numbers%
% Format chapter and part
\uyghur@chapterformat%
}
\def\uyghurmonth#1{\ifcase#1%
\or يانۋار\or فېۋرال\or مارت\or ئاپرېل\or ماي\or ئىيۇن
\or ئىيۇل\or ئاۋغۇست\or سېنتەبىر\or ئۆكتەبىر\or نويابىر\or دېكابىر\fi}
\def\dateuyghur{%
\def\today{\number\year-يىلى\space\number\day-\uyghurmonth{\month}}%
}
\def\uyghurord#1{\expandafter\uyghurordinal\csname c@#1\endcsname}
% Ordinals 1--100
\def\uyghurordinal#1{\ifcase#1%
\or بىرىنچى\or ئىككىنچى\or ئۈچىنچى\or تۆتىنچى\or بەشىنچى\or ئالتىنچى\or يەتتىنچى\or سەككىزىنچى
\or توققۇزىنچى\or ئونىنچى\or ئون بىرىنچى\or ئون ئىككىنچى\or ئون ئۈچىنچى\or ئون تۆتىنچى\or ئون بەشىنچى
\or ئون ئالتىنچى\or ئون يەتتىنچى\or ئون سەككىزىنچى\or ئون توققۇزىنچى\or يىگىرمىنچى\or يىگىرمە بىرىنچى
\or يىگىرمە ئىككىنچى\or يىگىرمە ئۈچىنچى\or يىگىرمە تۆتىنچى\or يىگىرمە بەشىنچى\or يىگىرمە ئالتىنچى
\or يىگىرمە يەتتىنچى\or يىگىرمە سەككىزىنچى\or يىگىرمە توققۇزىنچى\or ئوتتۇزىنچى\or ئوتتۇز بىرىنچى
\or ئوتتۇز ئىككىنچى\or ئوتتۇز ئۈچىنچى\or ئوتتۇز تۆتىنچى\or ئوتتۇز بەشىنچى\or ئوتتۇز ئالتىنچى\or ئوتتۇز يەتتىنچى
\or ئوتتۇز سەككىزىنچى\or ئوتتۇز توققۇزىنچى\or قىرىقىنچى\or قىرىق بىرىنچى\or قىرىق ئىككىنچى\or قىرىق ئۈچىنچى
\or قىرىق تۆتىنچى\or قىرىق بەشىنچى\or قىرىق ئالتىنچى\or قىرىق يەتتىنچى\or قىرىق سەككىزىنچى\or قىرىق توققۇزىنچى
\or ئەللىكىنچى\or ئەللىك بىرىنچى\or ئەللىك ئىككىنچى\or ئەللىك ئۈچىنچى\or ئەللىك تۆتىنچى\or ئەللىك بەشىنچى
\or ئەللىك ئالتىنچى\or ئەللىك يەتتىنچى\or ئەللىك سەككىزىنچى\or ئەللىك توققۇزىنچى\or ئاتمىشىنچى\or ئاتمىش بىرىنچى
\or ئاتمىش ئىككىنچى\or ئاتمىش ئۈچىنچى\or ئاتمىش تۆتىنچى\or ئاتمىش بەشىنچى\or ئاتمىش ئالتىنچى\or ئاتمىش يەتتىنچى
\or ئاتمىش سەككىزىنچى\or ئاتمىش توققۇزىنچى\or يەتمىشىنچى\or يەتمىش بىرىنچى\or يەتمىش ئىككىنچى\or يەتمىش ئۈچىنچى
\or يەتمىش تۆتىنچى\or يەتمىش بەشىنچى\or يەتمىش ئالتىنچى\or يەتمىش يەتتىنچى\or يەتمىش سەككىزىنچى\or يەتمىش توققۇزىنچى
\or سەكسىنىنچى\or سەكسەن بىرىنچى\or سەكسەن ئىككىنچى\or سەكسەن ئۈچىنچى\or سەكسەن تۆتىنچى\or سەكسەن بەشىنچى
\or سەكسەن ئالتىنچى\or سەكسەن يەتتىنچى\or سەكسەن سەككىزىنچى\or سەكسەن توققۇزىنچى\or توقسىنىنچى\or توقسان بىرىنچى
\or توقسان ئىككىنچى\or توقسان ئۈچىنچى\or توقسان تۆتىنچى\or توقسان بەشىنچى\or توقسان ئالتىنچى\or توقسان يەتتىنچى
\or توقسان سەككىزىنچى\or توقسان توققۇزىنچى\or يۈزىنچى\fi}
\endinput
|