% Language definition file (part of polyglossia v2.10 -- 2026/04/18)
%
%%
%% This is file `gloss-occitan.ldf',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% gloss-occitan.dtx  (with options: `ldf')
%%   ------------------------------------------------------------------
%%   The gloss-occitan module for polyglossia
%%   Copyright (C) 2016 Cédric Valmary
%%   All rights reserved
%% 
%%   Licence information appended
%% 
%%   Created by Cédric Valmary: cvalmary at yahoo dot fr
%%   of Tot en òc <http://www.totenoc.eu/>
%% 
\ProvidesFile{gloss-occitan.ldf}[polyglossia: module for Occitan]

\PolyglossiaSetup{occitan}{
  bcp47=oc,
  bcp47-language=oc,
  bcp47-script=Latn,
  hyphennames={occitan},
  langtag=OCI,
  hyphenmins={2,2},
  frenchspacing=true,
  indentfirst=true,
 }

% BCP-47 compliant aliases
\setlanguagealias*{occitan}{oc}

\DeclareKeys[polyglossia/gloss/occitan]
  {
    babelshorthands.if = occitan@babelshorthands,
    babelshorthands.default:n = true
  }

\ifsystem@babelshorthands
  \SetGlossOptions{occitan}{babelshorthands=true}
  % Register default options
  \InitializeGlossOptions{occitan}{babelshorthands=true}
\else
  \SetGlossOptions{occitan}{babelshorthands=false}
  % Register default options
  \InitializeGlossOptions{occitan}{babelshorthands=false}
\fi

\InitializeBabelShorthands

\def\occitan@shorthands{%
  \xpg@activate@shorthands%
  \def\language@group{occitan}%
  \declare@shorthand{occitan}{"}{%
    \relax\ifmmode
      \def\xpgoc@next{''}%
    \else
      \def\xpgoc@next{\futurelet\xpgoc@temp\xpgoc@cwm}%
    \fi
  \xpgoc@next}%
}
\def\xpgoc@@cwm{\nobreak\discretionary{-}{}{}\nobreak\hskip\z@skip}
\def\xpgoc@ponchinterior{%
      \nobreak\discretionary{-}{}{\mbox{$\cdot$}}\nobreak\hskip\z@skip}
\def\xpgoc@cwm{\let\xpgoc@@next\relax
  \ifcat\noexpand\xpgoc@temp a%
                         \def\xpgoc@@next{\xpgoc@@cwm}%
  \else
    \if\noexpand\xpgoc@temp \string|%
      \def\xpgoc@@next##1{\xpgoc@@cwm}%
    \else
      \if\noexpand\xpgoc@temp \string<%
        \def\xpgoc@@next##1{«\ignorespaces}%
      \else
        \if\noexpand\xpgoc@temp \string>%
          \def\xpgoc@@next##1{\unskip»}%
        \else
          \if\noexpand\xpgoc@temp\string/%
            \def\xpgoc@@next##1{\slash}%
          \else
            \if\noexpand\xpgoc@temp\string.%
              \def\xpgoc@@next##1{\xpgoc@ponchinterior}%
            \fi
          \fi
        \fi
      \fi
    \fi
  \fi
  \xpgoc@@next%
}

\def\nooccitan@shorthands{%
  \xpg@deactivate@shorthands%
}
\def\captionsoccitan{%
   \def\refname{Referéncias}%
   \def\abstractname{Resumit}%
   \def\bibname{Bibliografia}%
   \def\prefacename{Prefaci}%
   \def\chaptername{Capítol}%
   \def\appendixname{Annèx}%
   \def\contentsname{Ensenhador}%
   \def\listfigurename{Taula de las figuras}%
   \def\listtablename{Taula dels tablèus}%
   \def\indexname{Indèx}%
   \def\figurename{Figura}%
   \def\tablename{Tablèu}%
   %\def\thepart{}%
   \def\partname{Partida}%
   \def\pagename{Pagina}%
   \def\seename{vejatz}%
   \def\alsoname{vejatz tanben}%
   \def\enclname{Pèça junta}%
   \def\ccname{còpia a}%
   \def\headtoname{A}%
   \def\proofname{Demostracion}%
   \def\glossaryname{Glossari}%
}
\def\dateoccitan{%
   \def\occitanmonth{\ifcase\month\or
      de~genièr\or
      de~febrièr\or
      de~març\or
      d'abril\or
      de~mai\or
      de~junh\or
      de~julhet\or
      d'agost\or
      de~setembre\or
      d'octobre\or
      de~novembre\or
      de~decembre\fi
   }%
   \def\occitanday{\ifcase\day\or
      1èr\else% primièr
      \number\day\fi% all other numbers
   }%
   \def\today{\occitanday\space \occitanmonth\space de~\number\year}%
}
\let\xpgoc@savedvalues\empty
\AddToHook{begindocument/before}{% the user or the class might define different values
  \edef\xpgoc@savedvalues{%
    \clubpenalty=\the\clubpenalty\space
    \@clubpenalty=\the\@clubpenalty\space
    \widowpenalty=\the\widowpenalty\space
    \finalhyphendemerits=\the\finalhyphendemerits}
}
\def\noextras@occitan{%
   \lccode\string"2019=\z@%
   \ifoccitan@babelshorthands\nooccitan@shorthands\fi%
   \xpgoc@savedvalues%
}
\def\blockextras@occitan{%
   \lccode\string"2019=\string"2019%
   \clubpenalty=3000 \@clubpenalty=3000 \widowpenalty=3000%
   \finalhyphendemerits=50000000%
   \ifoccitan@babelshorthands\occitan@shorthands\else\nooccitan@shorthands\fi%
}

\def\inlineextras@occitan{%
   \lccode\string"2019=\string"2019%
   \ifoccitan@babelshorthands\occitan@shorthands\else\nooccitan@shorthands\fi%
}
%% Distributable under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of
%% this license is at: http://www.latex-project.org/lppl.txt
%% 
%% This work is "author-maintained"
%% The maintainer is Cédric Valmary
%% 
%%
%% End of file `gloss-occitan.ldf'.
