Skip to content

The variable “polyglossia-otherlangs” should have fields #2437

Closed
nickbart1980 opened this Issue · 6 comments

3 participants

@nickbart1980

Currently, no variants can be set for polyglossia’s secondary languages.

I’d suggest that the variable polyglossia-otherlangs should have the fields .name and .variant, and multiple \setotherlanguage{} commands rather than one \setotherlanguages{} command should be used.

Accordingly, the default.latex template should contain:

$for(polyglossia-otherlangs)$
\setotherlanguage
$if(polyglossia-otherlangs.variant)$[variant=$polyglossia-otherlangs.variant$]$endif$
{$polyglossia-otherlangs.name$}
$endfor$

Alternative: .options fields

Use polyglossia-mainlang and polyglossia-otherlangs variables, both having .name and .options fields, where .options can have a value of variant=…, e.g., variant=british.

An .options field would make it easier to deal with other polyglossia options, too, e.g.,

ar-TN => \setotherlanguage[locale=tunisia]{arabic}

de-AT-1901 => \setotherlanguage[variant=austrian, spelling=old]{german}

@jgm
Owner
jgm commented

@mb21 can you comment? This seems reasonable to me. The LaTeX writer would need to be changed to set these variables differently.

@mb21

Agreed, the otherlangs variable didn't get the proper treatment in the language -> lang change. But then why not make it consistent (@nickbart1980's alternative), in YAML:

babel-lang: arabic
polyglossia-lang:
  name: arabic
  variant: whatever
  locale: tunisia
polyglossia-otherlangs:
  - name: german
    variant: austrian
  - name: chinese
    variant: ""

This makes the polyglossia-lang variable a bit more complex (it's a dictionary now) but offers more flexibility.

@nickbart1980

… or simpler, since most likely we’ll never be needing the individual components:

babel-lang: arabic
polyglossia-lang:
  name: arabic
  options: variant=whatever, locale=tunisia
polyglossia-otherlangs:
  - name: german
    options: variant=austrian
  - name: chinese
    options: variant=whatever
@mb21

I'm not sure it's simpler since it's basically JSON objects under the hood anyway (so it doesn't matter whether you have two or three keys in the hashmap). But it's more complicated in the template polyglossia-lang.options.variant vs oplyglossia-lang.variant.

@nickbart1980

Well, no, I was thinking of storing the whole polyglossia “options” string, as used in \setotherlanguage[⟨options⟩]{⟨lang⟩} and other commands, e.g. \setotherlanguage[variant=whatever,locale=tunisia]{arabic} in the pandoc variables polyglossia-lang.options and polyglossia-otherlangs.XXX.options. But … whatever works …

@mb21 mb21 added a commit to mb21/pandoc that referenced this issue
@mb21 mb21 Change variable to polyglossia-lang.name and .options
closes #2437
c833bfc
@mb21

Ah, I see. Indeed, that makes things simpler—as long as we don't have too many combinations of language/locale/variant etc. to generate, but that's not the case for now. I implemented it like that.

@mb21 mb21 added a commit to mb21/pandoc that referenced this issue
@mb21 mb21 Change variable to polyglossia-lang.name and .options
closes #2437
80b851a
@jgm jgm closed this in #2441
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.