summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/polyglossia/gloss-english.ldf
blob: 87da24e5e2135d36dd9739d35af50bd4aaacfb30 (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
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
% Language definition file (part of polyglossia v2.1 -- 2024/03/07)
%
\ProvidesFile{gloss-english.ldf}[polyglossia: module for English]

\PolyglossiaSetup{english}{
  bcp47=en-US,
  bcp47-language=en,
  bcp47-region=US,
  bcp47-script=Latn,
  hyphennames={english,american,usenglish,USenglish},
  hyphenmins={2,3},
  langtag=ENG,
  fontsetup=true,
  babelname=english
}

% BCP-47 compliant aliases
\setlanguagealias*{english}{en}
\setlanguagealias*[variant=australian]{english}{en-AU}
\setlanguagealias*[variant=canadian]{english}{en-CA}
\setlanguagealias*[variant=british]{english}{en-GB}
\setlanguagealias*[variant=newzealand]{english}{en-NZ}
\setlanguagealias*[variant=us]{english}{en-US}


% Babel aliases
\setlanguagealias[variant=us]{english}{american}
\setlanguagealias[variant=australian]{english}{australian}
\setlanguagealias[variant=british]{english}{british}
\setlanguagealias[variant=canadian]{english}{canadian}
\setlanguagealias[variant=newzealand]{english}{newzealand}

\providebool{british@hyphen}
\providebool{english@ordinalmonthday}
\providebool{british@dateformat}

% US English (\l@english) is default
% Initialize its settings
\def\english@variant{english}
\british@hyphenfalse
\english@ordinalmonthdayfalse
\british@dateformatfalse

% Option ordinalmonthday
\define@boolkey{english}[english@]{ordinalmonthday}[true]{}

\define@choicekey*+{english}{variant}[\xpg@val\xpg@nr]{uk,british,us,american,usmax,australian,newzealand,canadian}[us]{%
   \ifcase\xpg@nr\relax
      % uk:
      \british@hyphentrue
      \british@dateformattrue
      \english@ordinalmonthdaytrue
      \SetLanguageKeys{english}{babelname=british,bcp47=en-GB,bcp47-language=en,bcp47-region=GB}%
      \xpg@info{Option: English, variant=british}%
   \or
      % british:
      \british@hyphentrue
      \british@dateformattrue
      \english@ordinalmonthdaytrue
      \SetLanguageKeys{english}{babelname=british,bcp47=en-GB,bcp47-language=en,bcp47-region=GB}%
      \xpg@info{Option: english variant=british}%
   \or
      % us:
      \british@hyphenfalse
      \british@dateformatfalse
      \english@ordinalmonthdayfalse
      \SetLanguageKeys{english}{babelname=american,bcp47=en-US,bcp47-language=en,bcp47-region=US}%
      \xpg@info{Option: English, variant=american}%
   \or
      % american:
      \british@hyphenfalse
      \british@dateformatfalse
      \english@ordinalmonthdayfalse
      \SetLanguageKeys{english}{babelname=american,bcp47=en-US,bcp47-language=en,bcp47-region=US}%
      \xpg@info{Option: English, variant=american}%
   \or
      % usmax:
      \british@hyphenfalse
      \british@dateformatfalse
      \english@ordinalmonthdayfalse
      \SetLanguageKeys{english}{babelname=american,bcp47=en-US,bcp47-language=en,bcp47-region=US}%
      \xpg@info{Option: english variant=american (with additional patterns)}%
      \xpg@ifdefined{usenglishmax}{}%
         {\xpg@warning{No hyphenation patterns were loaded for "US English Max"\MessageBreak
                       I will use the standard patterns for US English instead}%
          \adddialect\l@usenglishmax\l@english\relax%
         }%
      \def\english@variant{usenglishmax}%
   \or
      % australian:
      % These use the british hyphenation patterns
      % but date formats without ordinals
      \british@hyphentrue
      \british@dateformattrue
      \english@ordinalmonthdayfalse
      \SetLanguageKeys{english}{babelname=australian,bcp47=en-AU,bcp47-language=en,bcp47-region=AU}%
      \xpg@info{Option: English, variant=australian}%
      \adddialect\l@australian\l@english%
   \or
      % newzealand:
      % These use the british hyphenation patterns
      % but date formats without ordinals
      \british@hyphentrue
      \british@dateformattrue
      \english@ordinalmonthdayfalse
      \SetLanguageKeys{english}{babelname=newzealand,bcp47=en-NZ,bcp47-language=en,bcp47-region=NZ}%
      \xpg@info{Option: English, variant=newzealand}%
      \adddialect\l@newzealand\l@english%
   \or
      % canadian:
      % This is currently equivalent to usenglish (as in babel)
      \british@hyphenfalse
      \british@dateformatfalse
      \english@ordinalmonthdayfalse
      \SetLanguageKeys{english}{babelname=canadian,bcp47=en-CA,bcp47-language=en,bcp47-region=CA}%
      \xpg@info{Option: English, variant=american}%
      \adddialect\l@canadian\l@english%
   \fi
   \ifbritish@hyphen
      \xpg@ifdefined{ukenglish}{}%
         {\xpg@warning{No hyphenation patterns were loaded for British English\MessageBreak
                       I will use the patterns for US English instead}%
          \adddialect\l@ukenglish\l@english\relax%
         }%
      \def\english@variant{ukenglish}%
   \fi
}{\xpg@warning{Unknown English variant `#1'}}

% Register default options
\xpg@initialize@gloss@options{english}{variant=us,ordinalmonthday=false}
% Register alias options
\xpg@set@alias@values{english}{variant}{us}{american}
\xpg@set@alias@values{english}{variant}{uk}{british}

\ifxetex
   % Check if \l@english is defined. If not, try to set it to some variety
   % (specific order as in the csv list below), or null language if everything fails
   \xpg@ifdefined{english}{}{%
      \def\do##1{%
         \xpg@ifdefined{#1}%
            {\csletcs{l@english}{l@#1}\listbreak}%
            {%
               \xpg@warning{No hyphenation patterns for English found"\MessageBreak
                            I will use the 'null' language instead}%
               \adddialect\l@english0
            }%
      }%
      \docsvlist{british, american, usenglishmax, australian, newzealand}
      \xpg@ifdefined{english}{}{}
   }%
\fi

\def\english@language{%
   \polyglossia@setup@language@patterns{\english@variant}%
}%

\def\captionsenglish{%
   \def\prefacename{Preface}%
   \def\refname{References}%
   \def\abstractname{Abstract}%
   \def\bibname{Bibliography}%
   \def\chaptername{Chapter}%
   \def\appendixname{Appendix}%
   \def\contentsname{Contents}%
   \def\listfigurename{List of Figures}%
   \def\listtablename{List of Tables}%
   \def\indexname{Index}%
   \def\figurename{Figure}%
   \def\tablename{Table}%
   \def\partname{Part}%
   \def\enclname{encl}%
   \def\ccname{cc}%
   \def\headtoname{To}%
   \def\pagename{Page}%
   \def\seename{see}%
   \def\alsoname{see also}%
   \def\proofname{Proof}%
}

\def\dateenglish{%
   \def\english@day{%
     \ifenglish@ordinalmonthday
       \ifcase\day\or
        1st\or 2nd\or 3rd\or 4th\or 5th\or
        6th\or 7th\or 8th\or 9th\or 10th\or
        11th\or 12th\or 13th\or 14th\or 15th\or
        16th\or 17th\or 18th\or 19th\or 20th\or
        21st\or 22nd\or 23rd\or 24th\or 25th\or
        26th\or 27th\or 28th\or 29th\or 30th\or
        31st\fi
     \else\number\day\fi}%
     \def\english@month{\ifcase\month\or
      January\or February\or March\or April\or May\or June\or
      July\or August\or September\or October\or November\or December\fi}%
   \def\today{%
    \ifbritish@dateformat
      \english@day\space\english@month\space\number\year
    \else
      \english@month\space\english@day,\space\number\year
    \fi}%
}

\endinput