michal-h21 / luavlna

Small library for plain luatex for preventing single
7 stars 1 forks source link

wrong language ID detection – continued #9

Open mbudaj opened 3 years ago

mbudaj commented 3 years ago

As a follow-up to issue #6 and the workaround in https://github.com/michal-h21/luavlna/issues/6#issuecomment-757367785:

This doesn't help for other commands using the language selector, like \enablesplithyphens{<language name>}.

I guess either parsing the file language.def or using \csname lang@#1\endcsname consistently throughout the library would be needed to handle those cases correctly.

I attach the language definition files as generated on Debian to illustrate the issue: language-defs.tar.gz

michal-h21 commented 3 years ago

I've modified Plain TeX file to use language macros in all commands that depend on the language. Does it work correctly now?

mbudaj commented 3 years ago

The macros \enablesplithyphens and \disablesplithyphens work well now.

The \compoundinitials has not been updated, but it should be fixed using \singlecharsgetlang as well.

I noticed a weird behavior of \preventsinglelang, see the attached files where I used

\uselanguage{czech}
\preventsinglelang{english}

or

\uselanguage{czech}
\preventsinglelang{german}

to generate them. I expected both to ignore settings for Czech.

czech-english.pdf – the Czech compound initial Ch is processed czech-german.pdf – all settings for Czech are applied

michal-h21 commented 3 years ago

You are right, I forgot about \compountinitials. The main language setting was broken as well, because it didn't support numeric language codes, so it didn't work correctly with \singlecharsgetlang macro.

Does it work now?

mbudaj commented 3 years ago

It's OK now, thank you.

The only remaining issue is that the compound initial (Ch) defined for Czech language is still taken into account in this scenario, e.g.:

\uselanguage{czech}
\preventsinglelang{german}

Not a big deal, though.

michal-h21 commented 3 years ago

Ah, it is because initials work regardless of the language and Ch is added by default. You can disable defaults using

\let\nosingledefaults\relax
\input luavlna

I've added this info also to the documentation source.

mbudaj commented 3 years ago

If they are global, then maybe the syntax shouldn't be \compoundinitials{czech}{Ch,CH} but just \compoundinitials{Ch,CH}.

michal-h21 commented 3 years ago

It makes sense, you are right. That would be non-backward compatible change though, so it is probably best to keep it as it is.