I have been meditating about the three hyphenation variants and the various language variants concerning Latin (the same approach might be used with Greek when typesetting with XeLaTeX and LuaLaTeX).

I have written three different language description files that allow both XeLaTeX and LuaLaTeX to handle such variants as independent languages, so as to be able to use the three of them in the same document.

Actually the gloss-latin.ldf handles variant spelling and hyphenation the same as done with pdfLaTeX, with which things are different also because it handles only 8-bit encoded glyphs, but it can be used also to use one variant, say modern, or medieval, and call classic or liturgical as different lannguages.

Thesrefore the situation is as such:
1) with pdfLaTeX and Babel things go on their way without involving XeLaTeX or LuaLaTeX. 2) with XeLaTeX and LuaLaTeX and polyglossia modern o medieval, and classic and liturgical can be used as three independent languages. 3) with XeLaTeX only it is possible to use the language description file gloss-latin.ldf and its variants the same as with pdfLaTeX.

Therefore by running pdfLaTeX on the attached dtx file you get three language description files:
gloss-latin.ldf
gloss-classiclatin.ldf
gloss-liturgicallatin.ldf

and the documentation file gloss-latin.pdf.

Arthur, if you are not interested in the documentation you can throw away the pdf file; when things are done you might even chose to throw away also the .dtx file. But some short parts of the text contained in this .dtx file may be used to write the subsection concerning Latin in the polyglossia documentation source file.

As for what concerns the availability of these .ldf files in the TeXLive distribution (and therefore in the MiKTeX one), I assume that everything will be done *before* the 2017 distribution.

I will maintain my silence until then; then I will possibly give up the maintenance of the gloss-*latin.ldf files if my contribution is ignored. I do not require that it is immediately processed and made available to the whole "universe" of people needing to write in Latin. I am nobody; not even a latinist, therefore my contribution might be of no value for professional latinists. And if things are such, there is no scope that I keep using my time and my experience for updating Latin patterns and Latin description files.

Of course, if before 2017 you or anybody else finds that something should be changed or corrected, I am still available.

Apostolos Syropoulos is included as Cc. He might suggest to use a similar approach for Greek; at the moment the only gloss-greek.ldf language definition file works correctly only with XeLaTeX. I know he is not enthusiast of LuaLaTeX, but he might change his mind when he discovers the typesetting properties of LuaLaTeX, in particular the full power with microtype, that with XeLaTeX can be used only for protrusion and not for character expansion. Another feature is that LuaLaTeX can directly produce PDF/A-compliant long term archivable documents, while at the moment with XeLaTeX it is impossible to achieve this goal, unless some tweaking is done (the problem with XeLaTeX is that its native output is in an extended form of the DVI format: this file is piped into an extended DVI to PDF converter, that, on turn, cannot correctly do the job if file compression is desired, because the PDF/A metadata should not be compressed).

All the best
Claudio


% \iffalse meta-comment
%<*internal>
\begingroup
\input docstrip.tex
\keepsilent

\errorcontextlines=9

\preamble
  ------------------------------------------------------------------
  The Latin modules for polyglossia
  Copyright (C) 2016 Claudio Beccari
  All rights reserved
  
  Please read the postamble.
  
\endpreamble

\postamble

This work is author-maintained
The maintainer is Claudio Beccari
claudio dot beccari at gmail dot com

This file evolves from latin.dtx, the documented TeX file that produces the
latin.ldf and its documentation to be used with babel and pdfLaTeX.
With polyglossia and its use with XeLaTeX and LuaLaTeX it was necessary to 
redesign everything, especially due to the peculiarities of the Lua(La)TeX 
approach to hyphenation; in facts LuaLaTeX loads one pattern file per language 
on the fly according to the particular languages used in a specific document.
This forces to define three different languages, instead of variants of the 
same language (not impossible, but...)
\endpostamble

\askforoverwritefalse

\generate{\file{gloss-latin.ldf}{\from{gloss-latin.dtx}{lacode}}
          \file{gloss-classiclatin.ldf}{\from{gloss-latin.dtx}{laclassic}}
          \file{gloss-liturgicallatin.ldf}{\from{gloss-latin.dtx}{laliturgic}}}

\def\tmpa{plain}
\ifx\tmpa\fmtname\endgroup\expandafter\bye\fi
\endgroup
%
%</internal>
%
%
% \fi
% \CheckSum{984}
% \iffalse
%    Tell the \LaTeX\ system who we are and write an entry on the
%    transcript.
%<lacode>\ProvidesFile{gloss-latin.ldf}
%<laclassic>\ProvidesFile{gloss-classiclatin.ldf}
%<laliturgic>\ProvidesFile{gloss-liturgiclatin.ldf}
%<*driver>
\ProvidesFile{gloss-latin.dtx}
%</driver>
%<*lacode,laclassic,laliturgic>
        [2016/08/24 v.1.0 Latin support from polyglossia]
%</lacode,laclassic,laliturgic>
%<*driver>
\documentclass{ltxdoc}\errorcontextlines=9
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[english]{babel}
\usepackage{multicol,booktabs}
\newcommand*\TeXhax{\TeX\-hax}
\newcommand*\babel{\textsf{babel}}
\newcommand*\langvar{{\normalfont$\langle$\textit{lang}$\rangle$}}
\newcommand*\note[1]{}
\newcommand*\Lopt[1]{\textsf{#1}}\let\opt\Lopt \let\opz\Lopt
\newcommand*\file[1]{\texttt{#1}}
\providecommand*\pkg[1]{\textsf{#1}}\let\pack\pkg
\providecommand*\prog[1]{\textsf{\slshape #1}}
%
\makeatletter
\def\GetFileInfo#1{%
  \def\filename{#1}%
  \def\@tempb##1 ##2 ##3\relax##4\relax{%
    \def\filedate{##1}%
    \def\fileversion{##2}%
    \def\fileinfo{##3}}%
  \edef\@tempa{\csname ver@#1\endcsname}%
  \expandafter\@tempb\@tempa\relax? ? \relax\relax
  \def\cleanfileversion##1v.##2!{\edef\fileversion{##2}}%
  \expandafter\cleanfileversion\fileversion!
  }
\title{Latin support for polyglossia}
\author{Claudio Beccari}
\date{Version \fileversion\ dated \filedate}

\begin{document}
\DocInput{gloss-latin.dtx}
\end{document}
%</driver>
%\fi
% \GetFileInfo{gloss-latin.dtx}
%
%
% \maketitle
%\begin{abstract}
% This file documents the three language variants for the Latin language, as 
they
% should be used with XeLaTeX and LuaLaTeX; they describe each variant as a
% different language so that even LuaTeX, that loads one pattern file for each
% language  used in a specific document, can use all the three languages
% simultaneously in a specific document  by calling them with their specific
% names.
% \end{abstract}
%\begin{multicols}{2}\columnseprule=0.4pt
%\tableofcontents
%\end{multicols}
%
%  \section{The Latin language}
%
% This file \file{\filename} defines all the
% language-specific macros for the Latin language variants that include the
% modern, the medieval, the ecclesiastic, the classic, and the liturgical ones.
%
% The language description file \texttt{gloss-latin.ldf} describes what is
% required to typeset in modern, medieval and ecclesiastic latin; the first
% variety is the one commonly used in typesetting school books, dictionaries,
% grammars, and the like; it manages also the medieval and ecclesiastic
% variants, because these variants share the same pattern file; they differ
% mainly in the character set actually used in their scripts; modern Latin
% uses only the 26 letter alphabet, commonly called Latin Alphabet; the
% medieval variant in addition uses the ligated diphthongs `æ' and `œ', but
% does not use the capital `U' and the lowercase `v', as it was customary
% in the medieval times and later on until about the XVII century; the
% ecclesiastic variant uses the full 26 letter Latin alphabet, plus the
% ligated diphthongs `æ' and `œ', but uses also the accented vowels, always
% with an acute accent, to mark the stress on the proper syllable so as to
% aid clergy coming from different countries and with different mother
% languages to pronounce all wards with the same rhythm when that attend
% collective liturgical activities; see table~\ref{tab:charsets}.
% Ecclesiastic Latin is typeset with a
% French-like style for punctuation and footnote marks, although the space
% introduced before the ``tall' punctuation marks is smaller than in French
% typography.
%
% Modern and medieval Latin are pronounced with a definite word stress;
% therefore it is possible to recognise other diphthongs beyond the traditional
% `ae' or `æ' and `oe' or `œ'. Significantly there are the ascending and
% descending diphthongs present today in most romance languages and some
% triphthongs; modern ascending diphthongs are formed with an unstressed
% closed vowel `i' or `u' followed by another vowel; descending diphthongs
% are formed with a vowel followed by an unstressed closed vowel; triphthongs
% are formed by two (different) unstressed closed vowels followed by another
% vowel (for example `quietus'), or an open vowel sandwiched between two
% unstressed closed vowels (for example `ieu' in `maieutica'); hiati may
% appear as diphthongs, but they differ in the sense that the closed vowel
% is stressed; if it is marked with an accent or with the diaeresis, the 
% hyphenation algorithm may distinguish them, but even with this capability
% good typography avoids line breaks across hiati, even if the grammar allows
% them. This is why the hyphenation algorithm avoids line breaking not only
% between the vowels that form a diphthong or a triphthong, but also between
% the vowels that form a hiatus. Clusters of more than two vowels are possibly
% divided before ascending diphthongs.
%
% This long explanation about hyphenation is to stress the difference between
% the next Latin variants, classic and liturgical.
%
%\begin{table}[!tbp]
%\centering\tabcolsep=1pt
%\begin{tabular}{*{26}c}
%a & b & c & d & e & f & g & h & i & j & k & l & m & n & o & p & q & r & s & t 
& u & v & w & x & y & z\\
%A & B & C & D & E & F & G & H & I & J & K & L & M & N & O & P & Q & R & S & T 
& U & V & W & X & Y & Z\\
%\end{tabular}
%\par\smallskip
%$(a)$: modern Latin; letters j and w are only for latinised foreign modern 
names
%\bigskip
%
%\begin{tabular}{*{25}c}
%a & æ & b & c & d & e & f & g & h & i & k & l & m & n & o & œ & p & q & r & s 
& t & u & x & y & z\\
%A & Æ & B & C & D & E & F & G & H & I & K & L & M & N & O & Œ & P & Q & R & S 
& T & V & X & Y & Z\\
%\end{tabular}
%\par\smallskip
%$(b)$ medieval Latin
%\bigskip
%
%\begin{tabular}{*{35}c}
%a & á & æ & \'\ae & b & c & d & e & é & f & g & h & i & í & j & k & l & m & n 
& o & ó & œ & \'\oe & p & q & r & s & t & u & ú & v & w & x & y & z\\
%A & Á & Æ & \'\AE & B & C & D & E & É & F & G & H & I & Í & J & K & L & M & N 
& O & Ó & Œ & \'\OE & P & Q & R & S & T & U & Ú & V & W & X & Y & Z\\
%\end{tabular}
%\par\smallskip
%$(c)$ ecclesiastic Latin; j and w are used for latinised foreign names; all 
vowels and diphthongs may be accented.
%\bigskip
%
%\begin{tabular}{*{23}c}
%a & b & c & d & e & f & g & h & i & k & l & m & n & o & p & q & r & s & t & u 
& x & y & z\\
%A & B & C & D & E & F & G & H & I & K & L & M & N & O & P & Q & R & S & T & V 
& X & Y & Z\\
%\end{tabular}
%\par\smallskip
%$(d)$ classic Latin
%\bigskip
%
%\begin{tabular}{*{35}c}
%a & á & æ & \'\ae & b & c & d & e & é & f & g & h & i & í & j & k & l & m & n 
& o & ó & œ & \'\oe & p & q & r & s & t & u & ú & v & w & x & y & z\\
%A & Á & Æ & \'\AE & B & C & D & E & É & F & G & H & I & Í & J & K & L & M & N 
& O & Ó & Œ & \'\OE & P & Q & R & S & T & U & Ú & V & W & X & Y & Z\\
%\end{tabular}
%\par\smallskip
%$(e)$ liturgical Latin; the character set is identical to the ecclesiastic 
Latin one, but hyphenation is different
%%
%\caption[Latin character sets]{Latin character sets: $(a)$ modern Latin; $(b)$ 
medieval Latin; $(c)$ ecclesiastic Latin; $(d)$ classic Latin; $(e)$ liturgical 
Latin.}\label{tab:charsets}
%\end{table}
%
% The Language description file \texttt{gloss-classiclatin.ldf} describes
% what is necessary in order to typeset (presumably philological) documents
% containing stretches of classical Latin text. Of course the hyphenation that
% is defined by the corresponding hyphenation pattern file was not used in
% classical times when not only the written texts were not hyphenated, but were
% written with the \emph{lectio continua}, i.e. without even a space between
% words.
% In the first century AD Quintilianus used to teach oratory skills to his
% students by suggesting them to separate the various phrases with some
% kind of marks; these were supposed to delimit the ``comma', the `colon'
% and the `periodus'; these names survive today in  English to denote
% certain modern punctuation marks. But no rules were given to hyphenate words.
% 
% What is actually called today ``classic Latin hyphenation'' is a set of
% rules agreed upon by scholars from different countries with different
% modern languages that try to take into account the metrics of various poems,
% the pronunciation and the etymology of each word so that prefixes and suffixes
% are divided from the word stem, as well any suffixes that do not belong to the
% declination or the conjugation of the word itself; within the word they
% try to follow a phonetic syllable division, although with different
% phonetic bases from modern languages.
%
% The classical Latin hyphenation is a practical necessity in order to
% typeset texts that are justified on both sides; its rules are totally
% artificial, in the sense that ancient Romans certainly used phonetic
% syllables while speaking, but the Latin language, well spoken by the
% orators of the republican and of the initial imperial era, probably
% did not sound as we pronounce it today, be it a scholar's speech or
% a prayer during some liturgy in christian churches. Ancient Latin had
% a melodic rhythm based on long and short vowels reasonably without
% a stress accent as we use it in most modern languages. Eventually Latin
% evolved into the romance languages where the new derived words did not
% distinguish any more between long and short vowels, but used a stress,
% generally on what remained of a long vowel. With this in mind, it is
% difficult to think about diphthongs and triphthongs in classical Latin;
% the hyphenation algorithm therefore divides clusters of more than two
% vowels before what \emph{today} we would interpret and pronounce a couple
% of vowels as a diphthong, otherwise the hyphenation algorithm divides
% between any couple  of vowels except the couples `ae' and `oe'. These
% vocalic pairs, on their side, might be real diphthongs or hiati;
% `aeris' (genitive of `aer', air) and `aeris' (genitive of `aes', bronze)
% are written the same, ma in the former case they for a hiatus, while
% in the second they for a diphthong. The hyphenation algorithm does not
% divide either pair.
%
% Classic Latin uses the full 23 letter Latin alphabet, with no ligated
% diphthongs, no `U' and no `'v; latinists pronounce the `ae' and `oe'
% diphthongs as two
% vowels, and pronunce the `u' as a vocalic /u/ or a semivowel /w/
% according to its position and  its adjacency to another vowel.
% Of course the few infix words in the language definition file must
% have a different spelling from modern ones, but what is more important,
% the hyphenation patterns are much different from the modern ones,
% as explained above.
%
%
%    The rules for classical Latin are taken from Raffaello Farina and Nino
%    Marinone's guide \emph{Metodologia} published by Societ\`a Editrice
%    Internazionale, Torino, 1979.
%    In spite of the publication date of this guide, the
%    hyphenation rules did not change in the meanwhile.
%
% The file \texttt{liturgicallatin.ldf} handles a special variant of the Latin
% language; its spelling is similar to modern latin, but it uses the ligated
% diphthongs `æ' and `œ', it uses accents even on the diphthongs, in
% particular even on `œ'; this sets forth a serious problem because \'\oe\ 
% is not defined even in the UNICODE standard; therefore it is necessary
% to use the self combining accents defined in the UNICODE
% standard as if they were normal alphabetic glyphs; unfortunately these
% self combining accents are not centred over  the `œ' glyph
% with arbitrary UNICODE-encoded fonts, so it is necessary to provide
% suitable macros to allow hyphenation in spite of their presence.
%
% The hyphenation rules are similar partly to modern Latin, and partly to
% classical Latin; therefore they involve a different set of patterns. Remember
% that liturgical Latin is used in many publications of the Roman Catholic
% Church and is the one that is actually used in writing the scores of the
% hymns, psalms and other similar texts that are sung during many liturgical
% services in monasteries and in public churches;
% therefore the hyphenations rules try to be in line with the musical
% line that accompanies the lyrics. Music often requires that certain
% diphthongs become hiati; therefore the functionality of the active |"|
% character turns out to be very useful to typeset correct liturgical Latin. 
%
% The minimum character length of the first and last word fragments are both
% set to~2, but the user who has to emphasize the syllables a particular lyric
% to be typeset under the staff, may use XeLaTeX or LuaLaTeX with package
% \pack{teshyphens} to find out the correct syllables of the whole text, even
% if both minimum lengths are set to~1.
%
% Such rules have been defined with the help of different people, some of
% which are monks in cloister Benedictine monasteries in different countries;
% since according to their rules they and their specific monasteries cannot
% be named, this documentations carries only the name of the present
% maintainer because he must be reached in case of bug reports.
%
% I, as the actual ``pro tempore'' maintainer, acknowledge their substantial
% contribution to this work, even if I cannot name them; but it should be
% absolutely clear that without their contribution the liturgical Latin patterns
% would not exist. When I will not be any more available to continue 
maintenance,
% the next maintainer is sort of obliged to continue acknowledging their
% contribution.
%
% \section{Usage}
% With XeLaTeX and LuaLaTeX, \pack{polyglossia} is the specific package used
% to deal with languages. 
%
% There are two ways to handle Latin with XeLaTeX.
% \begin{enumerate}
% \item
% Handle three different languages, latin, classiclatin, and liturgiclatin
% as in this example:
%\begin{verbatim}
%\usepackage{polyglossia}
%\setmainlanguage{...}
%\setotherlanguage[babelshorthands]{classiclatin}
%\end{verbatim}
% \item 
% Handle a single language, latin, with several variants, as
% in this example:
%\begin{verbatim}
%\usepackage{polyglossia}
%\setmainlanguage{...}
%\setotherlanguage[variant=classic,babelshorthands]{latin}
%\end{verbatim}
%\end{enumerate}
% I started using the second approach, then I experienced the first and now
% I prefer using it; it is just a question of personal preferences.
% Actually the first approach is the one that is necessary to use with
% LuaLaTeX, and you can manage the Latin varieties as different languages.
% With the secondo approach, once a certain variant has bees specified,
% no other variants can be selected; therefore the second approach is sort
% a fallback for backwards compatibility with a previous version of the
% language description file. At the same time there are certain options
% that are not implemented for LuaLaTeX, therefore the full \file{latin.ldf}
% with all its variants ha some utility by itself, although some options
% can be used only with XeLaTeX.
%
%
%    \begin{table}[htb]\centering
%    \begin{tabular}{cp{80mm}}
%    \toprule
%    |"|    & inserts a compound word mark where hyphenation is legal;
%             the next character must not be either a non-letter token
%             or an accented letter (for foreign names and ecclesiastic or
%             liturgical Latin).\\
%    \texttt{\string"\string|}
%           & inserts a compound word mark, but operates also when the next
%             token is not a letter or it is an accented character. This
%             shorthand is required when it is necessary to specify a break
%             \emph{before} and accented diphthong \'\ae\ and \'\oe.\\
%    |'a|   & inserts an \emph{accented} \'\ae\ ligated diphthong in liturgical
%             Latin, without the need of curly braces; hyphenation is allowed
%             after this accented ligature by means of an implied discretionary
%             break command.\\
%    |'o|   & operates the same as the preceding shorthand, but inserts an
%             accented \'\oe\ diphthong.\\
%    \bottomrule
%    \end{tabular}
%    \caption[]{Shorthands defined for the Latin language.}%
%    \label{t:lashrtct}
%    \end{table}
%
% For example, if in a modern Latin grammar written for English students
% English it was necessary  to make examples with citations od stretches
% of text in modern Latin and in classic Latin, with both XeLaTeX and
% LuaLaTeX you would do the following:
%\begin{verbatim}
%\documentclass[...]{...}
%...
%\usepackage{polyglossia}
%\setmainlanguage{english}
%\setotherlanguage[babelshorthands]{latin}
%\setotherlanguage[babelshorthands]{classiclatin}
%...
%\begin{document}
%...
%A modern Latin  version of Julius Caesar \emph{De bello gallico}
%would appear as follows.
%\begin{quote}\begin{latin}
%Gallia omnia divisa in partes tres\dots
%\end{latin}\end{quote}
%
%Classic Latin would have instead the following text.
%\begin{quote}\begin{classiclatin}
%Gallia omnia diuisa in partes tres\dots
%\end{classiclatin}\end{quote}
%...
%\end{document}
%\end{verbatim}
%
% It is worth repeating that with LuaLaTeX it is necessary to use only the
% first procedure described for XeLaTeX.
%
% Each language definition file provides the \opt{babelshorthands} option in
% order to use the double straight quote as an active character that performs
% special actions as described in table~\ref{t:lashrtct}.
% The option \opt{withprosodicmarks}, defined in the
% analogous language description file for \babel, was intended for easing
% the setting of the macron and breve signs over single vowels, but since
% \prog{pdfLaTeX} handles only 8-bit encoded fonts, none of which includes
% the ten vocalic glyphs with macrons and breves, it is necessary
% to build up such graphemes. Such artifices are not necessary with XeLaTeX
% and LuaLaTeX that use UNICODE encoded fonts, where the ten glyphs already
% exist.
%
% At the same time accents on the latin diphthongs are not generally easy
% to set with a national keyboard, therefore these files provide the active
% `acute' accent (actually the usual \textsc{ascii} single straight quote),
% so that it is simpler
% to write \verb|'ae| to set \'\ae, rather than writing \verb|\'{\ae}|
% or \verb*|\'\ae | in order to avoid attaching the `\'\ae' glyph
% to the following letters.
%
% This self extracting documented \TeX\ file produces both this documentation
% and the desired three language description files to be used with XeLaTeX
% and LuaLaTeX.
% 
% \StopEventually{}
%
%    \section{The code}
%
% This section defines three language description files: file
% |gloss-latin.ldf|
% to typeset modern and medieval latin, possibly with the |ecclesiastic|
% settings;  file |gloss-classiclatin.ldf| to typeset classic Latin; and
% to typeset liturgical Latin  file |gloss-liturgicallatin.ldf|. All these three
% language description files accept the option |babelshorthands=true|, or
% simply |babelshorthands|, they have available the special features of the
% active double quote and, except for |gloss-classiclatin|, the active single
% quote (\textsc{ascii} apostrophe or single straight quote).
% Only |gloss-latin.ldf| accepts the |ecclesiastic=true| or simply
% |ecclesiastic| option, which is not available with the other two language
% description files.
%
% While using XeLaTeX it is possible to specify the spelling and hyphenation
% variety with an option, |variant=|\meta{language}, where \meta{language}
% may be any of the five listed in table~\ref{tab:charsets}; if no variant
% is specified, the modern one is the default one.
%
% While using LuaLaTeX this possibility is not available (except possibly)
% for |variant=medieval|; furthermore, even if it is possible to specify
% the |ecclesiastic| option, nothing particular is done, because the
% special punctuation and footnote styles have not been implemented
% for LuaLaTeX (and possibly they will never be).
%
% The LuaLaTeX approach is interesting because it is possible to mix the
% various language variants in the same document by simply selecting the
% language. This approach is possible also with XeLaTeX by simply omitting
% to specify the classic or the liturgic variant name, but by specifying the
% specific language names as ``other languages''.
%
% \subsection[Code for Latin]{Code for gloss-latin}
%\iffalse
%<*lacode>
%\fi
% We start with the \pack{polyglossia} settings of the main language, in
% particular by selecting the pattern file with modern phonetic hyphenation 
rules.
%    \begin{macrocode}
% !TEX encoding = UTF-8 Unicode
\PolyglossiaSetup{latin}{%
      hyphennames={latin},
      hyphenmins={2,2},
      frenchspacing=true,
      fontsetup=true,
}
%    \end{macrocode}
% We define a macro that sets the proper values for the upper- and lower-casing
% of the letters `u' and `V'; this macro will be used for the \opt{medieval}
% and {classic} variants for the proper processing of the infix words and
% those strings that are uppercased by certain classes, for example the
% contents of headers by the standard classes. For the document text it is
% the users' responsibility to use the proper spelling for these variants.
%    \begin{macrocode}
\def\classicuclccodes{\lccode`\V=`\u \uccode`\u=`\V}
%
%    \end{macrocode}
% We then define some service macros containing the names of the variants
% in order to perform the necessary tests; we exclude such definitions when
% the \prog{luatex} engine is being used, because, as explained in the
% documentation, \prog{luatex} load one pattern set per language, therefore
% changing pattern set according to the language variant specified becomes
% meaningless. It is convenient to define a switch to distinguish modern form
% medieval Latin spelling. The same we do with another swithch |\ifclassic|.
% These names are not very meaningful, but they are maintained for backwards
% compatibility; in practice switch |\ifmedieval| handles the treatment of
% `\ae' while |\ifclassic| handles the treatment of the `u' spelling in infix
% words. For modern Latin they are both false; for medieval Latin they are
% both true' for classic Latin |\ifmedieval| is false, while |\ifclassic|
% is true; for liturgical Latin |\ifmedieval| is true while |\ifclassic| is 
false.
%    \begin{macrocode}
\def\tmp@modern{modern}
\def\tmp@medieval{medieval}
\unless\ifluatex
  \def\tmp@classic{classic}
  \def\tmp@liturgical{liturgical}
\fi
\newif\ifmedieval\medievalfalse
\newif\ifclassic\classicfalse
%    \end{macrocode}
% For the \opz{ecclesiatic} option we need to set a \pack{kvalue} boolean
% key such that when the option is specified the |true| value is assumed.
% The initial setting of this key, though, is |false| so that without
% specifying this option no ecclesiastic typesetting parameters are set.
%    \begin{macrocode}
%\newif\iflatin@ecclesiastic 
\define@boolkey{latin}[latin@]{ecclesiastic}[true]{}

%    \end{macrocode}
% Now we start examining the \opz{variant} options. We start by setting the
% default language value to the |\latin@variant| macro; we then test if the
% \prog{luatex} engine is being used and if the latin pattern set have been
% loaded; if so a special LuaTeX macro is used to define the |latin| language
% functionalities  
%    \begin{macrocode}
\let\latin@variant\l@latin
\ifluatex
  \ifcsname l@latin\endcsname\xpg@set@language@luatex@ii{latin}\fi
\fi
\def\captionslatin{\latincaptions}%
\def\datelatin{\latindate}%
%    \end{macrocode}
% At this point we are ready for testing the various variants vs the specified
% one; first we define the \prog{keyvalue} key with the default value |modern|,
% then we proceed with the tests. We start with |variant=medieval| where we
% we set the switch |\ifmedieval| that is used within the captions and date
% definitions, and we use the already defined macro |\classicuclccodes| in
% order to set the proper correspondence between the lower and upper case
% letters `u' and `V'.
%    \begin{macrocode}
\define@key{latin}{variant}[modern]{%
\def\@tempa{#1}%
%************* medieval
\ifx\@tempa\tmp@medieval
  \ifluatex
    \ifcsname l@latin\endcsname\xpg@set@language@luatex@ii{latin}\fi
  \fi
  \let\latin@variant\l@latin
  \xpg@set@language@luatex@ii{latin}
  \medievaltrue \classictrue
  \classicuclccodes
  \xpg@info{Option: Medieval Latin}%
\else
%    \end{macrocode}
% Then we test the |classic| variant; we proceed in a similar way; but for
% backwards compatibility we test to check if the suitable classic latin
% patterns have been loaded; for XeLaTeX this should be redundant, but
% in past distributions of the TeX system, such patterns were not available.
%    \begin{macrocode}
%************* classic
  \ifx\@tempa\tmp@classic
    \unless\ifcsname l@classiclatin\endcsname
       \xpg@nopatterns{Classic Latin}%
       \adddialect\l@classiclatin\l@latin
       \let\latin@variant\l@latin
    \else
       \let\latin@variant\l@classiclatin
      \ifluatex\xpg@set@language@luatex@ii{classiclatin}\fi
    \fi
    \medievalfalse\classictrue\classicuclccodes
    \xpg@info{Option: Classic Latin}%
  \else
%    \end{macrocode}
% Eventually we do similar actions for the liturgical Latin  variant; again we
% must check for backwards compatibility, since in past distributions liturgical
% latin patterns were not available.
%    \begin{macrocode}
%************** liturgical
    \ifx\@tempa\tmp@liturgical
        \unless\ifcsname l@liturgicallatin\endcsname
           \xpg@nopatterns{Liturgical Latin}%
           \adddialect\l@liturgicallatin\l@latin
           \def\latin@variant{\l@latin}%
        \else
           \let\latin@variant\l@liturgicallatin
           \ifluatex\xpg@set@language@luatex@ii{liturgiclatin}\fi
        \fi
        \medievaltrue\classicfalse
        \xpg@info{Option: Liturgical Latin}%
   \else
%    \end{macrocode}
% Even if the |modern| variant is the default one, we must test also for this
% variant in case the users specified the value to the key |variant|. Some of
% this code might be redundant, but it is better than nothing.
%    \begin{macrocode}
%************* modern
      \ifx\@tempa\tmp@modern
        \let\latin@variant\l@latin
        \ifluatex\xpg@set@language@luatex@ii{latin}\fi
        \xpg@info{Option: Modern Latin}%
      \else
        \def\latin@variant{\l@nohyphenation}%
        \PackageWarning{polyglossia}{%
          *******************\MessageBreak
          No hyphenation set for Latin 
          *******************\MessageBreak
        }{}%
      \fi
    \fi
  \fi
\fi

}
%    \end{macrocode}
% After these different language variants we need to assign the correct
% value to the internal macro |\latin@language|.
%    \begin{macrocode}
\def\latin@language{\language=\latin@variant}%
%    \end{macrocode}
%
% At this point we define the option \opz{ecclesiastic}; for XeLaTeX we use
% a set of little known commands to define character classes to be handled
% the same way; for LuaLaTeX we do not do the same, therefore the
% \opz{ecclesiastic} option with LuaLaTeX remains ineffective, without even
% a `Warning' message. 
% The main  reason is that liturgical Latin is used mainly
% for typesetting liturgical texts containing many hymns, psalms, and such
% musical contents, often composed with the \pack{GregorioTeX} package; in
% such books the French like punctuation and footnote styles are often
% attentively avoided, therefore the ecclesiastic style is not used. Since
% \pack{GregorioTeX} works only with LuaLaTeX, the |ecclesiastic| options
% appears to be superfluous. In any case there is always the possibility
% to typeset in the ecclesiastic style with XeLaTeX. 
%
% Let us remember that the |\iflatin@ecclesiastic| switch is set to |true| 
% when the \opz{ecclesiastic} option is specified.
%
% We start defining a long named macro |\ecclesiasticlatin@punctuation|; its
% substitution text contains some macros that set all the settings; such
% macro will be used in practice to set all the necessary parameters;
% its opposite macro |\noecclesiasticlatin@punctuation| is used to reset all
% settings.
% Notice that three new `intercharclasses' are defined and the various
% punctuations marks involved are assigned to such classes; then the tokens
% to be inserted between chars of different classes are set according to
% the classes they belong to.
%    \begin{macrocode}
\iflatin@ecclesiastic
   \def\ecclesiasticlatin@punctuation{%
      \def\xpg@unskip{\ifhmode\ifdim\lastskip>\z@\unskip\fi\fi}
      \lccode\string"2019=\string"2019
%
% The following code is disabled for use with luatex
%****************************************************
    \unless\ifluatex
      \newXeTeXintercharclass\ecclesiasticlatin@punctthin
      \newXeTeXintercharclass\ecclesiasticlatin@punctguillstart
      \newXeTeXintercharclass\ecclesiasticlatin@punctguillend
      \XeTeXinterchartokenstate=1
      \XeTeXcharclass `\! \ecclesiasticlatin@punctthin
      \XeTeXcharclass `\? \ecclesiasticlatin@punctthin
      \XeTeXcharclass `\; \ecclesiasticlatin@punctthin
      \XeTeXcharclass `\: \ecclesiasticlatin@punctthin
      \XeTeXcharclass `\« \ecclesiasticlatin@punctguillstart
      \XeTeXcharclass `\» \ecclesiasticlatin@punctguillend
      \XeTeXinterchartoks \z@ \ecclesiasticlatin@punctthin = {\penalty\@M
      \hskip.2\fontdimen2\font \@plus\z@\@minus\z@}%
      \XeTeXinterchartoks 255 \ecclesiasticlatin@punctthin = {\xpg@unskip}
      \XeTeXinterchartoks \ecclesiasticlatin@punctguillstart \z@ = {\penalty\@M
      \hskip.2\fontdimen2\font \@plus\z@\@minus\z@\ignorespaces}
      \XeTeXinterchartoks \z@ \ecclesiasticlatin@punctguillend = {\xpg@unskip
      \penalty\@M\hskip.2\fontdimen2\font \@plus\z@\@minus\z@}
    \fi}
    
   \def\noecclesiasticlatin@punctuation{%
      \lccode\string"2019=\z@
%
% The following code is disabled for use with luatex
%****************************************************
      \unless\ifluatex
        \XeTeXcharclass `\! \z@
        \XeTeXcharclass `\? \z@
        \XeTeXcharclass `\; \z@
        \XeTeXcharclass `\: \z@
        \XeTeXcharclass `\« \z@
        \XeTeXcharclass `\» \z@
        \XeTeXinterchartokenstate=0
      \fi}
\fi
%    \end{macrocode}
% Eventually we redefine certain internal macros in order to set footnotes
% the way that has been established for this ecclesiastic footnote style.
%    \begin{macrocode}
    \let\latin@original@makefntext\@makefntext
    \newcommand\latin@ecclesiastic@makefntext[1]{%
        \parindent 1em%
        \noindent
        \latin@Makefnmark\enspace ##1}
    \newcommand\latin@Makefnmark{\hbox{\normalfont\@thefnmark.}}
    
\setkeys{latin}{variant,ecclesiastic=false}
%    \end{macrocode}
% This is the right position to define the various captions and dates;
% notice that these are very similar  for medieval and classical
% Latin, and, respectively, identical for modern and liturgical Latin;
% therefore we handle these similarities by means of the switches
% |\ifmedieval| and |\ifclassic| without any duplication of code.
%
%    \begin{macrocode}
\def\latincaptions{%
   \def\prefacename{\ifmedieval Præfatio\else Praefatio\fi}%
   \def\refname{Conspectus librorum}%
   \def\abstractname{Summarium}%
   \def\bibname{Conspectus librorum}%
   \def\chaptername{Caput}%
   \def\appendixname{Additamentum}%
   \def\contentsname{Index}%
   \def\listfigurename{Conspectus descriptionum}%
   \def\listtablename{Conspectus tabularum}%
   \def\indexname{Index rerum notabilium}%
   \def\figurename{Descriptio}%
   \def\tablename{Tabula}%
   \def\partname{Pars}%
   \def\enclname{Additur}%
   \def\ccname{Exemplar}%
   \def\headtoname{\ignorespaces}%
   \def\pagename{charta}%
   \def\seename{cfr.}%
   \def\alsoname{cfr.}%
   \def\proofname{Demonstratio}%
   \def\glossaryname{Glossarium}%
   }
      
\def\latindate{%   
   \def\today{\uppercase\expandafter{\romannumeral\day}%
      \space \ifcase\month%
      \or Januarii\or Februarii\or Martii\or Aprilis\or Maji\or Junii\or%
      Julii\or Augusti\or Septembris\or Octobris\or 
        \ifclassic Nouembris\else Novembris\fi
      \or Decembris\fi%
      \space \uppercase\expandafter{\romannumeral\year}}}

%    \end{macrocode}
%
% We now define the settings and the definitions for the few babel-style 
% shorthands that are used with Latin. First we need some settings useful
% for \pack{polyglossia}. Actually it is possible that the module for the
% babel-style shorthands gets loaded by default, but all language
% |gloss-*.ldf| files that use such shorthands, make these tests.
%    \begin{macrocode}
%%%%%%%%% Latin shorthands

\define@boolkey{latin}[latin@]{babelshorthands}[true]{}

\ifsystem@babelshorthands
  \setkeys{latin}{babelshorthands=true}
\else
  \setkeys{latin}{babelshorthands=false}
\fi
%    \end{macrocode}
%
% After this we can initialise the active chars |"| and |'|. 
%    \begin{macrocode}
\ifcsundef{initiate@active@char}{%
\input{babelsh.def}%
\initiate@active@char{"}%
\initiate@active@char{'}%
}{}
%    \end{macrocode} 
%
% We define both |\latin@shorthands| and |\nolatin@shorthans| to be used
% in the latin-extras and -noextras macros in order to turn on and off
% such shorthands whenever a language change takes place. The  service
% macros |\xpgla@cwm| and |xpgla@putacute| are actually the ones that do
% the respective jobs, but the active |"| and |'| must refer to them through
% other service macros subject to the math mode testing so as to behave in a
% different way while in math mode vs text mode.
%    \begin{macrocode}
\def\latin@shorthands{%
  \def\language@group{latin}%
  \bbl@activate{"}%
  \declare@shorthand{latin}{"}{\relax
    \ifmmode
      \def\xpgla@nextdq{''}%
    \else
      \def\xpgla@nextdq{\futurelet\xpgla@temp\xpgla@cwm}%
    \fi
  \xpgla@nextdq}%
%  
  \bbl@activate{'}%  
  \declare@shorthand{latin}{'}{\relax
    \ifmmode
      \def\xpgla@nextsq{'}%
    \else
      \def\xpgla@nextsq{\futurelet\xpgla@temp@A\xpgla@putacute}%
    \fi
  \xpgla@nextsq}%
}
%    \end{macrocode}
% We need also a |\xpfla@allowhyphens| resorting to the babel system
% |\bbl@allowhyphens| macro in order to use a breakable hyphen sign.
% In facts we remember the normal hyphen sign forms a legal line
% break point, but both word connected by the hyphen sign cannot be
% hyphenated; on the opposite we want a situation where both words
% connected by the hyphen may be hyphenated.
%    \begin{macrocode}
\def\xpgla@allowhyphens{\bbl@allowhyphens\discretionary{-}{}{}\bbl@allowhyphens}
%    \end{macrocode}
% Now we make a multistage set of conditionals: first we test if the next
% character is a letter; if it is a breakable hyphen point is inserted;
% otherwise if it is a ligated diphthong |æ| this is treated as a normal
% \textsc{ascii} letter; otherwise the same test is made to test if the
% next letter is a ligated diphthong |œ|; otherwise eventually the next char
% is tested against \verb+|+ the discretionary break is inserted, but the
% \verb+|+ is gobbled. Through these operations we can insert into a word
% a discretionary break, without forbidding other legal line breaks.
%    \begin{macrocode}
\newcommand*{\xpgla@cwm}{\let\xpgla@@nextdq\relax
  \ifcat\noexpand\xpgla@temp a%
    \let\xpgla@@nextdq\xpgla@allowhyphens
  \else
    \ifx\xpgla@temp\ae
        \let\xpgla@@nextdq\xpgla@allowhyphens
    \else
        \ifx\xpgla@temp\oe
           \let\xpgla@@nextdq\xpgla@allowhyphens
        \else
           \if\noexpand\xpgla@temp\string|%
              \def\xpgla@@nextdq{\xpgla@allowhyphens\@gobble}%
           \fi
        \fi
    \fi
  \fi
  \xpgla@@nextdq}%
%    \end{macrocode}
% For the active `apostrophe', to be used as an acute accent,  we test the
% first char after the active apostrophe; if it is an |a| or an |o| or an |æ|
% or an |œ|, we gobble it and insert into the input reading stream the proper
% accented ligated diphthong; actually we insert the proper unaccented
% diphthong followed by the self combining acute accent with UNICODE address
% |0301|. Beware: this procedure is technically correct, but the result
% sometimes is not so good as expected, because it depends on the OpenType
% fonts being used. With the OpenType UCM (Unicode encoded Computer Modern) 
% and other fonts the accent sets itself over the middle of the base diphthong;
% with other fonts is sets itself on the `e' part of the diphthong; it is
% acceptable, but certainly on the middle is much better. Therefore we avoid
% setting the accent this way on the |æ| diphthong but, if it' is available
% in the font, use the correct code point for the accented |æ|\footnote{You
% may use also the traditional \TeX\ way by inserting
% \texttt{\char92'\char92ae\textvisiblespace} or
% \texttt{\char92'\{\char92ae\}} in the source file. With XeLaTeX and
% LuaLaTeX, when dealing with |œ|, this does not work, because the traditional
% \TeX\ accent macros are mapped to real code points, and there is no code
% point for \texttt{\'\oe}.}; on the |œ| diphthong this is impossible,
% because there is no code point in UNICODE pointing to \texttt{\'\oe}. 
%    \begin{macrocode}
\def\xpgla@putacute#1{\let\xpgla@nextsq\relax%
\if a\xpgla@temp@A
  æ\kern-0.175em^^^^0301\kern0.175em\xpgla@allowhyphens
\else
        \if o\xpgla@temp@A
          œ\kern-0.175em^^^^0301\kern0.175em\xpgla@allowhyphens
        \else
          \if æ\xpgla@temp@A
            æ^^^^0301%
          \else
            \if œ\xpgla@temp@A
              œ^^^^0301%
            \else
              \string'%
            \fi
          \fi
        \fi
\fi}%

\def\nolatin@shorthands{%
  \@ifundefined{initiate@active@char}{}{\bbl@deactivate{"}}%
  \@ifundefined{initiate@active@char}{}{\bbl@deactivate{'}}%
}
%    \end{macrocode}
%
% Eventually we save the settings for Latin into the |\xpgla@savedvalues|
% macro, delaying the operation until the end of the preamble, so we are
% sure that the correct values are saved, since the default ones might
% have been changed by the user or by the used classes.
%    \begin{macrocode}

\let\xpgla@savedvalues\empty
\AtEndPreamble{% 
  \edef\xpgla@savedvalues{%
    \clubpenalty=\the\clubpenalty\space
    \@clubpenalty=\the\@clubpenalty\space
    \widowpenalty=\the\widowpenalty\space
    \finalhyphendemerits=\the\finalhyphendemerits}
}
%    \end{macrocode}
% The final actions are to define the |\noextras@latin|, |\blockextras@latin|
% and |\inlineextras@latin| so as to set or reset the Latin settings when
% typesetting a stretch of Latin text.
%    \begin{macrocode}
\def\noextras@latin{%
   \lccode\string"2019=\z@
   \nolatin@shorthands
   \xpgla@savedvalues 
  \iflatin@ecclesiastic
    \noecclesiastic@punctuation
    \let\@makefntext\latin@original@makefntext
  \fi
}

\def\blockextras@latin{%
   \lccode\string"2019=\string"2019
   \clubpenalty=3000 \@clubpenalty=3000 \widowpenalty=3000
   \finalhyphendemerits=50000000
   \iflatin@babelshorthands\latin@shorthands\fi
   \iflatin@ecclesiastic\ecclesiastic@punctuation
   \let\@makefntext\latin@ecclesiastic@makefntext
   \fi
}

\def\inlineextras@latin{%
   \lccode\string"2019=\string"2019
   \iflatin@babelshorthands\latin@shorthands\fi
   \iflatin@ecclesiastic
      \ecclesiastic@punctuation
      \let\@makefntext\latin@ecclesiastic@makefntext
   \fi
}

%    \end{macrocode}
%\iffalse
%</lacode>
%\fi
%
% \subsection[Code for classic Latin]{Code for gloss-classiclatin}
% The standalone language description file for \pack{polyglossia}
% \file{gloss-classiclatin.ldf} is very similar to the ``plain'' latin one,
% except for the following differences.
% \begin{enumerate}
% \item
%   This file is a standalone one, and does not deal with other Latin varieties.
%   This implies that no options are set, except those for the babel-style
%   shorthands.
% \item
%   Only one pattern file is being loaded, therefore there is no need to save
%   settings for other hyphenation patterns. And there is no need to make any 
%   tests to check the specific pattern file name; either it exists, or it is 
%   replaced by the |nohyphenation| pseudo language, as it is customary with 
%   \pack{polyglossia}.
% \item 
%   The uccodes are those specific for classic Latin where only `u' is used 
%   for lower case and only `V' is used for upper case and this has an influence
%   on the spelling of dates; on the opposite `captions' are equal to those of
%   modern Latin, because the ligated diphthongs are not used at all in 
classical
%   spelling.
% \end{enumerate}
%
% The |\PolyglossiaSetup| differs from the ``plain'' Latin one because only
% the |classiclatin| language is called with the specific name used to
% associate a language to a specific  pattern file as it is done in the
% language setting files \file{language.dat}, \file{language.def}, and
% \file{language.dat.lua}.
%\iffalse
%<*laclassic>
%\fi
%    \begin{macrocode}
% !TEX encoding = UTF-8 Unicode
\PolyglossiaSetup{classiclatin}{%
      hyphennames={classiclatin},
      hyphenmins={2,2},
      frenchspacing=true,
      fontsetup=true,
}
\def\classicuclccodes{\lccode`\V=`\u \uccode`\u=`\V}
%    \end{macrocode}
%
% Then the captions and date are defined.
%    \begin{macrocode}
\def\classiclatincaptions{%
   \def\prefacename{Praefatio}%
   \def\refname{Conspectus librorum}%
   \def\abstractname{Summarium}%
   \def\bibname{Conspectus librorum}%
   \def\chaptername{Caput}%
   \def\appendixname{Additamentum}%
   \def\contentsname{Index}%
   \def\listfigurename{Conspectus descriptionum}%
   \def\listtablename{Conspectus tabularum}%
   \def\indexname{Index rerum notabilium}%
   \def\figurename{Descriptio}%
   \def\tablename{Tabula}%
   \def\partname{Pars}%
   \def\enclname{Additur}%
   \def\ccname{Exemplar}%
   \def\headtoname{\ignorespaces}%
   \def\pagename{charta}%
   \def\seename{cfr.}%
   \def\alsoname{cfr.}%
   \def\proofname{Demonstratio}%
   \def\glossaryname{Glossarium}%
   }

\def\classiclatindate{%   
   \def\today{\uppercase\expandafter{\romannumeral\day}%
      \space \ifcase\month
      \or Januarii\or Februarii\or Martii\or Aprilis\or Maii\or Junii\or
      Julii\or Augusti\or Septembris\or Octobris\or Nouembris\or
      Decembris\fi
      \space \uppercase\expandafter{\romannumeral\year}}}
%    \end{macrocode}
% Then, again, the necessary tests are made for setting the babel shorthands
% for the proper definition of the \opz{babelshorthands} option.
%    \begin{macrocode}

\define@boolkey{classiclatin}[classiclatin@]{babelshorthands}[true]{}

\ifsystem@babelshorthands
  \setkeys{classiclatin}{babelshorthands=true}
\else
  \setkeys{classiclatin}{babelshorthands=false}
\fi

%    \end{macrocode}
% Again the |"| is initialised as an active character.
%    \begin{macrocode}
\ifcsundef{initiate@active@char}{%
\input{babelsh.def}%
\initiate@active@char{"}%
}{}
%    \end{macrocode}
%
% And the definitions for the active |"|  are repeated as for ``plain''
% latin.
%    \begin{macrocode}

\def\classiclatin@shorthands{%
  \def\language@group{classiclatin}%
  \bbl@activate{"}%
  \declare@shorthand{classiclatin}{"}{\relax
    \ifmmode
      \def\xpgcla@next{''}%
    \else
      \def\xpgcla@nextdq{\futurelet\xpgla@temp\xpgla@cwm}%
    \fi
  \xpgcla@nextdq}%
}


\def\xpgcla@allowhyphens{\bbl@allowhyphens\discretionary{-}{}{}\bbl@allowhyphens}

\newcommand*{\xpgcla@cwm}{\let\xpgcla@@nextdq\relax
  \ifcat\noexpand\xpgcla@temp a%
    \let\xpgcla@@nextdq\xpgcla@allowhyphens
  \else
    \ifx\xpgcla@temp\ae
        \let\xpgcla@@nextdq\xpgcla@allowhyphens
    \else
        \ifx\xpgcla@temp\oe
           \let\xpgcla@@nextdq\xpgcla@allowhyphens
        \else
           \if\noexpand\xpgla@temp\string|%
              \def\xpgcla@@nextdq{\xpgcla@allowhyphens\@gobble}%
           \fi
        \fi
    \fi
  \fi
  \xpgla@@nextdq}%
%    \end{macrocode}
% As in ``plain'' latin the |\noclassiclatin@shorthands| is defined so
% as to use it within the setting and unsetting of the language parameters.
%    \begin{macrocode}
\def\noclassiclatin@shorthands{%
  \@ifundefined{initiate@active@char}{}{\bbl@deactivate{"}}%
}

\let\xpgcla@savedvalues\empty
\AtEndPreamble{% 
  \edef\xpgcla@savedvalues{%
    \clubpenalty=\the\clubpenalty\space
    \@clubpenalty=\the\@clubpenalty\space
    \widowpenalty=\the\widowpenalty\space
    \finalhyphendemerits=\the\finalhyphendemerits}%
}

\def\noextras@classiclatin{%
   \lccode\string"2019=\z@
   \noclassiclatin@shorthands
   \xpgcla@savedvalues 
}

\def\blockextras@classiclatin{%
   \lccode\string"2019=\string"2019
   \clubpenalty=3000 \@clubpenalty=3000 \widowpenalty=3000
   \finalhyphendemerits=50000000
   \ifclassiclatin@babelshorthands\classiclatin@shorthands\fi
}

\def\inlineextras@classiclatin{%
   \lccode\string"2019=\string"2019
   \ifclassiclatin@babelshorthands\classiclatin@shorthands\fi
}

%    \end{macrocode}

%\iffalse
%</laclassic>
%\fi
%
% \subsection[Code for liturgical Latin]{Code for gloss-liturgicallatin}
% For liturgical Latin we do similar things as we did for ``plain'' Latin
% in the previous section; the main differences are the following.
% \begin{enumerate}
% \item
%   This file is a standalone one, and does not deal with other Latin varieties.
%   This implies that no options are set, except those for the babel-style
%   shorthands.
% \item
%   Only one pattern file is being loaded, therefore there is no need to save
%   settings for other hyphenation patterns. And there is no need to make any 
%   tests to check the specific pattern file name; either it exists, or it is 
%   replaced by the |nohyphenation| pseudo language, as it is customary with 
%   \pack{polyglossia}.
% \item 
%   The uccodes are identical with the modern Latin ones, while the `captions' 
%   are equal to those of medieval Latin, because of the widespread use of the 
%   ligated diphthongs.
% \end{enumerate}
%
% The |\PolyglossiaSetup| differs from the ``plain'' Latin one because only
% the |liturgicallatin| language is called with the specific name used to
% associate a language to a specific pattern file as it is done in the
% language setting files \file{language.dat}, \file{language.def}, and
% \file{language.dat.lua}.
%\iffalse
%<*laliturgic>
%\fi
%    \begin{macrocode}
% !TEX encoding = UTF-8 Unicode
\PolyglossiaSetup{liturgicallatin}{%
      hyphennames={liturgicallatin},
      hyphenmins={2,2},
      frenchspacing=true,
      fontsetup=true,
}
%    \end{macrocode}
%
% Then the captions and date are defined.
%    \begin{macrocode}
\def\liturgicallatincaptions{%
   \def\prefacename{Præfatio}%
   \def\refname{Conspectus librorum}%
   \def\abstractname{Summarium}%
   \def\bibname{Conspectus librorum}%
   \def\chaptername{Caput}%
   \def\appendixname{Additamentum}%
   \def\contentsname{Index}%
   \def\listfigurename{Conspectus descriptionum}%
   \def\listtablename{Conspectus tabularum}%
   \def\indexname{Index rerum notabilium}%
   \def\figurename{Descriptio}%
   \def\tablename{Tabula}%
   \def\partname{Pars}%
   \def\enclname{Additur}%
   \def\ccname{Exemplar}%
   \def\headtoname{\ignorespaces}%
   \def\pagename{charta}%
   \def\seename{cfr.}%
   \def\alsoname{cfr.}%
   \def\proofname{Demonstratio}%
   \def\glossaryname{Glossarium}%
   }
      
\def\liturgicallatindate{%   
   \def\today{\uppercase\expandafter{\romannumeral\day}%
      \space \ifcase\month%
      \or Januarii\or Februarii\or Martii\or Aprilis\or Maji\or Junii\or%
      Julii\or Augusti\or Septembris\or Octobris\or Novembris\or%
      Decembris\fi%
      \space \uppercase\expandafter{\romannumeral\year}}}
%    \end{macrocode}
% Then, again, the necessary tests are made for setting the babel shorthands
% for the proper definition of the \opz{babelshorthands} option.
%    \begin{macrocode}

\define@boolkey{liturgicallatin}[liturgicallatin@]{babelshorthands}[true]{}

\ifsystem@babelshorthands
  \setkeys{liturgicallatin}{babelshorthands=true}
\else
  \setkeys{liturgicallatin}{babelshorthands=false}
\fi

%    \end{macrocode}
% Again the |"| and |'| are initalised as active characters.
%    \begin{macrocode}
\ifcsundef{initiate@active@char}{%
    \input{babelsh.def}%
    \initiate@active@char{"}%
    \initiate@active@char{'}%
}{}
%    \end{macrocode}
%
% And the definitions for the active |"| and |'| are repeated as for ``plain''
% latin.
%    \begin{macrocode}

\def\liturgicallatin@shorthands{%
  \def\language@group{liturgicallatin}%
  \bbl@activate{"}%
  \declare@shorthand{liturgicallatin}{"}{\relax
    \ifmmode
      \def\xpglla@next{''}%
    \else
      \def\xpglla@nextdq{\futurelet\xpglla@temp\xpglla@cwm}%
    \fi
  \xpglla@nextdq}%
  \bbl@activate{'}%  
  \declare@shorthand{liturgicallatin}{'}{\relax
    \ifmmode
      \def\xpglla@nextsq{'}%
    \else
      \def\xpglla@nextsq{\futurelet\temp@A\xpglla@putacute}%
    \fi
  \xpgla@nextsq}%
}


\def\xpglla@allowhyphens{\bbl@allowhyphens\discretionary{-}{}{}\bbl@allowhyphens}

\newcommand*{\xpglla@cwm}{\let\xpglla@@nextdq\relax
  \ifcat\noexpand\xpglla@temp a%
    \let\xpglla@@nextdq\xpglla@allowhyphens
  \else
    \ifx\xpglla@temp\ae
        \let\xpglla@@nextdq\xpglla@allowhyphens
    \else
        \ifx\xpglla@temp\oe
           \let\xpglla@@nextdq\xpglla@allowhyphens
        \else
           \if\noexpand\xpglla@temp\string|%
              \def\xpglla@@nextdq{\xpglla@allowhyphens\@gobble}%
           \fi
        \fi
    \fi
  \fi
  \xpglla@@nextdq}%
  

\def\xpglla@putacute#1{\let\xpglla@nextsq\relax%
\if a\xpglla@temp@A
  æ\kern-0.175em^^^^0301\kern0.175em\xpglla@allowhyphens
\else
        \if o\xpglla@temp@A
          œ\kern-0.175em^^^^0301\kern0.175em\xpglla@allowhyphens
        \else
          \if æ\xpglla@temp@A
            æ^^^^0301%
          \else
            \if œ\xpglla@temp@A
              œ^^^^0301%
            \else
              \string'%
            \fi
          \fi
        \fi
\fi}%
%    \end{macrocode}
% As in ``plain'' latin the |\noliturgicallatin@shorthands| is defined so
% as to use it within the setting and unsetting of the language parameters.
%    \begin{macrocode}
\def\noliturgicallatin@shorthands{%
  \@ifundefined{initiate@active@char}{}{\bbl@deactivate{"}}%
  \@ifundefined{initiate@active@char}{}{\bbl@deactivate{'}}%
}

\let\xpglla@savedvalues\empty
\AtEndPreamble{% 
  \edef\xpglla@savedvalues{%
    \clubpenalty=\the\clubpenalty\space
    \@clubpenalty=\the\@clubpenalty\space
    \widowpenalty=\the\widowpenalty\space
    \finalhyphendemerits=\the\finalhyphendemerits}%
}

\def\noextras@liturgicallatin{%
   \lccode\string"2019=\z@
   \noliturgicallatin@shorthands
   \xpglla@savedvalues 
}

\def\blockextras@liturgicallatin{%
   \lccode\string"2019=\string"2019
   \clubpenalty=3000 \@clubpenalty=3000 \widowpenalty=3000
   \finalhyphendemerits=50000000
   \ifliturgicallatin@babelshorthands\liturgicallatin@shorthands\fi
}

\def\inlineextras@liturgicallatin{%
   \lccode\string"2019=\string"2019
   \ifliturgicallatin@babelshorthands\liturgicallatin@shorthands\fi
%   \liturgicallatin@shorhands
}


%    \end{macrocode}
%\iffalse
%</laliturgic>
%\fi
%
% \Finale
%
\endinput
%%%%%
Da fare:
1) controllare se \classicuclccodes deve essere affiancato da un 
\noclassicuclccodes

Reply via email to