Set languages via package options
To define the languages for the dictionary the package options primary and secondary have to be set.
This commit is contained in:
parent
8a6bc1c949
commit
01849f4046
2 changed files with 13 additions and 2 deletions
|
@ -9,5 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Added
|
||||
|
||||
- Set the languages of the dictionary by using the package options
|
||||
`primary` and `secondary`.
|
||||
- Create the `dictionary` environment where the
|
||||
`\entry{word}{description}` command can be used.
|
||||
|
|
|
@ -4,6 +4,15 @@
|
|||
\RequirePackage{babel}
|
||||
\RequirePackage{datatool}
|
||||
|
||||
\DeclareKeys[dictionary]{
|
||||
primary.store = \@dictionary@primary,
|
||||
secondary.store = \@dictionary@secondary
|
||||
}
|
||||
|
||||
\ProcessKeyOptions[dictionary]
|
||||
|
||||
\PassOptionsToPackage{\@dictionary@primary,\@dictionary@secondary}{babel}
|
||||
|
||||
\newcommand{\entry}[2]{%
|
||||
\DTLnewrow{dictionary}%
|
||||
\DTLnewdbentry{dictionary}{word}{#1}%
|
||||
|
@ -16,6 +25,6 @@
|
|||
\DTLsort{word}{dictionary}%
|
||||
\scriptsize%
|
||||
\DTLforeach*{dictionary}{\word=word,\translation=translation}{%
|
||||
\selectlanguage{vietnamese}\textbf{\word:} \selectlanguage{naustrian}\translation\\}%
|
||||
\selectlanguage{vietnamese}%
|
||||
\selectlanguage{\@dictionary@primary}\textbf{\word:} \selectlanguage{\@dictionary@secondary}\translation\\}%
|
||||
\selectlanguage{\@dictionary@primary}%
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue