Difference between revisions of "Command/setuplanguage"

From Wiki
Jump to navigation Jump to search
(Created page with "Documentation for \setuplanguage")
 
(explain some options, settings for German)
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
 
<cd:commandgroup name="setuplanguage" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807">
 
<cd:commandgroup name="setuplanguage" xmlns:cd="http://wiki.contextgarden.net/commanddoc/20200807">
<cd:shortdesc>The command <tt>\setuplanguage</tt> is adjusts a language's settings
+
<cd:shortdesc>The command <tt>\setuplanguage</tt> adjusts the settings for a language.
 
</cd:shortdesc>
 
</cd:shortdesc>
 
<cd:variants>
 
<cd:variants>
Line 7: Line 7:
 
     <cd:keywords optional="yes" ordinal="1">
 
     <cd:keywords optional="yes" ordinal="1">
 
     <cd:keywordsdoc></cd:keywordsdoc>
 
     <cd:keywordsdoc></cd:keywordsdoc>
     <cd:constant type="cd:language"></cd:constant>
+
     <cd:constant type="cd:language">an already defined language to be set up</cd:constant>
 
     <cd:constant type="default"></cd:constant>
 
     <cd:constant type="default"></cd:constant>
 
     </cd:keywords>
 
     </cd:keywords>
Line 30: Line 30:
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="patterns">
 
     <cd:parameter name="patterns">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>The hyphenation patterns to use. </cd:paramdoc>
       <cd:constant type="cd:file"></cd:constant>
+
       <cd:constant type="cd:file">If you enter <code>XX</code> as value, ConTeXt loads <code>lang-XX.lua</code> from either the local folder or the <code>tex/context/patterns/mkiv</code> directory</cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="lefthyphenmin">
 
     <cd:parameter name="lefthyphenmin">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>Minimal number of characters for prefixes. Default: e.g. 2 for English, 3 for German; '''beware''' the latter is different from LaTeX (2) and prevents many possible hyphenations!</cd:paramdoc>
 
       <cd:constant type="cd:number"></cd:constant>
 
       <cd:constant type="cd:number"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="righthyphenmin">
 
     <cd:parameter name="righthyphenmin">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>Minimal number of characters for sufffixes. Default: e.g. 3 for English, 3 for German; '''beware''' the latter is different from LaTeX (2) and prevents many possible hyphenations!</cd:paramdoc>
 
       <cd:constant type="cd:number"></cd:constant>
 
       <cd:constant type="cd:number"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
Line 79: Line 79:
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="hyphen">
 
     <cd:parameter name="hyphen">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>hyphen character</cd:paramdoc>
 
       <cd:constant type="cd:text"></cd:constant>
 
       <cd:constant type="cd:text"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
Line 95: Line 95:
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="leftquote">
 
     <cd:parameter name="leftquote">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>left single quotation mark (for {{cmd|quote}})</cd:paramdoc>
 
       <cd:constant type="cd:command"></cd:constant>
 
       <cd:constant type="cd:command"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="rightquote">
 
     <cd:parameter name="rightquote">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>right single quotation mark (for {{cmd|quote}})</cd:paramdoc>
 
       <cd:constant type="cd:command"></cd:constant>
 
       <cd:constant type="cd:command"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="leftquotation">
 
     <cd:parameter name="leftquotation">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>left double quotation mark (for {{cmd|quotation}})</cd:paramdoc>
 
       <cd:constant type="cd:command"></cd:constant>
 
       <cd:constant type="cd:command"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
 
     <cd:parameter name="rightquotation">
 
     <cd:parameter name="rightquotation">
       <cd:paramdoc></cd:paramdoc>
+
       <cd:paramdoc>right double quotation mark (for {{cmd|quotation}})</cd:paramdoc>
 
       <cd:constant type="cd:command"></cd:constant>
 
       <cd:constant type="cd:command"></cd:constant>
 
     </cd:parameter>
 
     </cd:parameter>
Line 153: Line 153:
 
<cd:description><!-- the long description of the command goes here -->
 
<cd:description><!-- the long description of the command goes here -->
 
</cd:description>
 
</cd:description>
<cd:examples></cd:examples>
+
<cd:examples><cd:example title=""><texcode>
 +
\installlanguage
 +
  [en]
 +
  [spacing=broad,
 +
    leftsentence=---,
 +
    rightsentence=---,
 +
    leftsubsentence=---,
 +
    rightsubsentence=---,
 +
    leftquote=\upperleftsinglesixquote,
 +
    rightquote=\upperrightsingleninequote,
 +
    leftquotation=\upperleftdoublesixquote,
 +
    rightquotation=\upperrightdoubleninequote,
 +
    date={month,\ ,day,{,\ },year},
 +
    default=en,
 +
    state=stop]
 +
</texcode>
 +
</cd:example><cd:example title="Suggestion for German with guillemets"><texcode>
 +
\setbreakpoints[compound] % break at / and -
 +
\setuplanguage[de][
 +
  goodies={lang-de.llg}, % prevent wrong ligatures
 +
  lefthyphenmin=2,
 +
  righthyphenmin=2,
 +
  leftquotation=»,
 +
  rightquotation=«,
 +
  leftquote=›,
 +
  rightquote=‹,
 +
]
 +
</texcode></cd:example></cd:examples>
 
<cd:notes></cd:notes>
 
<cd:notes></cd:notes>
 
<cd:seealso>
 
<cd:seealso>
Line 161: Line 188:
 
<cd:wikipage originator="system" page="Category:Language"></cd:wikipage>
 
<cd:wikipage originator="system" page="Category:Language"></cd:wikipage>
 
<cd:commandref name="installlanguage"></cd:commandref>
 
<cd:commandref name="installlanguage"></cd:commandref>
<cd:commandref name="language"></cd:commandref></cd:seealso>
+
<cd:commandref name="language"></cd:commandref>
 +
<cd:commandref name="mainlanguage"></cd:commandref></cd:seealso>
 
</cd:commandgroup>
 
</cd:commandgroup>

Revision as of 04:59, 29 September 2022


\setuplanguage

Summary

The command \setuplanguage adjusts the settings for a language.

Settings

\setuplanguage[...][...=...,...]
[...]language default
defaultlanguage
statestart stop
datesee \currentdate
timesee \currenttime
patternsfile
lefthyphenminnumber
righthyphenminnumber
lefthyphencharnumber
righthyphencharnumber
setupsname
spacingbroad packed
fontauto name
bidileft right l2r r2l
texttext
limittexttext
hyphentext
compoundhyphentext
leftcompoundhyphentext
rightcompoundhyphentext
leftquotecommand
rightquotecommand
leftquotationcommand
rightquotationcommand
leftspeechcommand
rightspeechcommand
leftsentencecommand
middlespeechcommand
rightsentencecommand
midsentencecommand
leftsubsentencecommand
rightsubsentencecommand
factoryes no

OptionExplanation
language an already defined language to be set up
patterns
The hyphenation patterns to use.
file If you enter XX as value, ConTeXt loads lang-XX.lua from either the local folder or the tex/context/patterns/mkiv directory
lefthyphenmin
Minimal number of characters for prefixes. Default: e.g. 2 for English, 3 for German; beware the latter is different from LaTeX (2) and prevents many possible hyphenations!
righthyphenmin
Minimal number of characters for sufffixes. Default: e.g. 3 for English, 3 for German; beware the latter is different from LaTeX (2) and prevents many possible hyphenations!
hyphen
hyphen character
leftquote
left single quotation mark (for \quote)
rightquote
right single quotation mark (for \quote)
leftquotation
left double quotation mark (for \quotation)
rightquotation
right double quotation mark (for \quotation)

Description

Examples

Example 1

\installlanguage
   [en]
   [spacing=broad,
    leftsentence=---,
    rightsentence=---,
    leftsubsentence=---,
    rightsubsentence=---,
    leftquote=\upperleftsinglesixquote,
    rightquote=\upperrightsingleninequote,
    leftquotation=\upperleftdoublesixquote,
    rightquotation=\upperrightdoubleninequote,
    date={month,\ ,day,{,\ },year},
    default=en,
    state=stop]

Suggestion for German with guillemets

\setbreakpoints[compound] % break at / and -
\setuplanguage[de][
  goodies={lang-de.llg}, % prevent wrong ligatures
  lefthyphenmin=2,
  righthyphenmin=2,
  leftquotation=»,
  rightquotation=«,
  leftquote=›,
  rightquote=‹,
]

Notes

See also

Help from ConTeXt-Mailinglist/Forum

All issues with: