text: \ProvidesFile{gloss-croatian.ldf}[polyglossia: module for croatian]
  \PolyglossiaSetup{croatian}{
    bcp47=hr,
    langtag=HRV,
    hyphennames={croatian},
    hyphenmins={2,2}, % aligned with https://ctan.org/pkg/hrhyph patterns and http://lebesgue.math.hr/~nenad/Diplomski/Maja_Ribaric_2011.pdf
    frenchspacing=true, % recommendation from Damir Bralić
    indentfirst=false, % recommendation from Damir Bralić
    fontsetup=true
  }
  
  % BCP-47 compliant aliases
  \setlanguagealias*{croatian}{hr}
  
  \define@boolkey{croatian}[croatian@]{babelshorthands}[true]{}
  
  \define@boolkey{croatian}[croatian@]{disableligatures}[true]{}
  
  % Register default options
  \xpg@initialize@gloss@options{croatian}{babelshorthands=false,disableligatures=false}
  
  \ifsystem@babelshorthands
    \setkeys{croatian}{babelshorthands=true}
  \else
    \setkeys{croatian}{babelshorthands=false}
  \fi
  
  \ifcsundef{initiate@active@char}{%
    \input{babelsh.def}%
    \initiate@active@char{"}%
    \shorthandoff{"}%
  }{}
  
  \def\croatian@shorthands{%
    \bbl@activate{"}%
    \def\language@group{croatian}%
    \declare@shorthand{croatian}{"=}{\penalty\@M-\hskip\z@skip}%
    \declare@shorthand{croatian}{""}{\hskip\z@skip}%
    \declare@shorthand{croatian}{"~}{\textormath{\leavevmode\hbox{-}}{-}}%
    \declare@shorthand{croatian}{"-}{\nobreak\-\bbl@allowhyphens}%
    \declare@shorthand{croatian}{"|}{%
        \textormath{\penalty\@M\discretionary{-}{}{\kern.03em}%
        \bbl@allowhyphens}{}%
    }%
    \declare@shorthand{croatian}{"/}{\textormath
      {\bbl@allowhyphens\discretionary{/}{}{/}\bbl@allowhyphens}{}}%
    \declare@shorthand{croatian}{"`}{„}%
    \declare@shorthand{croatian}{"'}{”}%
    \declare@shorthand{croatian}{"<}{«}%
    \declare@shorthand{croatian}{">}{»}%
    \declare@shorthand{croatian}{"D}{\xpg@hr@lig{D}}%
    \declare@shorthand{croatian}{"d}{\xpg@hr@lig{d}}%
    \declare@shorthand{croatian}{"L}{\xpg@hr@lig{L}}%
    \declare@shorthand{croatian}{"l}{\xpg@hr@lig{l}}%
    \declare@shorthand{croatian}{"N}{\xpg@hr@lig{N}}%
    \declare@shorthand{croatian}{"n}{\xpg@hr@lig{n}}%
  }
  
  \def\nocroatian@shorthands{%
    \@ifundefined{initiate@active@char}{}{\bbl@deactivate{"}}%
  }
  
  \newcommand*\hr@charifavailable[2]{%
     \ifcroatian@disableligatures
       \bgroup#2\egroup%
     \else
       \charifavailable{#1}{#2}%
     \fi%
  }
  
  % Provide croatian ligatures if available in current font
  \def\xpg@hr@lig#1#2{%
   \bgroup%
    % 1. DŽ, Dž and dž
    \ifx#1D%
      \ifx#2Z\relax%
         \hr@charifavailable{01C4}{DŽ}%
      \else%
         \ifx#2z\relax
            \hr@charifavailable{01C5}{Dž}%
         \else
             D#2%
         \fi%
      \fi%
    \fi%
    \ifx#1d%
      \ifx#2z\relax
         \hr@charifavailable{01C6}{dž}%
      \else
         d#2%
      \fi%
    \fi%
    % 2. LJ, Lj and lj
    \ifx#1L%
      \ifx#2J\relax%
         \hr@charifavailable{01C7}{LJ}%
      \else%
         \ifx#2j\relax
            \hr@charifavailable{01C8}{Lj}%
         \else
             L#2%
         \fi%
      \fi%
    \fi%
    \ifx#1l%
      \ifx#2j\relax
         \hr@charifavailable{01C9}{lj}%
      \else
         l#2%
      \fi%
    \fi%
    % 2. NJ, Nj and nj
    \ifx#1N%
      \ifx#2J\relax%
         \hr@charifavailable{01CA}{NJ}%
      \else%
         \ifx#2j\relax
            \hr@charifavailable{01CB}{Nj}%
         \else
             N#2%
         \fi%
      \fi%
    \fi%
    \ifx#1n%
      \ifx#2j\relax
         \hr@charifavailable{01CC}{nj}%
      \else
         n#2%
      \fi%
    \fi%
    \egroup%
  }
  
  \def\captionscroatian{%
    \def\prefacename{Predgovor}%
    \def\refname{Literatura}%
    \def\abstractname{Sažetak}%
    \def\bibname{Bibliografija}%
    \def\chaptername{Poglav\hr@charifavailable{01C9}{lj}e}%
    \def\appendixname{Dodatak}%
    \def\contentsname{Sadržaj}%
    \def\listfigurename{Popis slika}%
    \def\listtablename{Popis tablica}%
    \def\indexname{Kazalo}%
    \def\figurename{Slika}%
    \def\tablename{Tablica}%
    \def\partname{Dio}%
    \def\enclname{Prilozi}%
    \def\ccname{Kopija}%
    \def\headtoname{Prima}%
    \def\pagename{Stranica}%
    \def\seename{Vidjeti}%
    \def\alsoname{Također vidjeti}%
    \def\proofname{Dokaz}%
    \def\glossaryname{Pojmovnik}%
  }
  
  \def\datecroatian{%
    \def\today{\number\day.~\ifcase\month\or
      siječnja\or veljače\or ožujka\or travnja\or svibnja\or
      lipnja\or srpnja\or kolovoza\or rujna\or listopada\or studenoga\or
      prosinca\fi \space \number\year.}%
  }
  
  \def\noextras@croatian{%
    \ifcroatian@babelshorthands\nocroatian@shorthands\fi%
  }
  
  \def\blockextras@croatian{%
    \ifcroatian@babelshorthands\croatian@shorthands\fi%
  }
  
  \def\inlineextras@croatian{%
    \ifcroatian@babelshorthands\croatian@shorthands\fi%
  }
  
  \endinput
  