[NTG-context] How to define a new language?

Paul Hoffman nkuitse at nkuitse.com
Wed Feb 27 23:05:05 CET 2019


I'm trying to define a new language for use in a bilingual document, but 
my hyphenation patterns are being ignored and I'm sure I must be doing 
something wrong.

I've devised a minimal example that should hyphenate between vowels but 
doesn't.  Here's the hyphenation patterns file:

----------------------------- lang-foo.pat -----------------------------
% Hyphenation patterns for Foo.
\begingroup
\patterns{
a1a a1e a1i a1o a1u
e1a e1e e1i e1o e1u
i1a i1e i1i i1o i1u
o1a o1e o1i o1o o1u
u1a u1e u1i u1o u1u
}
\endgroup
------------------------------------------------------------------------

I tried to convert this to Lua code but couldn't figure out the right 
invocation of _mtxrun --script pattern --convert_.

Then I wrote a minimal Context file and hoped it would pick up 
lang-foo.pat anyhow:

----------------------------- test-foo.tex -----------------------------
\installlanguage[foo][
    spacing=broad,
    leftsentence=---,
    rightsentence=---,
    leftsubsentence=---,
    rightsubsentence=---,
    leftquote=\upperleftsinglesixquote,
    rightquote=\upperrightsingleninequote,
    leftquotation=\upperleftdoublesixquote,
    rightquotation=\upperrightdoubleninequote,
    date={month,\ ,day,{,\ },year},
    state=stop,
]
\mainlanguage[foo]
\setuppapersize[A6]
\setupalign[hyphenated,morehyphenation,flushleft]
\starttext
umleoeoikaoukkoiiaaiewuewniimoaralkokolwwuiuirmlkipetnoaeteuntoilooooamm
uuuauemepokawpoieoomtkeaipeailloaukoiwaeuaewurawiueanwtaoaoemmuuonwleaue
mrtmuweokmikariurtlluiraapnkowuaueolmrneraiiioeauemmaamauiiolluwrltounte
aaaunnoitwueemwlniowotuauwomaupaapwtawiikiuolnrolouletouunwptoioououoael
kiitinouoeolopewourtuineuaermnmmioaiuienkewuiaaklinipprurainouioiomuwokr
koriiaieulkppwwieoemlipiakinppprnpaiaaekapnpatritotoeormaetualeonemlppau
earoeauoiimekoilliiuomirnrwarpupieiilaaueeoaekwriummikpatakeairolwpiaoaa
tniweuiineeetuiektpalukluanetoiklwnemutlonnuaalpnelpniiuiutmaoakmkoiomia
ineioporrieopatakomonipiuwuiwiiaueiueoluoeaaiootwuekinkwawrrwwppilewoioo
itroreraeonkeuiaawalunnueoreiaaeewknailaeomomilkruruekuonkaonwwiieunonow
\stoptext
------------------------------------------------------------------------

It does seem to see lang-foo.pat:

$ context --pdf test-foo.tex | fgrep patterns
mkiv lua stats  > loaded patterns: en::2 foo::67, load time: 0.000

But in the resulting PDF, nothing is hyphenated.  (I'll post the PDF if 
anyone really wants to see it.)

Here's my _context --version_ output:

mtx-context     | ConTeXt Process Management 1.02
mtx-context     |
mtx-context     | main context file: /usr/local/context/tex/texmf-context/tex/context/base/mkiv/context.mkiv
mtx-context     | current version: 2018.01.19 13:42

Can someone point me to my mistake?

Thanks in advance,

Paul.

-- 
Paul Hoffman <nkuitse at nkuitse.com>


More information about the ntg-context mailing list