Debian Codegraph @

texmf-dist/tex/latex/polyglossia/gloss-french.ldf

raw
1 % Language definition file (part of polyglossia v2.10 -- 2026/04/18)
2 %
3 \ProvidesFile{gloss-french.ldf}[polyglossia: module for French]
4
5 \PolyglossiaSetup{french}{%
6 bcp47=fr-FR,
7 bcp47-language=fr,
8 bcp47-region=FR,
9 bcp47-script=Latn,
10 language=French,
11 script=Latin,
12 langtag=FRA,
13 hyphennames={french,francais},
14 frenchspacing=true,
15 indentfirst=true,
16 hyphenmins={2,2},
17 }
18
19 % BCP-47 compliant aliases
20 \setlanguagealias*{french}{fr}
21 \setlanguagealias*[variant=french]{french}{fr-FR}
22 \setlanguagealias*[variant=acadian]{french}{fr-CA-u-sd-canb}
23 \setlanguagealias*[variant=canadian]{french}{fr-CA}
24 \setlanguagealias*[variant=swiss]{french}{fr-CH}
25
26 % Babel aliases
27 \setlanguagealias[variant=acadian]{french}{acadian}
28 \setlanguagealias[variant=canadian]{french}{canadien}
29
30 \def\french@variant{french}
31
32 \def\french@language{%
33 \SetupPolyglossiaLangPatterns{\french@variant}%
34 }%
35
36 \ifluatex
37 \directlua{require('polyglossia-french')}%
38 \else
39 \newXeTeXintercharclass\french@openbrackets % ( [ {
40 \newXeTeXintercharclass\french@closebrackets % ) ] }
41 \newXeTeXintercharclass\french@questionexclamation % ! ? et autres
42 \newXeTeXintercharclass\french@punctthin % ; (et :)
43 \newXeTeXintercharclass\french@punctthick % :
44 \newXeTeXintercharclass\french@punctguillstart % « ‹
45 \newXeTeXintercharclass\french@punctguillend % » ›
46 \fi
47
48 \def\xpg@unskip{\ifhmode\ifdim\lastskip>\z@\unskip\fi\fi}
49
50 % Save original footnote definition
51 % Do this at the end of the preamble to catch other
52 % packages' footnote changes (#391)
53 \AddToHook{begindocument/before}{%
54 \let\xpg@orig@makefntext\@makefntext
55 }
56
57 % name is for compatibility with babel
58 \let\french@ttfamilyORI\ttfamily
59 \DeclareRobustCommand\french@ttfamilyFB{\nofrench@punctuation\french@ttfamilyORI}
60
61 % Configuration of item labels
62 \def\french@itemi{\textemdash}
63 \def\french@itemii{\textemdash}
64 \def\french@itemiii{\textemdash}
65 \def\french@itemiv{\textemdash}
66
67 \newif\iffrench@autospacetypewriter
68 \french@autospacetypewriterfalse
69 \newif\iffrench@autospacing
70 \french@autospacingtrue
71 \newif\iffrench@frenchpart
72 \french@frenchparttrue
73 \newif\iffrench@autospaceguillemets
74 \french@autospaceguillemetstrue
75
76 \DeclareKeys[polyglossia/gloss/french]
77 {
78 variant.choice:,
79 variant / french.code =
80 {%
81 \def\french@variant{french}%
82 \SetLanguageKeys{french}{babelname=french,bcp47=fr-FR,bcp47-language=fr,bcp47-region=FR}%
83 \french@thincolonspacefalse
84 },
85 variant / canadian.code =
86 {%
87 \def\french@variant{canadien}%
88 \SetLanguageKeys{french}{babelname=canadien,bcp47=fr-CA,bcp47-language=fr,bcp47-region=CA,bcp47-extension-u=sd-caqc}%
89 \IfLanguageDefinedF{canadien}%
90 {\xpg@warning{No hyphenation patterns were loaded for "French (Canada)"\MessageBreak
91 I will use the standard patterns for French instead}%
92 \adddialect\l@canadien\l@french\relax}%
93 \french@thincolonspacefalse
94 },
95 variant / acadian.code =
96 {%
97 \def\french@variant{acadian}%
98 \SetLanguageKeys{french}{babelname=acadian,bcp47=fr-CA-u-sd-canb,bcp47-language=fr,bcp47-region=CA,bcp47-extension-u=sd-canb}%
99 \IfLanguageDefinedF{acadian}%
100 {\xpg@warning{No hyphenation patterns were loaded for "French (Canada, Acadian)"\MessageBreak
101 I will use the standard patterns for French instead}%
102 \adddialect\l@acadian\l@french\relax}%
103 \french@thincolonspacefalse
104 },
105 variant / swiss.code =
106 {%
107 \def\french@variant{swissfrench}%
108 \SetLanguageKeys{french}{babelname=french,bcp47=fr-CH,bcp47-language=fr,bcp47-region=CH}%
109 \AddDialectIfNeeded{swissfrench}{french}%
110 \french@thincolonspacetrue
111 },
112 variant.default:n = french,
113 variant/unknown.code = \xpg@warning{Unknown French variant `#1'},
114 frenchfootnote.if = french@frenchfootnote,
115 frenchfootnote.default:n = true,
116 autospacing.if = french@autospacing,
117 autospacing.default:n = true,
118 frenchpart.if = french@frenchpart,
119 frenchpart.default:n = true,
120 autospaceguillemets.if = french@autospaceguillemets,
121 autospaceguillemets.default:n = true,
122 thincolonspace.if = french@thincolonspace,
123 thincolonspace.default:n = true,
124 automaticspacesaroundguillemets.meta:n = {autospaceguillemets=#1},
125 autospacetypewriter.if = french@autospacetypewriter,
126 autospacetypewriter.default:n = true,
127 originaltypewriter.meta:n = {autospacetypewriter=#1},
128 itemlabeli.store = \french@itemi,
129 itemlabelii.store = \french@itemii,
130 itemlabeliii.store = \french@itemiii,
131 itemlabeliv.store = \french@itemiv,
132 frenchitemlabels.if = french@frenchitemlabels,
133 frenchitemlabels.default:n = true,
134 itemlabels.code =
135 \def\french@itemi{#1}%
136 \def\french@itemii{#1}%
137 \def\french@itemiii{#1}%
138 \def\french@itemiv{#1},
139 itemlabels.default:n = \textemdash
140 }
141
142 % Register default options
143 \InitializeGlossOptions{french}{variant=french,autospacing=true,thincolonspace=false,
144 autospaceguillemets=true,autospacetypewriter=false,
145 frenchfootnote=false,frenchitemlabels=false,
146 itemlabels=\textemdash,itemlabeli=\textemdash,itemlabelii=\textemdash,
147 itemlabeliii=\textemdash,itemlabeliv=\textemdash}
148 % Register alias options
149 \SetLanguageAliasValues{french}{variant}{canadian,acadian}
150
151
152 \def\french@fontsetup{%
153 \unless\iffrench@autospacetypewriter
154 \let\ttfamily\french@ttfamilyFB
155 \fi
156 }
157
158
159 \def\nofrench@fontsetup{%
160 \let\ttfamily\french@ttfamilyORI
161 }
162
163 \def\xpg@french@thinsp{\kern 0.5\fontdimen2\font\nobreak\hskip\z@skip}
164
165 \def\french@punctuation{%
166 \lccode"2019="2019
167 \ifluatex
168 \iffrench@thincolonspace
169 \iffrench@autospaceguillemets
170 \directlua{polyglossia.activate_french_punct(true, true)}%
171 \else
172 \directlua{polyglossia.activate_french_punct(true, false)}%
173 \fi
174 \else
175 \iffrench@autospaceguillemets
176 \directlua{polyglossia.activate_french_punct(false, true)}%
177 \else
178 \directlua{polyglossia.activate_french_punct(false, false)}%
179 \fi
180 \fi
181 \else
182 \XeTeXinterchartokenstate=1
183 \XeTeXcharclass `\! \french@questionexclamation
184 \XeTeXcharclass `\? \french@questionexclamation
185 \XeTeXcharclass `\‼ \french@questionexclamation
186 \XeTeXcharclass `\⁇ \french@questionexclamation
187 \XeTeXcharclass `\⁈ \french@questionexclamation
188 \XeTeXcharclass `\⁉ \french@questionexclamation
189 \XeTeXcharclass `\‽ \french@questionexclamation % U+203D (interrobang)
190 \XeTeXcharclass `\; \french@punctthin
191 \iffrench@thincolonspace
192 \XeTeXcharclass `\: \french@punctthin
193 \else
194 \XeTeXcharclass `\: \french@punctthick
195 \fi
196 \XeTeXcharclass `\« \french@punctguillstart
197 \XeTeXcharclass `\» \french@punctguillend
198 \XeTeXcharclass `\‹ \french@punctguillstart
199 \XeTeXcharclass `\› \french@punctguillend
200 \XeTeXcharclass `\( \french@openbrackets
201 \XeTeXcharclass `\) \french@closebrackets
202 \XeTeXcharclass `\[ \french@openbrackets
203 \XeTeXcharclass `\] \french@closebrackets
204 \XeTeXcharclass `\{ \french@openbrackets
205 \XeTeXcharclass `\} \french@closebrackets
206 \XeTeXcharclass `\⟨ \french@openbrackets
207 \XeTeXcharclass `\⟩ \french@closebrackets
208 \XeTeXinterchartoks \z@ \french@questionexclamation = {\xpg@french@thinsp}%
209 \XeTeXinterchartoks \z@ \french@punctthin = {\xpg@french@thinsp}%
210 \XeTeXinterchartoks \z@ \french@punctthick = {\nobreakspace}%
211 \XeTeXinterchartoks \e@alloc@intercharclass@top \french@questionexclamation = {\xpg@unskip\xpg@french@thinsp}%
212 \XeTeXinterchartoks \e@alloc@intercharclass@top \french@punctthin = {\xpg@unskip\xpg@french@thinsp}%
213 \XeTeXinterchartoks \e@alloc@intercharclass@top \french@punctthick = {\xpg@unskip\nobreakspace}%
214 \iffrench@autospaceguillemets
215 \let\xpg@french@guillspace\xpg@french@thinsp%
216 \XeTeXinterchartoks \french@punctguillstart \z@ = {\xpg@french@guillspace}% "«a" -> "«\,a"
217 \XeTeXinterchartoks \french@punctguillstart \french@punctguillstart = {\xpg@french@guillspace}% "«‹" -> "«\,‹"
218 % \XeTeXinterchartoks \z@ \french@punctguillstart = {\nobreakspace}% "a«" unchanged?
219 % \XeTeXinterchartoks \french@punctguillend \z@ = {\nobreakspace}% "»a" unchanged?
220 \XeTeXinterchartoks \z@ \french@punctguillend = {\xpg@french@guillspace}% "a»" -> "a\,»"
221 \XeTeXinterchartoks \french@punctguillstart \e@alloc@intercharclass@top = {\xpg@french@guillspace\ignorespaces}% "« " -> "«\,"
222 \XeTeXinterchartoks \e@alloc@intercharclass@top \french@punctguillend = {\xpg@unskip\xpg@french@guillspace}% " »" -> "\,»"
223 \XeTeXinterchartoks \french@closebrackets \french@punctguillend = {\xpg@french@guillspace}% ")»" -> ")\,»"
224 \XeTeXinterchartoks \french@questionexclamation \french@punctguillend = {\xpg@french@guillspace}% "?»" -> "?\,»"
225 \XeTeXinterchartoks \french@punctthin \french@punctguillend = {\xpg@french@guillspace}% ";»" -> ";\,»"
226 \XeTeXinterchartoks \french@punctguillend \french@punctguillend = {\xpg@french@guillspace}% "›»" -> "›\,»"
227 \else
228 \def\xpg@french@guillspace{}%
229 \fi
230 \XeTeXinterchartoks \french@punctguillend \french@questionexclamation = {\xpg@french@thinsp}% "»?" -> "»\,?"
231 \XeTeXinterchartoks \french@punctguillend \french@punctthin = {\xpg@french@thinsp}% "»;" -> "»\,;"
232 \XeTeXinterchartoks \french@punctguillend \french@punctthick = {\nobreakspace}% "»:" -> "» :"
233 \XeTeXinterchartoks \french@questionexclamation \french@punctthin = {\xpg@french@thinsp}% "?;" -> "?\,;"
234 \XeTeXinterchartoks \french@questionexclamation \french@punctthick = {\xpg@french@thinsp}% "?:" -> "?\,:"
235 \XeTeXinterchartoks \french@openbrackets \french@questionexclamation = {\xpg@unskip}% "(?" -> "(?" and not "( ?"
236 \XeTeXinterchartoks \french@openbrackets \french@punctthin = {\xpg@unskip}% "(;" -> "(;" and not "( ;"
237 \XeTeXinterchartoks \french@punctthin \french@closebrackets = {\xpg@unskip}% "?)" -> "?)" (code not need, just for symetry with previous one)
238 \XeTeXinterchartoks \french@closebrackets \french@punctthin = {\xpg@french@thinsp}% ")?" -> ")\,?"
239 \XeTeXinterchartoks \french@closebrackets \french@punctthick = {\nobreakspace}% "):" -> ") :"
240 \fi
241 }
242
243 \def\nofrench@punctuation{%
244 \lccode"2019=\z@
245 \ifluatex
246 \directlua{polyglossia.deactivate_french_punct()}%
247 \else
248 \XeTeXcharclass `\! \z@
249 \XeTeXcharclass `\? \z@
250 \XeTeXcharclass `\‼ \z@
251 \XeTeXcharclass `\⁇ \z@
252 \XeTeXcharclass `\⁈ \z@
253 \XeTeXcharclass `\⁉ \z@
254 \XeTeXcharclass `\‽ \z@
255 \XeTeXcharclass `\; \z@
256 \XeTeXcharclass `\: \z@
257 \XeTeXcharclass `\« \z@
258 \XeTeXcharclass `\» \z@
259 \XeTeXcharclass `\‹ \z@
260 \XeTeXcharclass `\› \z@
261 \XeTeXcharclass `\( \z@
262 \XeTeXcharclass `\) \z@
263 \XeTeXcharclass `\[ \z@
264 \XeTeXcharclass `\] \z@
265 \XeTeXcharclass `\{ \z@
266 \XeTeXcharclass `\} \z@
267 \XeTeXcharclass `\⟨ \z@
268 \XeTeXcharclass `\⟩ \z@
269 \XeTeXinterchartokenstate=0
270 \fi
271 }
272
273 \def\captionsfrench{%
274 \def\refname{Références}%
275 \def\abstractname{Résumé}%
276 \def\bibname{Bibliographie}%
277 \def\prefacename{Préface}%
278 \def\chaptername{Chapitre}%
279 \def\appendixname{Annexe}%
280 \def\contentsname{Table des matières}%
281 \def\listfigurename{Table des figures}%
282 \def\listtablename{Liste des tableaux}%
283 \def\indexname{Index}%
284 \def\figurename{\textsc{Fig.}}%
285 \def\tablename{\textsc{Tab.}}%
286 \iffrench@frenchpart
287 \def\partname{partie}%
288 \else
289 \def\partname{Partie}%
290 \fi%
291 \def\pagename{page}%
292 \def\seename{voir}%
293 \def\alsoname{voir aussi}%
294 \def\enclname{P.~J. }%
295 \def\ccname{Copie à }%
296 \def\headtoname{}%
297 \def\proofname{Démonstration}%
298 }
299
300 \def\datefrench{%
301 \def\today{\ifx\ier\undefined\def\ier{er}\fi
302 \ifnum\day=1\relax 1\ier%
303 \else \number\day\fi
304 \space \ifcase\month%
305 \or janvier\or février\or mars\or avril\or mai\or juin\or
306 juillet\or août\or septembre\or octobre\or novembre\or
307 décembre\fi
308 \space \number\year}}
309
310 \def\xpg@french@part{\ifcase\value{part}\or Première\or Deuxième\or%
311 Troisième\or Quatrième\or Cinquième\or Sixième\or%
312 Septième\or Huitième\or Neuvième\or Dixième\or Onzième\or%
313 Douzième\or Treizième\or Quatorzième\or Quinzième\or%
314 Seizième\or Dix-septième\or Dix-huitième\or Dix-neuvième\or%
315 Vingtième\fi}%
316
317 \def\french@capsformat{%
318 % Change part heading
319 % With titlesec
320 \@ifundefined{titleformat}{%
321 % With KOMA
322 \@ifundefined{sectionformat}{%
323 % With memoir
324 \@ifundefined{@memptsize}{% (not \ifdefined\@memptsize)
325 % With standard classes
326 \@ifundefined{NR@part}{% not hyperref
327 \@ifundefined{@part}{}{%
328 \let\xpg@save@part@format\@part%
329 \patchcmd{\@part}%
330 {\partname\nobreakspace\thepart}%
331 {\xpg@french@part\nobreakspace\partname}%
332 {}%
333 {\@ifundefined{part}{}{\xpg@warning{Failed to patch part for French}}}%
334 }% (end \ifdefined \@part)
335 }{% Hyperref
336 \let\xpg@save@part@format\NR@part%
337 \patchcmd{\NR@part}%
338 {\partname\nobreakspace\thepart}%
339 {\xpg@french@part\nobreakspace\partname}%
340 {}%
341 {\xpg@warning{Failed to patch part for French}}%
342 }% (end \ifdefined\NR@part)
343 }{%
344 \@ifundefined{NR@part}{% not hyperref
345 \@ifundefined{@part}{}{%
346 \let\xpg@save@part@format\@part%
347 \patchcmd{\@part}{\printpartname \partnamenum \printpartnum}%
348 {\partnamefont\xpg@french@part\partnamenum\printpartname}%
349 {}%
350 {\xpg@warning{Failed to patch part for French}}%
351 }%
352 }{% Hyperref (nameref)
353 \let\xpg@save@part@format\NR@part%
354 \patchcmd{\NR@part}{\printpartname \partnamenum \printpartnum}%
355 {\partnamefont\xpg@french@part\partnamenum\printpartname}%
356 {}%
357 {\xpg@warning{Failed to patch part for French}}%
358 }%
359 }% (end \ifdefined\@memptsize)
360 }{% (\ifdefined\sectionformat)
361 \@ifundefined{partformat}{}{%
362 \let\xpg@save@part@format\partformat%
363 \renewcommand{\partformat}{\xpg@french@part~\partname}%
364 }%
365 }% (end \ifdefined\sectionformat)
366 }{% (\ifdefined\titleformat)
367 \@ifundefined{NR@part}{% not hyperref
368 \@ifundefined{@part}{}{%
369 \let\xpg@save@part@format\@part%
370 \patchcmd{\@part}%
371 {\partname\nobreakspace\thepart}%
372 {\xpg@french@part\nobreakspace\partname}%
373 {}%
374 {\xpg@warning{Failed to patch part for French}}%
375 }%
376 }{% Hyperref (nameref)
377 \let\xpg@save@part@format\NR@part%
378 \patchcmd{\NR@part}%
379 {\partname\nobreakspace\thepart}%
380 {\xpg@french@part\nobreakspace\partname}%
381 {}%
382 {\xpg@warning{Failed to patch part for French}}%
383 }%
384 }% (end \ifdefined\titleformat)
385 }
386
387 \def\nofrench@capsformat{%
388 % Reset chapter and part heading
389 \@ifundefined{titleformat}{%
390 \@ifundefined{sectionformat}{%
391 % With memoir and standard classes
392 \@ifundefined{xpg@save@part@format}{}{%
393 \@ifundefined{NR@part}{%
394 \let\@part\xpg@save@part@format%
395 }{%
396 \let\NR@part\xpg@save@part@format%
397 }%
398 }%
399 }{%
400 % With KOMA
401 \@ifundefined{xpg@save@part@format}{}{%
402 \let\partformat\xpg@save@part@format
403 }%
404 }% (end \ifdefined\sectionformat)
405 }{% (\ifdefined\titleformat)
406 % With titlesec
407 \@ifundefined{xpg@save@part@format}{}{%
408 \@ifundefined{NR@part}{%
409 \let\@part\xpg@save@part@format%
410 }{%
411 \let\NR@part\xpg@save@part@format%
412 }%
413 }%
414 }% (end \ifdefined\titleformat)
415 }
416
417 \newif\if@xpg@french@footnote@set
418 \@xpg@french@footnote@setfalse
419 \def\set@french@footnote{%
420 % Set French footnote once if requested
421 \if@xpg@french@footnote@set%
422 \else%
423 \iffrench@frenchfootnote%
424 \IfMainLanguageTF{french}{%
425 \ifx\@makefntext\undefined\else%
426 \long\def\french@makefntext##1{%
427 \parindent1em \noindent\quad%
428 \ifx\@thefnmark\empty\else%
429 \@thefnmark.\space\fi ##1%
430 }%
431 \let\@makefntext\french@makefntext%
432 \fi%
433 }{\xpg@warning{Option 'frenchfootnote' only supported if French is main language!}}%
434 \else%
435 \let\@makefntext\xpg@orig@makefntext%
436 \fi%
437 \@xpg@french@footnote@settrue%
438 \fi%
439 }
440
441 \newif\if@xpg@french@itemlabels@set
442 \@xpg@french@itemlabels@setfalse
443 \def\set@french@itemlabels{%
444 % Set French itemlabels once if requested
445 \if@xpg@french@itemlabels@set%
446 \else%
447 \iffrench@frenchitemlabels
448 \IfMainLanguageTF{french}{%
449 \renewcommand{\labelitemi}{\french@itemi}%
450 \renewcommand{\labelitemii}{\french@itemii}%
451 \renewcommand{\labelitemiii}{\french@itemiii}%
452 \renewcommand{\labelitemiv}{\french@itemiv}%
453 }{\xpg@warning{Option 'frenchitemlabels' only supported if French is main language!}}%
454 \fi
455 \@xpg@french@itemlabels@settrue%
456 \fi%
457 }
458
459 \def\noextras@french{%
460 \nofrench@punctuation%
461 \nofrench@fontsetup%
462 \nofrench@capsformat%
463 }
464
465 \def\blockextras@french{%
466 % Set French itemlabels and footnote,
467 % if so requested, once in the document body
468 \ifx\@onlypreamble\@notprerr%
469 \set@french@footnote%
470 \set@french@itemlabels%
471 \fi%
472 \iffrench@autospacing%
473 \french@punctuation%
474 \fi%
475 \french@fontsetup%
476 \iffrench@frenchpart%
477 \french@capsformat%
478 \fi%
479 }
480
481 \def\inlineextras@french{%
482 \iffrench@autospacing
483 \french@punctuation%
484 \fi
485 \french@fontsetup%
486 }
487
488 \def\NoAutoSpacing{%
489 \nofrench@punctuation%
490 }
491
492 \def\AutoSpacing{%
493 \french@punctuation%
494 }
495
496 \def\ier{\textsuperscript{er}}
497 \def\iers{\textsuperscript{ers}}
498 \def\iere{\textsuperscript{re}}
499 \def\ieres{\textsuperscript{res}}
500 \def\ieme{\textsuperscript{e}}
501 \def\iemes{\textsuperscript{es}}
502 \def\nd{\textsuperscript{nd}}
503 \def\nds{\textsuperscript{nds}}
504 \def\nde{\textsuperscript{nde}}
505 \def\ndes{\textsuperscript{ndes}}
506 \def\no{\textsuperscript{o}}
507 \def\nos{\textsuperscript{os}}
508
509 \def\mme{M\textsuperscript{me}\space}
510 \def\mmes{M\textsuperscript{mes}\space}
511 \def\mr{M.\space}
512 \def\mrs{MM.\space}
513
514 \endinput