# Package and/or macro for producing a bi-lingual dictionary/glossary?

A use case is simple, say you write a computer science text book for pirates. Then, each time you mention a term, you may need to mention its English equivalent. So, instead of writing,

 Ye first proggie today will be Ahoy, World!''


You would like to write:

 Ye first \term{proggie} today will be \term{Ahoy}, World}!''


where, in a separate file, you make a list of all terms, and their English equivalent, e.g. \termdef{ahoy}{hello}, and \termdef{proggie}{program}.

The \term macro (use of the word in context) should do the following:

1. Add a footnote of the English equivalent.
2. Add itself to a Pirates-to-English dictionary
3. Add itself to an English-to-pirate dictionary.

Now, it seems as if the glossaries package can almost do that. The main difficulty is in dealing with word forms. glossaries can do plurals, but the Pirates language has many more word forms, e.g., you could write in your term definitions file,

\termdef{progie}{program}
\termdef{progee}{program}


Or better yet, instead of defining all possible word forms, have the text mention the principal formthe text, refer to the principal form of the word.

After writing the \term[progie]{progee}, you have to compile it.


What I would like is that the the first footnote includes the principal word form, not the current variant.

Also, I am not sure as to how I should use the package to produce two glossaries instead of one, each with its own sorting.

(A previous question dealt with a similar topic (Icelandic vs. Pirates), but the difficulties remain: first footnote should mention the principal form of the word, and the issue of producing two glossaries instead of one.)

-

Here is a partial answer, redefine glossaries internal (?) control sequence \glsdisplayfirst to (a) display the current word form, and (b) to place a footnote with the root form. Here is how:

\renewcommand\glsdisplayfirst[4]{#1\footnote{\glslabel=#2}}


Note that the \glslabel control sequence provides the root form of the word. The following definition will make it easy to use any word form in your text:

\newcommand\newterm[2]{\newglossaryentry{#1}{name=#1,description=#2}}
\newcommand\term[2][\relax]{\ifx#1\relax\gls{#2}\else\glsdisp{#1}{#2}\fi}


Here is a full example:

\documentclass{article}
\usepackage{glossaries}
\renewcommand\glsdisplayfirst[4]{#1\footnote{\glslabel=#2}}
\newcommand\newterm[2]{\newglossaryentry{#1}{name=#1,description=#2}}
\newcommand\term[2][\relax]{%
\ifx#1\relax
\gls{#2}%
\else
\glsdisp{#1}{#2}%
\fi
}
\makeglossaries

\newterm{ahoy}{hello}
\newterm{progee}{program}
\newterm{picaroon}{pirate}

\begin{document}
\section{Programming for \term[picaroon]{Picaroons}}
Ye first \term[progee]{proggie} today will be \term[ahoy]{Ahoy}, World!''.
Nice \term{progee}, ain't it?

\printglossaries
\end{document}


I still do not know how to automatically create the inverse dictionary.

-