From 08704ece89438d6c40c2e673c25c38906294712a Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Wed, 24 Oct 2012 23:27:48 +0000
Subject: fmtcount (24oct12)

git-svn-id: svn://tug.org/texlive/trunk@28068 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/fmtcount/fmtcount.sty | 208 +++++++---------------
 1 file changed, 61 insertions(+), 147 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/fmtcount/fmtcount.sty')

diff --git a/Master/texmf-dist/tex/latex/fmtcount/fmtcount.sty b/Master/texmf-dist/tex/latex/fmtcount/fmtcount.sty
index 940f3aea2ca..22545873e48 100644
--- a/Master/texmf-dist/tex/latex/fmtcount/fmtcount.sty
+++ b/Master/texmf-dist/tex/latex/fmtcount/fmtcount.sty
@@ -49,19 +49,34 @@
 %%\cs{latinnumeralstringnum}\marg{number}\oarg{prefix options}
 %%\end{definition}
 \NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{fmtcount}[2012/09/28 v2.01]
+\ProvidesPackage{fmtcount}[2012/10/24 v2.02]
 \RequirePackage{ifthen}
 \RequirePackage{keyval}
 \RequirePackage{etoolbox}
+\RequirePackage{fcprefix}
 \RequirePackage{amsgen}
 \providecommand*{\fmtord}[1]{\textsuperscript{#1}}
 \newcount\c@padzeroesN
 \c@padzeroesN=1\relax
 \providecommand*{\padzeroes}[1][17]{\c@padzeroesN=#1}
+\newcount\fc@tmpcatcode
+\def\fc@languages{}
+\def\fc@mainlang{}%
 \newcommand*{\FCloadlang}[1]{%
   \@FC@iflangloaded{#1}{}%
   {%
+    \fc@tmpcatcode=\catcode`\@\relax
+    \catcode `\@ 11\relax
     \input{fc-#1.def}%
+    \catcode `\@ \fc@tmpcatcode\relax
+    \ifdefempty{\fc@languages}%
+    {%
+      \def\fc@languages{#1}%
+    }%
+    {%
+       \appto\fc@languages{,#1}%
+    }%
+    \def\fc@mainlang{#1}%
   }%
 }
 \newcommand{\@FC@iflangloaded}[3]{%
@@ -946,186 +961,85 @@
   \let\@ordinalF=\@ordinalM
   \let\@ordinalN=\@ordinalM
 }
-\def\@set@mulitling@fmtcount{%
-  \def\@numberstringM{%
-    \@ifundefined{@numberstringM\languagename}%
+\newcommand*{\fc@multiling}[2]{%
+  \ifcsundef{@#1#2\languagename}%
+  {% try loading it
+     \FCloadlang{\languagename}%
+  }%
+  {%
+  }%
+  \ifcsundef{@#1#2\languagename}%
+  {%
+    \PackageWarning{fmtcount}%
+    {No support for \expandafter\string\csname#1\endcsname\space for
+     language '\languagename'}%
+    \ifthenelse{\equal{\languagename}{\fc@mainlang}}%
     {%
-      \PackageWarning{fmtcount}%
-      {No support for \string\numberstring\space for
-       language '\languagename'}%
-      \@numberstringMenglish
+       \FCloadlang{english}%
     }%
     {%
-      \csname @numberstringM\languagename\endcsname
     }%
-  }%
-  \def\@numberstringF{%
-    \@ifundefined{@numberstringF\languagename}%
+    \ifcsdef{@#1#2\fc@mainlang}%
     {%
-      \PackageWarning{fmtcount}%
-      {No support for \string\numberstring\space for
-       language '\languagename'}%
-      \@numberstringMenglish
+       \csuse{@#1#2\fc@mainlang}%
     }%
     {%
-      \csname @numberstringF\languagename\endcsname
+       \PackageWarningNoLine{fmtcount}%
+       {No languages loaded at all! Loading english definitions}%
+       \FCloadlang{english}%
+       \def\fc@mainlang{english}%
+       \csuse{@#1#2english}%
     }%
   }%
+  {%
+    \csuse{@#1#2\languagename}%
+  }%
+}
+\def\@set@mulitling@fmtcount{%
+  \def\@numberstringM{%
+    \fc@multiling{numberstring}{M}%
+  }%
+  \def\@numberstringF{%
+    \fc@multiling{numberstring}{F}%
+  }%
   \def\@numberstringN{%
-    \@ifundefined{@numberstringN\languagename}%
-    {%
-      \PackageWarning{fmtcount}%
-      {No support for \string\numberstring\space for
-       language '\languagename'}%
-      \@numberstringMenglish
-    }%
-    {%
-      \csname @numberstringN\languagename\endcsname
-    }%
+    \fc@multiling{numberstring}{N}%
   }%
   \def\@NumberstringM{%
-    \@ifundefined{@NumberstringM\languagename}%
-    {%
-      \PackageWarning{fmtcount}%
-      {No support for \string\Numberstring\space
-       for language '\languagename'}%
-      \@NumberstringMenglish
-    }%
-    {%
-      \csname @NumberstringM\languagename\endcsname
-    }%
+    \fc@multiling{Numberstring}{M}%
   }%
   \def\@NumberstringF{%
-    \@ifundefined{@NumberstringF\languagename}%
-    {%
-      \PackageWarning{fmtcount}%
-      {No support for \string\Numberstring\space
-       for language '\languagename'}%
-      \@NumberstringMenglish
-    }%
-    {%
-      \csname @NumberstringF\languagename\endcsname
-    }%
+    \fc@multiling{Numberstring}{F}%
   }%
   \def\@NumberstringN{%
-    \@ifundefined{@NumberstringN\languagename}%
-    {%
-      \PackageWarning{fmtcount}%
-      {No support for \string\Numberstring\space
-       for language '\languagename'}%
-      \@NumberstringMenglish
-    }%
-    {%
-      \csname @NumberstringN\languagename\endcsname
-    }%
+    \fc@multiling{Numberstring}{N}%
   }%
   \def\@ordinalM{%
-    \@ifundefined{@ordinalM\languagename}%
-    {%
-      \PackageWarning{fmtcount}%
-      {No support for \string\ordinal\space
-       for language '\languagename'}%
-      \@ordinalMenglish
-    }%
-    {%
-      \csname @ordinalM\languagename\endcsname
-    }%
+    \fc@multiling{ordinal}{M}%
   }%
   \def\@ordinalF{%
-    \@ifundefined{@ordinalF\languagename}%
-    {%
-      \PackageWarning{fmtcount}%
-      {No support for \string\ordinal\space
-       for language '\languagename'}%
-      \@ordinalMenglish
-    }%
-    {%
-      \csname @ordinalF\languagename\endcsname
-    }%
+    \fc@multiling{ordinal}{F}%
   }%
   \def\@ordinalN{%
-    \@ifundefined{@ordinalN\languagename}%
-    {%
-      \PackageWarning{fmtcount}%
-      {No support for \string\ordinal\space
-       for language '\languagename'}%
-      \@ordinalMenglish
-    }%
-    {%
-      \csname @ordinalN\languagename\endcsname
-    }%
+    \fc@multiling{ordinal}{N}%
   }%
   \def\@ordinalstringM{%
-    \@ifundefined{@ordinalstringM\languagename}%
-    {%
-      \PackageWarning{fmtcount}%
-      {No support for \string\ordinalstring\space
-      for language '\languagename'}%
-      \@ordinalstringMenglish
-    }%
-    {%
-      \csname @ordinalstringM\languagename\endcsname
-    }%
+    \fc@multiling{ordinalstring}{M}%
   }%
   \def\@ordinalstringF{%
-    \@ifundefined{@ordinalstringF\languagename}%
-    {%
-      \PackageWarning{fmtcount}%
-      {No support for \string\ordinalstring\space
-       for language '\languagename'}%
-      \@ordinalstringMenglish
-    }%
-    {%
-      \csname @ordinalstringF\languagename\endcsname
-    }%
+    \fc@multiling{ordinalstring}{F}%
   }%
   \def\@ordinalstringN{%
-    \@ifundefined{@ordinalstringN\languagename}%
-    {%
-      \PackageWarning{fmtcount}%
-      {No support for \string\ordinalstring\space
-       for language '\languagename'}%
-      \@ordinalstringMenglish
-    }%
-    {%
-      \csname @ordinalstringN\languagename\endcsname
-    }%
+    \fc@multiling{ordinalstring}{N}%
   }%
   \def\@OrdinalstringM{%
-    \@ifundefined{@OrdinalstringM\languagename}%
-    {%
-      \PackageWarning{fmtcount}%
-      {No support for \string\Ordinalstring\space
-       for language '\languagename'}%
-      \@OrdinalstringMenglish
-    }%
-    {%
-      \csname @OrdinalstringM\languagename\endcsname
-    }%
+    \fc@multiling{Ordinalstring}{M}%
   }%
   \def\@OrdinalstringF{%
-    \@ifundefined{@OrdinalstringF\languagename}%
-    {%
-      \PackageWarning{fmtcount}%
-      {No support for \string\Ordinalstring\space
-       for language '\languagename'}%
-      \@OrdinalstringMenglish
-    }%
-    {%
-      \csname @OrdinalstringF\languagename\endcsname
-    }%
+    \fc@multiling{Ordinalstring}{F}%
   }%
   \def\@OrdinalstringN{%
-    \@ifundefined{@OrdinalstringN\languagename}%
-    {%
-      \PackageWarning{fmtcount}%
-      {No support for \string\Ordinalstring\space
-       for language '\languagename'}%
-      \@OrdinalstringMenglish
-    }%
-    {%
-      \csname @OrdinalstringN\languagename\endcsname
-    }%
+    \fc@multiling{Ordinalstring}{N}%
   }%
 }
 \@ifpackageloaded{babel}%
-- 
cgit v1.2.3

