mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Add support for the following languages
Polyglossia: Chinese (Simplified), Chinese (Traditional), Japanese, Kurdish (Sorani), Latin (Classic), Latin (Ecclesiastic), Latin (Medieval), N'ko, Odia, Punjabi, and Uyghur Babel: Amharic, Armenian, Asturian, Bengali, Church Slavonic, Coptic, Divehi, Kannada, Kazakh, Khmer, Kurdish (Sorani), Lao, Latin (Classic), Latin (Ecclesiastic), Latin (Medieval), Malayalam, Marathi, N'ko, Occitan, Odia, Punjabi, Russian (Petrine orthography), Sanskrit, Syriac, Tamil, Telugu, Tibetan, Urdu, and Uyghur
This commit is contained in:
parent
d06a034578
commit
b625138be6
@ -7,6 +7,17 @@ changes happened in particular if possible. A good example would be
|
||||
|
||||
-----------------------
|
||||
|
||||
2024-08-25 Jürgen Spitzmüller <spitz@lyx.org>
|
||||
* Format incremented to 630: Add support for a number of languages in
|
||||
babel and polyglossia:
|
||||
Polyglossia: Chinese (Simplified), Chinese (Traditional), Japanese, Kurdish (Sorani),
|
||||
Latin (Classic), Latin (Ecclesiastic), Latin (Medieval), N'ko, Odia, Punjabi, and Uyghur
|
||||
Babel: Amharic, Armenian, Asturian, Bengali, Church Slavonic, Coptic, Divehi,
|
||||
Kannada, Kazakh, Khmer, Kurdish (Sorani), Lao, Latin (Classic), Latin (Ecclesiastic),
|
||||
Latin (Medieval), Malayalam, Marathi, N'ko, Occitan, Odia, Punjabi,
|
||||
Russian (Petrine orthography), Sanskrit, Syriac, Tamil, Telugu, Tibetan, Urdu,
|
||||
and Uyghur
|
||||
|
||||
2024-08-23 Jürgen Spitzmüller <spitz@lyx.org>
|
||||
* Format incremented to 629: Add support for language options
|
||||
New buffer params \language_options_babel and
|
||||
|
272
lib/languages
272
lib/languages
@ -211,12 +211,10 @@ Language american
|
||||
LangCode en_US
|
||||
End
|
||||
|
||||
# not supported by babel
|
||||
Language amharic
|
||||
GuiName "Amharic"
|
||||
# TODO:
|
||||
# BabelName amharic
|
||||
# BabelProvide 1
|
||||
BabelName amharic
|
||||
BabelProvide 1
|
||||
PolyglossiaName amharic
|
||||
Encoding utf8
|
||||
DateFormats "dd MMMM yyyy|dd MMM yyyy|dd/MM/yyyy"
|
||||
@ -289,12 +287,10 @@ Language arabic_arabi
|
||||
LangCode ar_SA
|
||||
End
|
||||
|
||||
# not supported by babel
|
||||
Language armenian
|
||||
GuiName "Armenian"
|
||||
# TODO:
|
||||
# BabelName armenian
|
||||
# BabelProvide 1
|
||||
BabelName armenian
|
||||
BabelProvide 1
|
||||
PolyglossiaName armenian
|
||||
QuoteStyle swiss
|
||||
Encoding utf8
|
||||
@ -302,12 +298,10 @@ Language armenian
|
||||
LangCode hy_AM
|
||||
End
|
||||
|
||||
# not supported by babel
|
||||
Language asturian
|
||||
GuiName "Asturian"
|
||||
# TODO:
|
||||
# BabelName asturian
|
||||
# BabelProvide 1
|
||||
BabelName asturian
|
||||
BabelProvide 1
|
||||
PolyglossiaName asturian
|
||||
QuoteStyle french
|
||||
Encoding iso8859-15
|
||||
@ -434,9 +428,8 @@ End
|
||||
# supported by polyglossia but not babel:
|
||||
Language bengali
|
||||
GuiName "Bengali"
|
||||
# TODO:
|
||||
# BabelName bengali
|
||||
# BabelProvide 1
|
||||
BabelName bengali
|
||||
BabelProvide 1
|
||||
PolyglossiaName bengali
|
||||
QuoteStyle english
|
||||
Encoding utf8
|
||||
@ -554,9 +547,8 @@ End
|
||||
Language chinese-simplified
|
||||
GuiName "Chinese (simplified)"
|
||||
HasGuiSupport true
|
||||
# TODO
|
||||
# PolyglossiaName chinese
|
||||
# PolyglossiaOpts "variant=simplified"
|
||||
PolyglossiaName chinese
|
||||
PolyglossiaOpts "variant=simplified"
|
||||
Encoding euc-cn
|
||||
QuoteStyle english
|
||||
WordWrap false
|
||||
@ -569,9 +561,8 @@ End
|
||||
Language chinese-traditional
|
||||
GuiName "Chinese (traditional)"
|
||||
HasGuiSupport true
|
||||
# TODO
|
||||
# PolyglossiaName chinese
|
||||
# PolyglossiaOpts "variant=traditional"
|
||||
PolyglossiaName chinese
|
||||
PolyglossiaOpts "variant=traditional"
|
||||
QuoteStyle cjk
|
||||
Encoding utf8-cjk
|
||||
WordWrap false
|
||||
@ -580,12 +571,10 @@ Language chinese-traditional
|
||||
Requires CJK
|
||||
End
|
||||
|
||||
# not supported by babel
|
||||
Language churchslavonic
|
||||
GuiName "Church Slavonic"
|
||||
# TODO:
|
||||
# BabelName churchslavic
|
||||
# BabelProvide 1
|
||||
BabelName churchslavic
|
||||
BabelProvide 1
|
||||
PolyglossiaName churchslavonic
|
||||
QuoteStyle swiss
|
||||
Encoding utf8
|
||||
@ -595,13 +584,11 @@ Language churchslavonic
|
||||
Provides textcyrillic
|
||||
End
|
||||
|
||||
# not supported by babel
|
||||
# FIXME DateFormats
|
||||
Language coptic
|
||||
GuiName "Coptic"
|
||||
# TODO:
|
||||
# BabelName coptic
|
||||
# BabelProvide 1
|
||||
BabelName coptic
|
||||
BabelProvide 1
|
||||
PolyglossiaName coptic
|
||||
Encoding utf8
|
||||
LangCode cop_EG
|
||||
@ -650,9 +637,8 @@ End
|
||||
# babel only provides a "bare minimum locale"
|
||||
Language divehi
|
||||
GuiName "Divehi (Maldivian)"
|
||||
# TODO:
|
||||
# BabelName divehi
|
||||
# BabelProvide 1
|
||||
BabelName divehi
|
||||
BabelProvide 1
|
||||
PolyglossiaName divehi
|
||||
Encoding utf8
|
||||
DateFormats "yyyy MMMM dd|yyyy MMM dd|dd/MM/yyyy"
|
||||
@ -917,30 +903,16 @@ Language hebrew
|
||||
LangCode he_IL
|
||||
End
|
||||
|
||||
# not supported by babel
|
||||
Language hindi
|
||||
GuiName "Hindi"
|
||||
# TODO:
|
||||
# BabelName hindi
|
||||
# BabelProvide 1
|
||||
BabelName hindi
|
||||
BabelProvide 1
|
||||
PolyglossiaName hindi
|
||||
Encoding utf8
|
||||
DateFormats "dd MMMM yyyy|dd MMM yyyy|dd-MM-yyyy"
|
||||
LangCode hi_IN
|
||||
End
|
||||
|
||||
# Currently not supported (file format change!)
|
||||
# "hungarian" is a synonym for the "magyar" babel language option
|
||||
# "hungarian" might be used for special purposes,
|
||||
# see http://www.math.bme.hu/latex/magyar_pre_tug2004.pdf
|
||||
#Language hungarian
|
||||
# GuiName "Hungarian"
|
||||
# BabelName hungarian
|
||||
# Encoding iso8859-2
|
||||
# LangCode hu_HU
|
||||
# QuoteStyle polish
|
||||
#End
|
||||
|
||||
# FontEncoding: OT1 misses ð and Þ
|
||||
Language icelandic
|
||||
GuiName "Icelandic"
|
||||
@ -1001,8 +973,7 @@ Language japanese
|
||||
HasGuiSupport true
|
||||
BabelName japanese
|
||||
BabelOptFormat \languageattribute{$lang$}{$opts$}
|
||||
# TODO
|
||||
# PolyglossiaName japanese
|
||||
PolyglossiaName japanese
|
||||
Encoding jis-platex
|
||||
WordWrap false
|
||||
LangCode ja_JP
|
||||
@ -1023,12 +994,10 @@ Language japanese-cjk
|
||||
QuoteStyle cjk
|
||||
End
|
||||
|
||||
# not supported by babel
|
||||
Language kannada
|
||||
GuiName "Kannada"
|
||||
# TODO:
|
||||
# BabelName kannada
|
||||
# BabelProvide 1
|
||||
BabelName kannada
|
||||
BabelProvide 1
|
||||
PolyglossiaName kannada
|
||||
Encoding utf8
|
||||
DateFormats "dd MMMM yyyy|dd MMMM yyyy|dd-MM-yyyy"
|
||||
@ -1036,21 +1005,20 @@ Language kannada
|
||||
End
|
||||
|
||||
# not yet supported by polyglossia
|
||||
# not supported by babel
|
||||
Language kazakh
|
||||
GuiName "Kazakh"
|
||||
BabelName kazakh
|
||||
BabelProvide 1
|
||||
Encoding ascii
|
||||
# FontEncoding T2A # not set (no Babel support)
|
||||
DateFormats "dd MMMM yyyy|dd MMMM yyyy|yyyy-dd-MM"
|
||||
LangCode kk_KZ
|
||||
End
|
||||
|
||||
# not supported by babel
|
||||
Language khmer
|
||||
GuiName "Khmer"
|
||||
# TODO:
|
||||
# BabelName khmer
|
||||
# BabelProvide 1
|
||||
BabelName khmer
|
||||
BabelProvide 1
|
||||
PolyglossiaName khmer
|
||||
Encoding utf8
|
||||
DateFormats "d MMMM yyyy|d MMMM yyyy|dd/MM/yyyy"
|
||||
@ -1091,14 +1059,25 @@ Language kurmanji
|
||||
LangCode kmr
|
||||
End
|
||||
|
||||
# TODO: kurdish, variant=sorani
|
||||
|
||||
# not supported by babel
|
||||
Language sorani
|
||||
GuiName "Kurdish (Sorani)"
|
||||
BabelName sorani
|
||||
BabelProvide 1
|
||||
PolyglossiaName kurdish
|
||||
PolyglossiaOpts "variant=sorani"
|
||||
XindyName kurdish-bedirxan
|
||||
Encoding utf8
|
||||
FontEncoding T1|OT1
|
||||
DateFormats "d. MMMM yyyy|d. M. yyyy|yyyy-MM-dd"
|
||||
LangCode ckb
|
||||
End
|
||||
|
||||
|
||||
Language lao
|
||||
GuiName "Lao"
|
||||
# TODO:
|
||||
# BabelName lao
|
||||
# BabelProvide 1
|
||||
BabelName lao
|
||||
BabelProvide 1
|
||||
PolyglossiaName lao
|
||||
Encoding utf8
|
||||
DateFormats "dd MMMM yyyy|dd MMMM yyyy|dd/MM/yyyy"
|
||||
@ -1109,7 +1088,7 @@ End
|
||||
# We therefore use the name of its hunspell dictionary.
|
||||
# FIXME DateFormats
|
||||
Language latin
|
||||
GuiName "Latin"
|
||||
GuiName "Latin (Modern)"
|
||||
BabelName latin
|
||||
BabelOptFormat modifier
|
||||
PolyglossiaName latin
|
||||
@ -1118,10 +1097,48 @@ Language latin
|
||||
ActiveChars ^=
|
||||
Encoding iso8859-15
|
||||
FontEncoding T1|OT1
|
||||
LangCode la_LA
|
||||
LangCode la
|
||||
End
|
||||
|
||||
Language latin-classic
|
||||
GuiName "Latin (Classic)"
|
||||
BabelName classiclatin
|
||||
BabelOptFormat modifier
|
||||
PolyglossiaName latin
|
||||
PolyglossiaOpts "variant=classic"
|
||||
XindyName latin
|
||||
ActiveChars ^=
|
||||
Encoding iso8859-15
|
||||
FontEncoding T1|OT1
|
||||
LangCode la-x-classic
|
||||
End
|
||||
|
||||
Language latin-ecclesiastic
|
||||
GuiName "Latin (Eccesiastic)"
|
||||
BabelName ecclesiasticlatin
|
||||
BabelOptFormat modifier
|
||||
PolyglossiaName latin
|
||||
PolyglossiaOpts "variant=ecclesiastic"
|
||||
XindyName latin
|
||||
ActiveChars ^=
|
||||
Encoding iso8859-15
|
||||
FontEncoding T1|OT1
|
||||
LangCode la-x-ecclesia
|
||||
End
|
||||
|
||||
Language latin-medieval
|
||||
GuiName "Latin (Medieval)"
|
||||
BabelName medievallatin
|
||||
BabelOptFormat modifier
|
||||
PolyglossiaName latin
|
||||
PolyglossiaOpts "variant=medieval"
|
||||
XindyName latin
|
||||
ActiveChars ^=
|
||||
Encoding iso8859-15
|
||||
FontEncoding T1|OT1
|
||||
LangCode la-x-medieval
|
||||
End
|
||||
|
||||
# TODO: support Latin varieties (classic, medieval, eccelesiastic)
|
||||
|
||||
# latvian must be loaded locally with babel options,
|
||||
# not globally via class options
|
||||
@ -1213,12 +1230,10 @@ Language macedonian
|
||||
Provides textcyrillic
|
||||
End
|
||||
|
||||
# not supported by babel
|
||||
Language malayalam
|
||||
GuiName "Malayalam"
|
||||
# TODO:
|
||||
# BabelName malayalam
|
||||
# BabelProvide 1
|
||||
BabelName malayalam
|
||||
BabelProvide 1
|
||||
PolyglossiaName malayalam
|
||||
Encoding utf8
|
||||
QuoteStyle english
|
||||
@ -1226,12 +1241,10 @@ Language malayalam
|
||||
LangCode ml_IN
|
||||
End
|
||||
|
||||
# not supported by babel
|
||||
Language marathi
|
||||
GuiName "Marathi"
|
||||
# TODO:
|
||||
# BabelName marathi
|
||||
# BabelProvide 1
|
||||
BabelName marathi
|
||||
BabelProvide 1
|
||||
PolyglossiaName marathi
|
||||
Encoding utf8
|
||||
DateFormats "dd MMMM yyyy|d MMM yyyy|dd-MM-yyyy"
|
||||
@ -1265,23 +1278,18 @@ Language newzealand
|
||||
LangCode en_NZ
|
||||
End
|
||||
|
||||
# TODO:
|
||||
# Language nko
|
||||
# GuiName "N’Ko"
|
||||
# BabelName nko
|
||||
# BabelProvide 1
|
||||
# PolyglossiaName nko
|
||||
# QuoteStyle swiss
|
||||
# Encoding utf8
|
||||
Language nko
|
||||
GuiName "N’Ko"
|
||||
BabelName nko
|
||||
BabelProvide 1
|
||||
PolyglossiaName nko
|
||||
QuoteStyle swiss
|
||||
Encoding utf8
|
||||
# FIXME: DateFormats "d MMMM، yyyy|dd/MM/yyyy|d/M/yyyy"
|
||||
# gloss-nko.ldf says:
|
||||
# In n'ko, this is an example of date :
|
||||
# ߂߀߁߃ ߞߏ߲ߞߏߜߍ ߕߟߋ߬ ߁߈ (RTL)
|
||||
# ( 18 February 2013 )
|
||||
# The word "ߕߟߋ߬" is mandatory between month name and day number.
|
||||
# RTL true
|
||||
# LangCode nqo
|
||||
# End
|
||||
# see gloss-nko.ldf
|
||||
RTL true
|
||||
LangCode nqo
|
||||
End
|
||||
|
||||
Language norsk
|
||||
GuiName "Norwegian (Bokmaal)"
|
||||
@ -1311,11 +1319,9 @@ Language nynorsk
|
||||
LangCode nn_NO
|
||||
End
|
||||
|
||||
# not supported by babel
|
||||
Language occitan
|
||||
GuiName "Occitan"
|
||||
# TODO
|
||||
# BabelName occitan
|
||||
BabelName occitan
|
||||
PolyglossiaName occitan
|
||||
QuoteStyle french
|
||||
Encoding utf8
|
||||
@ -1323,20 +1329,29 @@ Language occitan
|
||||
LangCode oc_FR
|
||||
End
|
||||
|
||||
# TODO: odia (polyglossia)
|
||||
Language odia
|
||||
GuiName "Odia"
|
||||
BabelName odia
|
||||
BabelProvide 1
|
||||
PolyglossiaName odia
|
||||
Encoding utf8
|
||||
DateFormats "dd MMMM yyyy|d MMM yyyy|dd-MM-yyyy"
|
||||
LangCode or
|
||||
End
|
||||
|
||||
# Russian orthography from the Petrine orthographic reforms of
|
||||
# 1708 to the 1917 orthographic reform
|
||||
Language oldrussian
|
||||
GuiName "Russian (Petrine orthography)"
|
||||
# TODO
|
||||
# BabelName russian
|
||||
# BabelOpts ancient
|
||||
# BabelOptFormat modifier
|
||||
BabelName russian
|
||||
BabelOpts ancient
|
||||
BabelOptFormat modifier
|
||||
PolyglossiaName russian
|
||||
PolyglossiaOpts "spelling=old"
|
||||
XindyName russian
|
||||
QuoteStyle russian
|
||||
Encoding koi8-r
|
||||
FontEncoding T2A
|
||||
LangCode ru_petr1708
|
||||
End
|
||||
|
||||
@ -1380,7 +1395,15 @@ Language portuguese
|
||||
LangCode pt_PT
|
||||
End
|
||||
|
||||
# TODO: punjabi (polyglossia)
|
||||
Language punjabi
|
||||
GuiName "Punjabi"
|
||||
BabelName punjabi
|
||||
BabelProvide 1
|
||||
PolyglossiaName punjabi
|
||||
Encoding utf8
|
||||
DateFormats "dd MMMM yyyy|dd MMMM yyyy|dd-MM-yyyy"
|
||||
LangCode pa
|
||||
End
|
||||
|
||||
Language romanian
|
||||
GuiName "Romanian"
|
||||
@ -1434,13 +1457,11 @@ Language samin
|
||||
LangCode se_NO
|
||||
End
|
||||
|
||||
# not supported by babel
|
||||
Language sanskrit
|
||||
GuiName "Sanskrit"
|
||||
PolyglossiaName sanskrit
|
||||
# TODO:
|
||||
# BabelName sanskrit
|
||||
# BabelProvide 1
|
||||
BabelName sanskrit
|
||||
BabelProvide 1
|
||||
Encoding utf8
|
||||
DateFormats "dd MMMM yyyy|d MMM yyyy|dd-MM-yyyy"
|
||||
LangCode sa_IN
|
||||
@ -1568,12 +1589,10 @@ Language swedish
|
||||
LangCode sv_SE
|
||||
End
|
||||
|
||||
# not supported by babel
|
||||
Language syriac
|
||||
GuiName "Syriac"
|
||||
# TODO:
|
||||
# BabelName syriac
|
||||
# BabelProvide 1
|
||||
BabelName syriac
|
||||
BabelProvide 1
|
||||
PolyglossiaName syriac
|
||||
Encoding utf8
|
||||
RTL true
|
||||
@ -1581,24 +1600,20 @@ Language syriac
|
||||
LangCode syr_SY
|
||||
End
|
||||
|
||||
# not supported by babel
|
||||
Language tamil
|
||||
GuiName "Tamil"
|
||||
# TODO:
|
||||
# BabelName tamil
|
||||
# BabelProvide 1
|
||||
BabelName tamil
|
||||
BabelProvide 1
|
||||
PolyglossiaName tamil
|
||||
Encoding utf8
|
||||
DateFormats "dd MMMM yyyy|d MMM yyyy|dd-MM-yyyy"
|
||||
LangCode ta_IN
|
||||
End
|
||||
|
||||
# not supported by babel
|
||||
Language telugu
|
||||
GuiName "Telugu"
|
||||
# TODO:
|
||||
# BabelName telugu
|
||||
# BabelProvide 1
|
||||
BabelName telugu
|
||||
BabelProvide 1
|
||||
PolyglossiaName telugu
|
||||
Encoding utf8
|
||||
DateFormats "dd MMMM yyyy|d MMM yyyy|dd-MM-yyyy"
|
||||
@ -1649,13 +1664,11 @@ Language thai
|
||||
EndPostBabelPreamble
|
||||
End
|
||||
|
||||
# not supported by babel
|
||||
#FIXME DateFormats
|
||||
Language tibetan
|
||||
GuiName "Tibetan"
|
||||
# TODO:
|
||||
# BabelName tibetan
|
||||
# BabelProvide 1
|
||||
BabelName tibetan
|
||||
BabelProvide 1
|
||||
PolyglossiaName tibetan
|
||||
Encoding utf8
|
||||
LangCode bo_CN
|
||||
@ -1715,12 +1728,10 @@ Language uppersorbian
|
||||
LangCode hsb_DE
|
||||
End
|
||||
|
||||
# not supported by babel
|
||||
Language urdu
|
||||
GuiName "Urdu"
|
||||
# TODO:
|
||||
# BabelName urdu
|
||||
# BabelProvide 1
|
||||
BabelName urdu
|
||||
BabelProvide 1
|
||||
PolyglossiaName urdu
|
||||
Encoding utf8
|
||||
DateFormats "d MMMM, yyyy|d MMM yyyy|dd/MM/yyyy"
|
||||
@ -1728,7 +1739,18 @@ Language urdu
|
||||
LangCode ur_PK
|
||||
End
|
||||
|
||||
# TODO: uyghur (polyglossia)
|
||||
Language uyghur
|
||||
GuiName "Uyghur"
|
||||
BabelName uyghur
|
||||
BabelProvide 1
|
||||
PolyglossiaName uyghur
|
||||
Encoding utf8
|
||||
FontEncoding LAE,LFE
|
||||
DateFormats "d MMMM yyyy-يىلى|d MMM yyyy-يىلى|yyyy/M/d"
|
||||
RTL true
|
||||
LangCode ug
|
||||
QuoteStyle english
|
||||
End
|
||||
|
||||
Language vietnamese
|
||||
GuiName "Vietnamese"
|
||||
|
@ -666,7 +666,7 @@ singlepar_insets = [
|
||||
# print(singlepar_insets)
|
||||
|
||||
|
||||
def revert_language(document, lyxname, babelname="", polyglossianame=""):
|
||||
def revert_language(document, lyxname, babelname="", polyglossianame="", polyglossiaopts="", babelprovide=False):
|
||||
"Revert native language support"
|
||||
|
||||
# Does the document use polyglossia?
|
||||
@ -791,15 +791,18 @@ def revert_language(document, lyxname, babelname="", polyglossianame=""):
|
||||
i -= 1
|
||||
continue
|
||||
|
||||
|
||||
if polyglossiaopts != "":
|
||||
polyglossiaopts = "[" + polyglossiaopts + "]"
|
||||
if singlepar:
|
||||
if with_polyglossia:
|
||||
begin_cmd = "\\text%s{" % texname
|
||||
begin_cmd = "\\text%s%s{" % (texname, polyglossiaopts)
|
||||
elif with_babel:
|
||||
begin_cmd = "\\foreignlanguage{%s}{" % texname
|
||||
end_cmd = "}"
|
||||
else:
|
||||
if with_polyglossia:
|
||||
begin_cmd = "\\begin{%s}" % texname
|
||||
begin_cmd = "\\begin%s{%s}" % (polyglossiaopts, texname)
|
||||
end_cmd = "\\end{%s}" % texname
|
||||
elif with_babel:
|
||||
begin_cmd = "\\begin{otherlanguage}{%s}" % texname
|
||||
@ -822,6 +825,16 @@ def revert_language(document, lyxname, babelname="", polyglossianame=""):
|
||||
if with_babel:
|
||||
# add as global option
|
||||
insert_document_option(document, babelname)
|
||||
# babelprovide
|
||||
if babelprovide:
|
||||
babelprovide = "\\babelprovide[import"
|
||||
if primary:
|
||||
babelprovide += ", main"
|
||||
babelprovide += "]{%s}" % babelname
|
||||
add_to_preamble(
|
||||
document,
|
||||
["\\AddToHook{package/babel/after}{%s}" % babelprovide],
|
||||
)
|
||||
# Since user options are appended to the document options,
|
||||
# Babel will treat `babelname` as primary language.
|
||||
if not primary:
|
||||
|
@ -23,19 +23,20 @@ import re
|
||||
# convert_info_insets, get_ert, hex2ratio, insert_to_preamble,
|
||||
# length_in_bp, lyx2verbatim,
|
||||
# revert_flex_inset, revert_flex_inset, revert_font_attrs,
|
||||
# revert_language, str2bool
|
||||
# str2bool
|
||||
from lyx2lyx_tools import (
|
||||
add_to_preamble,
|
||||
latex_length,
|
||||
lyx2latex,
|
||||
put_cmd_in_ert
|
||||
put_cmd_in_ert,
|
||||
revert_language
|
||||
)
|
||||
|
||||
# Uncomment only what you need to import, please (parser_tools):
|
||||
# check_token, count_pars_in_inset, del_complete_lines,
|
||||
# del_value, find_complete_lines, find_end_of,
|
||||
# find_re, find_token_backwards, find_token_exact,
|
||||
# find_tokens, get_bool_value,
|
||||
# find_tokens,
|
||||
# get_containing_layout, get_option_value,
|
||||
# is_in_inset, set_bool_value
|
||||
from parser_tools import (
|
||||
@ -46,6 +47,7 @@ from parser_tools import (
|
||||
find_substring,
|
||||
find_token,
|
||||
get_containing_inset,
|
||||
get_bool_value,
|
||||
get_quoted_value,
|
||||
get_value
|
||||
)
|
||||
@ -872,6 +874,142 @@ def revert_langopts(document):
|
||||
# remove header
|
||||
del document.header[i]
|
||||
|
||||
|
||||
def revert_new_polyglossia_languages(document):
|
||||
"""Emulate support for Simplified Chinese, Traditional Chinese, Japanese, Sorani Kurdish,
|
||||
Classic, Ecclesiastic and Medieval Latin, N'ko, Odia, Punjabi, and Uyghur with polyglossia."""
|
||||
|
||||
# Does the document use polyglossia?
|
||||
use_polyglossia = False
|
||||
if get_bool_value(document.header, "\\use_non_tex_fonts"):
|
||||
i = find_token(document.header, "\\language_package")
|
||||
if i == -1:
|
||||
document.warning("Malformed document! Missing \\language_package")
|
||||
else:
|
||||
pack = get_value(document.header, "\\language_package", i)
|
||||
if pack in ("default", "auto"):
|
||||
use_polyglossia = True
|
||||
|
||||
if not use_polyglossia:
|
||||
return
|
||||
|
||||
# lyxname: (babelname, polyglossianame, polyglossiaopts)
|
||||
new_languages = {
|
||||
"chinese-simplified": ("", "chinese", "variant=simplified"),
|
||||
"chinese-traditional": ("", "chinese", "variant=traditional"),
|
||||
"japanese": ("", "japanese", ""),
|
||||
"sorani": ("", "kurdish", "variant=sorani"),
|
||||
"latin-classic": ("", "latin", "variant=classic"),
|
||||
"latin-ecclesiastic": ("", "latin", "variant=ecclesiastic"),
|
||||
"latin-medieval": ("", "latin", "variant=medieval"),
|
||||
"nko": ("", "nko", ""),
|
||||
"odia": ("", "odia", ""),
|
||||
"punjabi": ("", "punjabi", ""),
|
||||
"uyghur": ("", "uyghur", ""),
|
||||
}
|
||||
if document.language in new_languages:
|
||||
used_languages = {document.language}
|
||||
else:
|
||||
used_languages = set()
|
||||
i = 0
|
||||
while True:
|
||||
i = find_token(document.body, "\\lang", i + 1)
|
||||
if i == -1:
|
||||
break
|
||||
val = get_value(document.body, "\\lang", i)
|
||||
if val in new_languages:
|
||||
used_languages.add(val)
|
||||
|
||||
for lang in used_languages:
|
||||
revert_language(document, lang, *new_languages[lang])
|
||||
|
||||
|
||||
def revert_new_babel_languages(document):
|
||||
"""Emulate support for Amharic, Armenian, Asturian, Bengali, Church Slavonic,
|
||||
Coptic, Divehi, Kannada, Kazakh, Khmer, Kurdish (Sorani), Lao, Latin (Classic),
|
||||
Latin (Ecclesiastic), Latin (Medieval), Malayalam, Marathi, N'ko, Occitan, Odia,
|
||||
Punjabi, Russian (Petrine orthography), Sanskrit, Syriac, Tamil, Telugu, Tibetan,
|
||||
Urdu, and Uyghur with babel."""
|
||||
|
||||
# Does the document use polyglossia?
|
||||
use_polyglossia = False
|
||||
if get_bool_value(document.header, "\\use_non_tex_fonts"):
|
||||
i = find_token(document.header, "\\language_package")
|
||||
if i == -1:
|
||||
document.warning("Malformed document! Missing \\language_package")
|
||||
else:
|
||||
pack = get_value(document.header, "\\language_package", i)
|
||||
if pack in ("default", "auto"):
|
||||
use_polyglossia = True
|
||||
|
||||
if use_polyglossia:
|
||||
return
|
||||
|
||||
# lyxname: (babelname, polyglossianame, polyglossiaopts, babelprovide)
|
||||
new_languages = {
|
||||
"amharic": ("amharic", "", "", True),
|
||||
"armenian": ("armenian", "", "", True),
|
||||
"asturian": ("asturian", "", "", True),
|
||||
"bengali": ("bengali", "", "", True),
|
||||
"churchslavonic": ("churchslavic", "", "", True),
|
||||
"coptic": ("coptic", "", "", True),
|
||||
"divehi": ("divehi", "", "", True),
|
||||
"hindi": ("hindi", "", "", True),
|
||||
"kannada": ("kannada", "", "", True),
|
||||
"kazakh": ("kazakh", "", "", True),
|
||||
"khmer": ("khmer", "", "", True),
|
||||
"lao": ("lao", "", "", True),
|
||||
"latin-classic": ("classiclatin", "", "", False),
|
||||
"latin-ecclesiastic": ("ecclesiasticlatin", "", "", False),
|
||||
"latin-medieval": ("medievallatin", "", "", False),
|
||||
"malayalam": ("malayalam", "", "", True),
|
||||
"marathi": ("marathi", "", "", True),
|
||||
"nko": ("nko", "", "", True),
|
||||
"occitan": ("occitan", "", "", False),
|
||||
"odia": ("odia", "", "", True),
|
||||
"punjabi": ("punjabi", "", "", True),
|
||||
"sanskrit": ("sanskrit", "", "", True),
|
||||
"sorani": ("sorani", "", "", True),
|
||||
"syriac": ("syriac", "", "", True),
|
||||
"tamil": ("tamil", "", "", True),
|
||||
"telugu": ("telugu", "", "", True),
|
||||
"tibetan": ("tibetan", "", "", True),
|
||||
"urdu": ("urdu", "", "", True),
|
||||
"uyghur": ("uyghur", "", "", True),
|
||||
}
|
||||
if document.language in new_languages:
|
||||
used_languages = {document.language}
|
||||
else:
|
||||
used_languages = set()
|
||||
i = 0
|
||||
while True:
|
||||
i = find_token(document.body, "\\lang", i + 1)
|
||||
if i == -1:
|
||||
break
|
||||
val = get_value(document.body, "\\lang", i)
|
||||
if val in new_languages:
|
||||
used_languages.add(val)
|
||||
|
||||
for lang in used_languages:
|
||||
revert_language(document, lang, *new_languages[lang])
|
||||
|
||||
# revert oldrussian to russian
|
||||
have_oldrussian = False
|
||||
if document.language == "oldrussian":
|
||||
document.language = "russian"
|
||||
have_oldrussian = True
|
||||
|
||||
i = 0
|
||||
while True:
|
||||
i = find_token(document.body, "\\lang oldrussian", i + 1)
|
||||
if i == -1:
|
||||
break
|
||||
have_oldrussian = True
|
||||
document.body[i] = "\\lang russian"
|
||||
|
||||
if have_oldrussian:
|
||||
add_to_preamble(document, ["\\AddToHook{package/babel/after}{\\languageattribute{russian}{ancient}}"])
|
||||
|
||||
##
|
||||
# Conversion hub
|
||||
#
|
||||
@ -886,11 +1024,13 @@ convert = [
|
||||
[626, []],
|
||||
[627, [convert_nomencl, convert_index_sc]],
|
||||
[628, []],
|
||||
[629, []]
|
||||
[629, []],
|
||||
[630, []]
|
||||
]
|
||||
|
||||
|
||||
revert = [
|
||||
[629, [revert_new_polyglossia_languages, revert_new_babel_languages]],
|
||||
[628, [revert_langopts]],
|
||||
[627, [revert_nomentbl]],
|
||||
[626, [revert_nomencl, revert_index_sc]],
|
||||
|
@ -50,19 +50,21 @@ namespace {
|
||||
* please keep this in sync with known_coded_languages line by line!
|
||||
*/
|
||||
const char * const known_languages[] = {"acadian", "afrikaans", "albanian",
|
||||
"american", "ancientgreek", "arabic", "arabtex", "australian", "austrian", "azerbaijani", "bahasa", "bahasai",
|
||||
"bahasam", "basque", "belarusian", "bosnian", "brazil", "brazilian", "breton", "british",
|
||||
"bulgarian", "canadian", "canadien", "catalan", "croatian", "czech", "danish",
|
||||
"dutch", "english", "esperanto", "estonian", "farsi", "finnish", "francais",
|
||||
"french", "frenchb", "frenchle", "frenchpro", "friulan", "galician", "german", "germanb",
|
||||
"georgian", "greek", "hebrew", "hungarian", "icelandic", "indon", "indonesian",
|
||||
"interlingua", "irish", "italian", "japanese", "kazakh", "kurmanji", "latin",
|
||||
"latvian", "lithuanian", "lowersorbian", "lsorbian", "macedonian", "magyar", "malay", "meyalu",
|
||||
"mexican", "mongolian", "naustrian", "newzealand", "ngerman", "ngermanb", "norsk", "nswissgerman",
|
||||
"nynorsk", "piedmontese", "polutonikogreek", "polish", "portuges", "portuguese",
|
||||
"romanian", "romansh", "russian", "russianb", "samin", "scottish", "serbian", "serbian-latin",
|
||||
"slovak", "slovene", "spanish", "swedish", "swissgerman", "thai", "turkish", "turkmen",
|
||||
"ukraineb", "ukrainian", "uppersorbian", "UKenglish", "USenglish", "usorbian",
|
||||
"american", "amharic", "ancientgreek", "arabic", "arabtex", "armenian", "asturian",
|
||||
"australian", "austrian", "azerbaijani", "bahasa", "bahasai", "bahasam", "basque",
|
||||
"belarusian", "bengali", "bosnian", "brazil", "brazilian", "breton", "british",
|
||||
"bulgarian", "canadian", "canadien", "catalan", "churchslavic", "classiclatin", "coptic",
|
||||
"croatian", "czech", "danish", "divehi", "dutch", "ecclesiasticlatin", "english", "esperanto",
|
||||
"estonian", "farsi", "finnish", "francais", "french", "frenchb", "frenchle", "frenchpro", "friulan",
|
||||
"galician", "german", "germanb", "georgian", "greek", "hebrew", "hindi", "hungarian", "icelandic",
|
||||
"indon", "indonesian", "interlingua", "irish", "italian", "japanese", "kannada", "kazakh", "khmer",
|
||||
"kurmanji", "lao", "latin", "latvian", "lithuanian", "lowersorbian", "lsorbian", "macedonian", "magyar",
|
||||
"malay", "malayalam", "marathi", "medievallatin", "meyalu", "mexican", "mongolian", "naustrian", "newzealand",
|
||||
"ngerman", "ngermanb", "nko", "norsk", "nswissgerman", "nynorsk", "occitan", "odia", "piedmontese",
|
||||
"polutonikogreek", "polish", "portuges", "portuguese", "romanian", "romansh", "russian", "russianb",
|
||||
"samin", "scottish", "serbian", "serbian-latin", "punjabi", "sanskrit", "slovak", "slovene", "sorani",
|
||||
"spanish", "swedish", "swissgerman", "syriac", "tamil", "telugu", "thai", "tibetan", "turkish", "turkmen",
|
||||
"ukraineb", "ukrainian", "uppersorbian", "UKenglish", "urdu", "USenglish", "usorbian", "uyghur",
|
||||
"vietnam", "welsh",
|
||||
0};
|
||||
|
||||
@ -71,19 +73,21 @@ const char * const known_languages[] = {"acadian", "afrikaans", "albanian",
|
||||
* please keep this in sync with known_languages line by line!
|
||||
*/
|
||||
const char * const known_coded_languages[] = {"french", "afrikaans", "albanian",
|
||||
"american", "ancientgreek", "arabic_arabi", "arabic_arabtex", "australian", "austrian", "azerbaijani", "bahasa", "bahasa",
|
||||
"bahasam", "basque", "belarusian", "bosnian", "brazilian", "brazilian", "breton", "british",
|
||||
"bulgarian", "canadian", "canadien", "catalan", "croatian", "czech", "danish",
|
||||
"dutch", "english", "esperanto", "estonian", "farsi", "finnish", "french",
|
||||
"french", "french", "french", "french", "friulan", "galician", "german", "german",
|
||||
"georgian", "greek", "hebrew", "magyar", "icelandic", "bahasa", "bahasa",
|
||||
"interlingua", "irish", "italian", "japanese", "kazakh", "kurmanji", "latin",
|
||||
"latvian", "lithuanian", "lowersorbian", "lowersorbian", "macedonian", "magyar", "bahasam", "bahasam",
|
||||
"spanish-mexico", "mongolian", "naustrian", "newzealand", "ngerman", "ngerman", "norsk", "german-ch",
|
||||
"nynorsk", "piedmontese", "polutonikogreek", "polish", "portuguese", "portuguese",
|
||||
"romanian", "romansh", "russian", "russian", "samin", "scottish", "serbian", "serbian-latin",
|
||||
"slovak", "slovene", "spanish", "swedish", "german-ch-old", "thai", "turkish", "turkmen",
|
||||
"ukrainian", "ukrainian", "uppersorbian", "english", "english", "uppersorbian",
|
||||
"american", "amharic", "ancientgreek", "arabic_arabi", "arabic_arabtex", "armenian", "asturian",
|
||||
"australian", "austrian", "azerbaijani", "bahasa", "bahasa", "bahasam", "basque",
|
||||
"belarusian", "bengali", "bosnian", "brazilian", "brazilian", "breton", "british",
|
||||
"bulgarian", "canadian", "canadien", "catalan", "churchslavonic", "latin-classic", "coptic",
|
||||
"croatian", "czech", "danish", "divehi", "dutch", "latin-ecclesiastic", "english", "esperanto",
|
||||
"estonian", "farsi", "finnish", "french", "french", "french", "french", "french", "friulan",
|
||||
"galician", "german", "german", "georgian", "greek", "hebrew", "hindi", "magyar", "icelandic",
|
||||
"bahasa", "bahasa", "interlingua", "irish", "italian", "japanese", "kannada", "kazakh", "khmer",
|
||||
"kurmanji", "lao", "latin", "latvian", "lithuanian", "lowersorbian", "lowersorbian", "macedonian", "magyar",
|
||||
"bahasam", "malayalam", "marathi", "latin-medieval", "bahasam", "spanish-mexico", "mongolian", "naustrian", "newzealand",
|
||||
"ngerman", "ngerman", "nko", "norsk", "german-ch", "nynorsk", "occitan", "odia", "piedmontese",
|
||||
"polutonikogreek", "polish", "portuguese", "portuguese", "romanian", "romansh", "russian", "russian",
|
||||
"samin", "scottish", "serbian", "serbian-latin", "punjabi", "sanskrit", "slovak", "slovene", "sorani",
|
||||
"spanish", "swedish", "german-ch-old", "syriac", "tamil", "telugu", "thai", "tibetan", "turkish", "turkmen",
|
||||
"ukrainian", "ukrainian", "uppersorbian", "english", "urdu", "english", "uppersorbian", "uyghur",
|
||||
"vietnamese", "welsh",
|
||||
0};
|
||||
|
||||
@ -326,17 +330,16 @@ string process_keyval_opt(vector<string> & options, string const & name)
|
||||
const char * const Preamble::polyglossia_languages[] = {
|
||||
"albanian", "american", "amharic", "ancient", "arabic", "armenian", "asturian", "australian",
|
||||
"bahasai", "bahasam", "basque", "bengali", "brazil", "brazilian", "breton", "british", "bulgarian",
|
||||
"catalan", "churchslavonic", "coptic", "croatian", "czech", "danish", "divehi", "dutch",
|
||||
"catalan", "chinese", "chinese", "churchslavonic", "coptic", "croatian", "czech", "danish", "divehi", "dutch",
|
||||
"english", "esperanto", "estonian", "farsi", "finnish", "french", "friulan",
|
||||
"galician", "greek", "monotonic", "hebrew", "hindi",
|
||||
"icelandic", "interlingua", "irish", "italian", "kannada", "khmer", "korean",
|
||||
"lao", "latin", "latvian", "lithuanian", "lsorbian", "magyar", "malayalam", "marathi",
|
||||
"austrian", "newzealand", "german", "norsk", "nynorsk", "occitan", "oldrussian",
|
||||
"piedmontese", "polish", "polytonic", "portuges", "romanian", "romansh", "russian",
|
||||
"icelandic", "interlingua", "irish", "italian", "japanese", "kannada", "khmer", "korean",
|
||||
"kurdish", "kurmanji", "lao", "latin", "latvian", "lithuanian", "lsorbian", "magyar", "malayalam", "marathi",
|
||||
"austrian", "newzealand", "german", "nko", "norsk", "nynorsk", "occitan", "odia", "oldrussian",
|
||||
"piedmontese", "polish", "polytonic", "portuguese", "punjabi", "romanian", "romansh", "russian",
|
||||
"samin", "sanskrit", "scottish", "serbian", "slovak", "slovenian", "spanish", "swedish", "syriac",
|
||||
"tamil", "telugu", "thai", "tibetan", "turkish", "turkmen",
|
||||
"ukrainian", "urdu", "usorbian", "vietnamese", "welsh", 0};
|
||||
// not yet supported by LyX: "korean", "nko"
|
||||
"ukrainian", "urdu", "usorbian", "uyghur", "vietnamese", "welsh", 0};
|
||||
|
||||
/**
|
||||
* the same as polyglossia_languages with .lyx names
|
||||
@ -345,17 +348,17 @@ const char * const Preamble::polyglossia_languages[] = {
|
||||
const char * const Preamble::coded_polyglossia_languages[] = {
|
||||
"albanian", "american", "amharic", "ancientgreek", "arabic_arabi", "armenian", "asturian", "australian",
|
||||
"bahasa", "bahasam", "basque", "bengali", "brazilian", "brazilian", "breton", "british", "bulgarian",
|
||||
"catalan", "churchslavonic", "coptic", "croatian", "czech", "danish", "divehi", "dutch",
|
||||
"catalan", "chinese-simplified", "chinese-traditional", "churchslavonic", "coptic", "croatian", "czech",
|
||||
"danish", "divehi", "dutch",
|
||||
"english", "esperanto", "estonian", "farsi", "finnish", "french", "friulan",
|
||||
"galician", "greek", "greek", "hebrew", "hindi",
|
||||
"icelandic", "interlingua", "irish", "italian", "kannada", "khmer", "korean",
|
||||
"lao", "latin", "latvian", "lithuanian", "lowersorbian", "magyar", "malayalam", "marathi",
|
||||
"naustrian","newzealand", "ngerman", "norsk", "nynorsk", "occitan", "oldrussian",
|
||||
"piedmontese", "polish", "polutonikogreek", "portuges", "romanian", "romansh", "russian",
|
||||
"icelandic", "interlingua", "irish", "italian", "japanese", "kannada", "khmer", "korean",
|
||||
"sorani", "kurmanji", "lao", "latin", "latvian", "lithuanian", "lowersorbian", "magyar", "malayalam", "marathi",
|
||||
"naustrian","newzealand", "ngerman", "nko", "norsk", "nynorsk", "occitan", "odia", "oldrussian",
|
||||
"piedmontese", "polish", "polutonikogreek", "portuges", "punjabi", "romanian", "romansh", "russian",
|
||||
"samin", "sanskrit", "scottish", "serbian", "slovak", "slovene", "spanish", "swedish", "syriac",
|
||||
"tamil", "telugu", "thai", "tibetan", "turkish", "turkmen",
|
||||
"ukrainian", "urdu", "uppersorbian", "vietnamese", "welsh", 0};
|
||||
// not yet supported by LyX: "korean-polyglossia", "nko"
|
||||
"ukrainian", "urdu", "uppersorbian", "uyghur", "vietnamese", "welsh", 0};
|
||||
|
||||
|
||||
bool Preamble::usePolyglossia() const
|
||||
|
@ -32,8 +32,8 @@ extern char const * const lyx_version_info;
|
||||
|
||||
// Do not remove the comment below, so we get merge conflict in
|
||||
// independent branches. Instead add your own.
|
||||
#define LYX_FORMAT_LYX 629 // spitz: language options
|
||||
#define LYX_FORMAT_TEX2LYX 629
|
||||
#define LYX_FORMAT_LYX 630 // spitz: language updates
|
||||
#define LYX_FORMAT_TEX2LYX 630
|
||||
|
||||
#if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX
|
||||
#ifndef _MSC_VER
|
||||
|
Loading…
Reference in New Issue
Block a user