Skip to content

Commit

Permalink
Add Swedish localization (preliminary)
Browse files Browse the repository at this point in the history
See #35
  • Loading branch information
gusbrs committed Nov 24, 2024
1 parent f01b261 commit c3c2bd9
Show file tree
Hide file tree
Showing 7 changed files with 993 additions and 2 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ env:
babel-dutch
babel-italian
babel-russian
babel-swedish
beamer
bookmark
booktabs
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## [Unreleased](https://github.com/gusbrs/zref-clever/compare/v0.4.9...HEAD)

### Added
- Swedish localization (see issue
[#35](https://github.com/gusbrs/zref-clever/issues/35)).

### Changed
- The `declension` option from `\zcDeclareLanguage`, the `case` option from
`\zcLanguageSetup`, and the `d` general option (from `\zcref`) have been
Expand Down
290 changes: 290 additions & 0 deletions testfiles/zc-langfile-swedish01.lvt
Original file line number Diff line number Diff line change
@@ -0,0 +1,290 @@
\documentclass{book}

\input{regression-test}

\ExplSyntaxOn
\debug_on:n { check-declarations , deprecation }
\ExplSyntaxOff

\usepackage[swedish]{babel}

\usepackage{zref-clever}

% This file is intended to test the swedish language file.
\ExplSyntaxOn
\tl_new:N \g__test_tmpa_tl
\seq_new:N \g__test_tmpa_seq
\tl_gset:Nn \g__test_tmpa_tl { swedish } % base language
\seq_gset_from_clist:Nn \g__test_tmpa_seq % all aliases, including base
{
swedish ,
}
\ExplSyntaxOff

\begin{document}

\START

\ExplSyntaxOn

\TEST { Language~declaration }
{
\seq_map_inline:Nn \g__test_tmpa_seq
{
\tl_show:c { \__zrefclever_language_varname:n {#1} }
}
\seq_if_exist:cT
{ \__zrefclever_opt_varname_language:enn
{ \g__test_tmpa_tl } { variants } { seq }
}
{
\seq_show:c
{
\__zrefclever_opt_varname_language:enn
{ \g__test_tmpa_tl } { variants } { seq }
}
}
\seq_if_exist:cT
{
\__zrefclever_opt_varname_language:enn
{ \g__test_tmpa_tl } { gender } { seq }
}
{
\seq_show:c
{
\__zrefclever_opt_varname_language:enn
{ \g__test_tmpa_tl } { gender } { seq }
}
}
\bool_if_exist:cT
{
\__zrefclever_opt_varname_language:enn
{ \g__test_tmpa_tl } { allcaps } { bool }
}
{
\bool_show:c
{
\__zrefclever_opt_varname_language:enn
{ \g__test_tmpa_tl } { allcaps } { bool }
}
}
}


\TEST { Language~file~options }
{
\clist_map_inline:nn
{
namesep ,
pairsep ,
listsep ,
lastsep ,
tpairsep ,
tlistsep ,
tlastsep ,
notesep ,
rangesep ,
}
{
\tl_if_exist:cT
{
\__zrefclever_opt_varname_lang_default:enn
{ \g__test_tmpa_tl } { #1 } { tl }
}
{
\tl_show:c
{
\__zrefclever_opt_varname_lang_default:enn
{ \g__test_tmpa_tl } { #1 } { tl }
}
}
}
\clist_map_inline:nn
{
book ,
part ,
chapter ,
section ,
paragraph ,
appendix ,
page ,
line ,
figure ,
table ,
item ,
footnote ,
endnote ,
note ,
equation ,
theorem ,
lemma ,
corollary ,
proposition ,
definition ,
proof ,
result ,
remark ,
example ,
algorithm ,
listing ,
exercise ,
solution ,
}
{
\seq_if_exist:cT
{
\__zrefclever_opt_varname_lang_type:eenn
{ \g__test_tmpa_tl } { #1 } { gender } { seq }
}
{
\seq_show:c
{
\__zrefclever_opt_varname_lang_type:eenn
{ \g__test_tmpa_tl } { #1 } { gender } { seq }
}
}
\seq_if_exist:cTF
{
\__zrefclever_opt_varname_language:enn
{ \g__test_tmpa_tl } { variants } { seq }
}
{
\seq_map_inline:cn
{
\__zrefclever_opt_varname_language:enn
{ \g__test_tmpa_tl } { variants } { seq }
}
{
\clist_map_inline:nn
{
Name-sg ,
name-sg ,
Name-pl ,
name-pl ,
Name-sg-ab ,
name-sg-ab ,
Name-pl-ab ,
name-pl-ab ,
}
{
\tl_if_exist:cT
{
\__zrefclever_opt_varname_lang_type:eenn
{ \g__test_tmpa_tl }
{ #1 } { ##1 - ####1 } { tl }
}
{
\tl_show:c
{
\__zrefclever_opt_varname_lang_type:eenn
{ \g__test_tmpa_tl }
{ #1 } { ##1 - ####1 } { tl }
}
}
}
}
}
{
\clist_map_inline:nn
{
Name-sg ,
name-sg ,
Name-pl ,
name-pl ,
Name-sg-ab ,
name-sg-ab ,
Name-pl-ab ,
name-pl-ab ,
}
{
\tl_if_exist:cT
{
\__zrefclever_opt_varname_lang_type:eenn
{ \g__test_tmpa_tl } { #1 } { ##1 } { tl }
}
{
\tl_show:c
{
\__zrefclever_opt_varname_lang_type:eenn
{ \g__test_tmpa_tl } { #1 } { ##1 } { tl }
}
}
}
}
\clist_map_inline:nn
{
rangesep ,
}
{
\tl_if_exist:cT
{
\__zrefclever_opt_varname_lang_type:eenn
{ \g__test_tmpa_tl } { #1 } { ##1 } { tl }
}
{
\tl_show:c
{
\__zrefclever_opt_varname_lang_type:eenn
{ \g__test_tmpa_tl } { #1 } { ##1 } { tl }
}
}
}
\clist_map_inline:nn
{
rangetopair ,
}
{
\bool_if_exist:cT
{
\__zrefclever_opt_varname_lang_type:eenn
{ \g__test_tmpa_tl } { #1 } { ##1 } { bool }
}
{
\bool_show:c
{
\__zrefclever_opt_varname_lang_type:eenn
{ \g__test_tmpa_tl } { #1 } { ##1 } { bool }
}
}
}
}
\clist_map_inline:nn
{
equation ,
}
{
\clist_map_inline:nn
{
refbounds-first ,
refbounds-first-sg ,
refbounds-first-pb ,
refbounds-first-rb ,
refbounds-mid ,
refbounds-mid-rb ,
refbounds-mid-re ,
refbounds-last ,
refbounds-last-pe ,
refbounds-last-re ,
}
{
\seq_if_exist:cT
{
\__zrefclever_opt_varname_lang_type:eenn
{ \g__test_tmpa_tl } { #1 } { ##1 } { seq }
}
{
\seq_show:c
{
\__zrefclever_opt_varname_lang_type:eenn
{ \g__test_tmpa_tl } { #1 } { ##1 } { seq }
}
}
}
}
}

\ExplSyntaxOff

\OMIT

\end{document}
Loading

0 comments on commit c3c2bd9

Please sign in to comment.