\ifx\initiate@active@char\@undefined
\else
  \bbl@afterfi\endinput
\fi
\ProvidesFile{babelsh.def}
         [2009/05/07 %
         Babel common definitions for shorthands^^J
         Taken verbatim from babel.def (2008/07/06 v3.8l)]
\def\bbl@add@special#1{\begingroup
    \def\do{\noexpand\do\noexpand}%
    \def\@makeother{\noexpand\@makeother\noexpand}%
    \edef\x{\endgroup
      \def\noexpand\dospecials{\dospecials\do#1}%
      \expandafter\ifx\csname @sanitize\endcsname\relax \else
        \def\noexpand\@sanitize{\@sanitize\@makeother#1}%
      \fi}%
  \x}
\def\bbl@remove@special#1{\begingroup
    \def\x##1##2{\ifnum`#1=`##2\noexpand\@empty
                 \else\noexpand##1\noexpand##2\fi}%
    \def\do{\x\do}%
    \def\@makeother{\x\@makeother}%
    \edef\x{\endgroup
      \def\noexpand\dospecials{\dospecials}%
      \expandafter\ifx\csname @sanitize\endcsname\relax \else
        \def\noexpand\@sanitize{\@sanitize}%
      \fi}%
  \x}
\long\def\bbl@afterelse#1\else#2\fi{\fi#1}
\long\def\bbl@afterfi#1\fi{\fi#1}
\def\initiate@active@char#1{%
  \expandafter\ifx\csname active@char\string##1\endcsname\relax
    \bbl@afterfi{\@initiate@active@char{#1}}%
  \fi}
\begingroup
  \catcode`\~\active
  \def\x{\endgroup
    \def\@initiate@active@char##1{%
      \ifcat\noexpand##1\noexpand~\relax
        \@ifundefined{normal@char\string##1}{%
          \expandafter\let\csname normal@char\string##1\endcsname##1%
          \expandafter\gdef
            \expandafter##1%
            \expandafter{%
              \expandafter\active@prefix\expandafter##1%
              \csname normal@char\string##1\endcsname}}{}%
      \else
        \@activated{##1}%
        \@namedef{normal@char\string##1}{##1}%
        \ifx##1'%
          \let\prim@s\bbl@prim@s
          \@namedef{normal@char\string##1}{%
            \textormath{##1}{^\bgroup\prim@s}}%
        \fi
        \ifx##1^%
          \gdef\bbl@act@caret{%
            \ifmmode
              \csname normal@char\string^\endcsname
            \else
              \bbl@afterfi
              {\if@safe@actives
                \bbl@afterelse\csname normal@char\string##1\endcsname
               \else
                \bbl@afterfi\csname user@active\string##1\endcsname
               \fi}%
            \fi}
        \fi
        %%\@ifpackagewith{babel}{KeepShorthandsActive}{}{%
          \edef\bbl@tempa{\catcode`\noexpand##1\the\catcode`##1}%
          \expandafter\AtEndOfPackage\expandafter{\bbl@tempa}%
        %%}%
        \@tempcnta=\lccode`\~
        \lccode`~=`##1%
        \lowercase{%
          \catcode`~\active
          \expandafter\bbl@add@special
            \csname \string##1\endcsname
            \AtBeginDocument{%
              \catcode`##1\active
              \if@filesw
                \immediate\write\@mainaux{%
                  \string\catcode`##1\string\active}%
              \fi}%
          \expandafter\gdef
            \expandafter~%
            \expandafter{%
            \expandafter\active@prefix\expandafter##1%
            \csname normal@char\string##1\endcsname}}%
        \lccode`\~\@tempcnta
      \fi
      \ifx##1^%
        \@namedef{active@char\string##1}{\bbl@act@caret}%
      \else
        \@namedef{active@char\string##1}{%
          \if@safe@actives
            \bbl@afterelse\csname normal@char\string##1\endcsname
          \else
            \bbl@afterfi\csname user@active\string##1\endcsname
          \fi}%
      \fi
      \@namedef{user@active\string##1}{%
        \expandafter\ifx
        \csname \user@group @sh@\string##1@\endcsname
        \relax
          \bbl@afterelse\bbl@sh@select\user@group##1%
        {user@active@arg\string##1}{language@active\string##1}%
        \else
          \bbl@afterfi\csname \user@group @sh@\string##1@\endcsname
        \fi}%
      \long\@namedef{user@active@arg\string##1}####1{%
        \expandafter\ifx
        \csname \user@group @sh@\string##1@\string####1@\endcsname
        \relax
          \bbl@afterelse
          \csname language@active\string##1\endcsname####1%
        \else
          \bbl@afterfi
          \csname \user@group @sh@\string##1@\string####1@%
          \endcsname
        \fi}%
      \@namedef{\user@group @sh@\string##1@@}{%
        \csname normal@char\string##1\endcsname}
      \@namedef{language@active\string##1}{%
        \expandafter\ifx
        \csname \language@group @sh@\string##1@\endcsname
        \relax
          \bbl@afterelse\bbl@sh@select\language@group##1%
          {language@active@arg\string##1}{system@active\string##1}%
        \else
          \bbl@afterfi
          \csname \language@group @sh@\string##1@\endcsname
        \fi}%
      \long\@namedef{language@active@arg\string##1}####1{%
        \expandafter\ifx
        \csname \language@group @sh@\string##1@\string####1@\endcsname
        \relax
          \bbl@afterelse
          \csname system@active\string##1\endcsname####1%
        \else
          \bbl@afterfi
          \csname \language@group @sh@\string##1@\string####1@%
          \endcsname
        \fi}%
      \@namedef{system@active\string##1}{%
        \expandafter\ifx
        \csname \system@group @sh@\string##1@\endcsname
        \relax
          \bbl@afterelse\bbl@sh@select\system@group##1%
          {system@active@arg\string##1}{normal@char\string##1}%
        \else
          \bbl@afterfi\csname \system@group @sh@\string##1@\endcsname
        \fi}%
      \long\@namedef{system@active@arg\string##1}####1{%
        \expandafter\ifx
        \csname \system@group @sh@\string##1@\string####1@\endcsname
        \relax
          \bbl@afterelse\csname normal@char\string##1\endcsname####1%
        \else
          \bbl@afterfi
          \csname \system@group @sh@\string##1@\string####1@\endcsname
        \fi}%
      \@namedef{user@sh@\string##1@\string\protect@}{%
        \csname user@active\string##1\endcsname}%
      }%
    }\x
\def\bbl@sh@select#1#2{%
  \expandafter\ifx\csname#1@sh@\string#2@sel\endcsname\relax
    \bbl@afterelse\bbl@scndcs
  \else
    \bbl@afterfi\csname#1@sh@\string#2@sel\endcsname
  \fi
}
\def\active@prefix#1{%
  \ifx\protect\@typeset@protect
  \else
    \ifx\protect\@unexpandable@protect
      \bbl@afterelse\bbl@afterfi\noexpand#1\@gobble
    \else
      \bbl@afterfi\bbl@afterfi\protect#1\@gobble
    \fi
  \fi}
\newif\if@safe@actives
\@safe@activesfalse
\def\bbl@restore@actives{\if@safe@actives\@safe@activesfalse\fi}
\def\bbl@activate#1{%
  \expandafter\def
  \expandafter#1\expandafter{%
    \expandafter\active@prefix
    \expandafter#1\csname active@char\string#1\endcsname}%
}
\def\bbl@deactivate#1{%
  \expandafter\def
  \expandafter#1\expandafter{%
    \expandafter\active@prefix
    \expandafter#1\csname normal@char\string#1\endcsname}%
}
\def\bbl@firstcs#1#2{\csname#1\endcsname}
\def\bbl@scndcs#1#2{\csname#2\endcsname}
\def\declare@shorthand#1#2{\@decl@short{#1}#2\@nil}
\def\@decl@short#1#2#3\@nil#4{%
  \def\bbl@tempa{#3}%
  \ifx\bbl@tempa\@empty
    \expandafter\let\csname #1@sh@\string#2@sel\endcsname\bbl@scndcs
    \@namedef{#1@sh@\string#2@}{#4}%
  \else
    \expandafter\let\csname #1@sh@\string#2@sel\endcsname\bbl@firstcs
    \@namedef{#1@sh@\string#2@\string#3@}{#4}%
  \fi}
\def\textormath#1#2{%
  \ifmmode
    \bbl@afterelse#2%
  \else
    \bbl@afterfi#1%
  \fi}
\def\user@group{user}
\def\language@group{english}
\def\system@group{system}
\def\useshorthands#1{%
  \def\user@group{user}%
  \initiate@active@char{#1}%
  \@tempcnta\lccode`\~
  \lccode`~=`#1%
  \lowercase{\catcode`~\active\bbl@activate{~}}%
  \lccode`\~\@tempcnta}
\def\defineshorthand{\declare@shorthand{user}}
\def\languageshorthands#1{\def\language@group{#1}}
\def\aliasshorthand#1#2{%
  \expandafter\ifx\csname active@char\string#2\endcsname\relax
     \ifx\document\@notprerr
       \@notshorthand{#2}
     \else
       \initiate@active@char{#2}%
       \@tempcnta\lccode`\~
       \lccode`~=`#2%
       \lowercase{\let~#1}%
       \lccode`\~\@tempcnta
     \fi
   \fi
}
\def\@notshorthand#1{%
       \PackageError{polyglossia}{%
         The character `\string #1' should be made
         a shorthand character;\MessageBreak
         add the command \string\useshorthands\string{#1\string} to
         the preamble.\MessageBreak
         I will ignore your instruction}{}%
   }
\newcommand*\shorthandon[1]{\bbl@switch@sh{on}#1\@nil}
\newcommand*\shorthandoff[1]{\bbl@switch@sh{off}#1\@nil}
\def\bbl@switch@sh#1#2#3\@nil{%
  \@ifundefined{active@char\string#2}{%
    \PackageError{polyglossia}{%
      The character '\string #2' is not a shorthand character
      in \languagename}{%
      Maybe you made a typing mistake?\MessageBreak
      I will ignore your instruction}}{%
    \csname bbl@switch@sh@#1\endcsname#2}%
  \ifx#3\@empty\else
    \bbl@afterfi\bbl@switch@sh{#1}#3\@nil
  \fi}
\def\bbl@switch@sh@off#1{\catcode`#112\relax}
\begingroup
  \catcode`\~\active
  \def\x{\endgroup
    \def\bbl@switch@sh@on##1{%
      \begingroup
      \lccode`~=`##1%
      \lowercase{\endgroup
        \catcode`~\active
        }%
      }%
    }
\x
\declare@shorthand{system}{"}{\csname normal@char\string"\endcsname}
\declare@shorthand{system}{'}{%
  \textormath{\csname normal@char\string'\endcsname}%
             {\sp\bgroup\prim@s}}
\declare@shorthand{system}{`}{\csname normal@char\string`\endcsname}
\def\bbl@prim@s{%
  \prime\futurelet\@let@token\bbl@pr@m@s}
\begingroup
  \catcode`\'\active\let'\relax
  \def\x{\endgroup
    \def\bbl@pr@m@s{%
      \ifx'\@let@token
        \expandafter\pr@@@s
      \else
        \ifx^\@let@token
          \expandafter\expandafter\expandafter\pr@@@t
        \else
          \egroup
        \fi
      \fi}%
    }
\x
\initiate@active@char{~}
\declare@shorthand{system}{~}{\leavevmode\nobreak\ }
\bbl@activate{~}
\def\bbl@disc#1#2{%
  \nobreak\discretionary{#2-}{}{#1}\allowhyphens}
\def\bbl@t@one{T1}
\def\allowhyphens{%
  \ifx\cf@encoding\bbl@t@one\else\bbl@allowhyphens\fi}
\def\bbl@allowhyphens{\nobreak\hskip\z@skip}
%HERE ENDS THE CODE COPIED FROM babel.def -------------------- 
\def\bbl@disc@german#1#2{%
  \nobreak\discretionary{#2-}{}{#1}}
\endinput
