]> git.lyx.org Git - features.git/blobdiff - lib/languages
Load inputenc after babel with Thai.
[features.git] / lib / languages
index 2ae77bc977d840f722b4a534c8609f9a608ca079..9e6731f4693d7b43b4111a94ee0bafcf11fc5aae 100644 (file)
@@ -17,7 +17,6 @@
 #      FontEncoding       <font encoding|font encoding|...>
 #      InternalEncoding   <true|false>
 #      RTL                <true|false>
-#      AsBabelOptions     <true|false>
 #      LangCode           <language_code>
 #      LangVariety        <language_variety>
 #      PreBabelPreamble
 #   If True, LyX takes care for characters/macros that do not exist in
 #   some font encodings ("<", ">", "|" and straight quote).
 #   It is not required for standard encodings like T2A. See bug #5091.
-# * AsBabelOptions advices LyX to pass the languages locally to babel, not
-#   globally to the class. In the old days, some languages (basically those
-#   not natively supported by babel) needed this.
-#   FIXME: in this case, we might still need to pass the other languages
-#          globally, for the use of other packages (such as varioref).
 # * LangCode is also used for spellchecking and thesaurus, where the
 #   dictionaries are named accordingly. Thus, check this when introducing/
 #   changing language codes (especially aspell, thesaurus).
@@ -161,6 +155,14 @@ End
 Language albanian
        GuiName          "Albanian"
        BabelName        albanian
+       # babel-albanian (albanian.ldf) (re-)defines the functions
+       # \sh \ch \th \cth \arsh \arch \arth \arcth \tg \ctg \arctg
+       # as math operators. This clashes with \th == letter thorn
+       # in font encoding T1
+       PostBabelPreamble
+         % fix albanian: restore \th as LATIN LETTER THORN
+         \@ifl@aded{def}{t1enc}{\DeclareTextSymbol{\th}{T1}{254}}{}
+       EndPostBabelPreamble
        PolyglossiaName  albanian
        QuoteStyle       swiss
        Encoding         iso8859-2
@@ -193,20 +195,20 @@ End
 # In Babel, this is supported since v. 1.8a of babel-greek (2013-12-03)
 # We introduce it with LyX 2.2 to give the support time to settle.
 Language ancientgreek
-       GuiName           "Greek (ancient)"
-       BabelName         greek
+       GuiName          "Greek (ancient)"
+       BabelName        greek
        PostBabelPreamble
        \languageattribute{greek}{ancient}
        EndPostBabelPreamble
-       PolyglossiaName   greek
-       PolyglossiaOpts   "variant=ancient"
-       QuoteStyle        french
-       Encoding          iso8859-7
-       InternalEncoding  true
-       FontEncoding      LGR
+       PolyglossiaName  greek
+       PolyglossiaOpts  "variant=ancient"
+       QuoteStyle       french
+       Encoding         iso8859-7
+       InternalEncoding true
+       FontEncoding     LGR
        DateFormats      "dd MMMM yyyy|dd MMM yyyy|dd/MM/yyyy"
-       LangCode          grc_GR
-       Provides          textgreek
+       LangCode         grc_GR
+       Provides         textgreek
 End
 
 # FIXME: dummy babel language for arabic_arabtex to be able
@@ -353,6 +355,10 @@ Language belarusian
        LangCode         be_BY
 End
 
+# supported by polyglossia but not LyX:
+# Language bengali
+#      PolyglossiaName  bengali
+
 # not yet supported by polyglossia
 # The (rarely used) Cyrillic script is not supported (try serbian).
 Language bosnian
@@ -403,6 +409,7 @@ End
 
 Language bulgarian
        GuiName          "Bulgarian"
+       HasGuiSupport    true
        BabelName        bulgarian
        PolyglossiaName  bulgarian
        QuoteStyle       german
@@ -476,6 +483,10 @@ Language chinese-traditional
        Requires         CJK
 End
 
+# supported by polyglossia but not LyX:
+# Language churchslavonic
+#      PolyglossiaName  churchslavonic
+
 # not supported by babel
 # FIXME DateFormats
 Language coptic
@@ -727,52 +738,56 @@ Language german-ch-old
 End
 
 Language greek
-       GuiName           "Greek"
-       HasGuiSupport     true
-       BabelName         greek
-       PolyglossiaName   greek
-       PolyglossiaOpts   "variant=monotonic"
-       QuoteStyle        french
-       Encoding          iso8859-7
-       InternalEncoding  true
-       FontEncoding      LGR
+       GuiName          "Greek"
+       HasGuiSupport    true
+       BabelName        greek
+       PolyglossiaName  greek
+       PolyglossiaOpts  "variant=monotonic"
+       QuoteStyle       french
+       Encoding         iso8859-7
+       InternalEncoding true
+       FontEncoding     LGR
        DateFormats      "dd MMMM yyyy|dd MMM yyyy|dd/MM/yyyy"
-       LangCode          el_GR
-       Provides          textgreek
+       LangCode         el_GR
+       Provides         textgreek
 End
 
 Language polutonikogreek
-       GuiName           "Greek (polytonic)"
-       BabelName         polutonikogreek
-       PolyglossiaName   greek
-       PolyglossiaOpts   "variant=polytonic"
-       QuoteStyle        french
-       Encoding          iso8859-7
-       InternalEncoding  true
-       FontEncoding      LGR
+       GuiName          "Greek (polytonic)"
+       BabelName        polutonikogreek
+       PolyglossiaName  greek
+       PolyglossiaOpts  "variant=polytonic"
+       QuoteStyle       french
+       Encoding         iso8859-7
+       InternalEncoding true
+       FontEncoding     LGR
        DateFormats      "dd MMMM yyyy|dd MMM yyyy|dd/MM/yyyy"
-       LangCode          el_GR
-       Provides          textgreek
+       LangCode         el_GR
+       Provides         textgreek
 End
 
 Language hebrew
-       GuiName           "Hebrew"
-       HasGuiSupport     true
-       BabelName         hebrew
-       PolyglossiaName   hebrew
-       Encoding          cp1255
-       QuoteStyle        english
-       InternalEncoding  true
+       GuiName          "Hebrew"
+       HasGuiSupport    true
+       BabelName        hebrew
+       PolyglossiaName  hebrew
+       Encoding         cp1255
+       QuoteStyle       english
+       InternalEncoding true
        # babel-hebrew expects the encoding for *other* languages last:
-       # FontEncoding      HE8
-       # Define the font encoding the babel-hebrew way and
+       # FontEncoding    HE8|LHE
+       ## Use font encoding HE8 if the Culmus fonts are installed and
        # work around too simple test for article-like classes in rlbabel.def.
        PreBabelPreamble
+         %\IfFileExists{he8david.fd}{%
+         %  \providecommand{\HeblatexEncoding}{HE8}
+         %  \providecommand{\HeblatexEncodingFile}{he8enc}%
+         %}{}
          \providecommand{\l@chapter}{\relax}
        EndPreBabelPreamble
        DateFormats      "d MMMM yyyy|d MMM yyyy|dd/MM/yyyy"
-       RTL               true
-       LangCode          he_IL
+       RTL              true
+       LangCode         he_IL
 End
 
 # not supported by babel
@@ -845,8 +860,8 @@ Language italian
        LangCode         it_IT
 End
 
-# Since japanese does not load fontenc, we set
-# InternalEncoding to true.
+# Since 2016-12-18, babel-japanese works with non-TeX fonts (Xe/LuaTeX), too
+# (use with "Japanese (bxjs)" or standard document classes)
 Language japanese
        GuiName          "Japanese"
        HasGuiSupport    true
@@ -854,8 +869,7 @@ Language japanese
        Encoding         jis-platex
        LangCode         ja_JP
        Requires         japanese
-       InternalEncoding true
-       FontEncoding     None
+       FontEncoding     ASCII
        DateFormats      "yyyy年M月d日|yyyy/MM/dd|yy/MM/dd"
        QuoteStyle       cjk
 End
@@ -884,15 +898,9 @@ End
 Language kazakh
        GuiName          "Kazakh"
        Encoding         ascii
-       FontEncoding     T2A
+       # FontEncoding   T2A # not set (no Babel support)
        DateFormats      "dd MMMM yyyy|dd MMMM yyyy|yyyy-dd-MM"
        LangCode         kk_KZ
-       # FIXME: this sets the global font encoding also
-       # if Kazakh is only used as secondary language.
-       PostBabelPreamble
-       \input{t2aenc.def}
-       \AtBeginDocument{\fontencoding{T2A}\selectfont}
-       EndPostBabelPreamble
 End
 
 # not supported by babel
@@ -904,8 +912,10 @@ Language khmer
        LangCode         km_KH
 End
 
+# Fixme: activate Polyglossia support (file format change)
 Language korean
        GuiName         "Korean"
+       #PolyglossiaName  korean
        Encoding        euc-kr
        QuoteStyle      cjkangle
        DateFormats     "yyyy년 M월 d일|yyyy. M. d.|yy. M. d."
@@ -968,6 +978,14 @@ Language lithuanian
        QuoteStyle       german
        Encoding         iso8859-13
        FontEncoding     L7x
+       # L7x defines \copyright as TextSymbol which leads to an endless loop
+        # when it is used in other font encodings.
+       PostBabelPreamble
+         % restore \coyright definition corrupted by l7xenc.def
+          \DeclareRobustCommand{\copyright}{%
+            \ifmmode{\nfss@text{\textcopyright}}\else\textcopyright\fi}
+           \addto\noextraslithuanian{\latintext}
+       EndPostBabelPreamble
        DateFormats      "yyyy 'm.' MMMM d 'd.'|yyyy 'm.' MMMM d 'd.'|yyyy-MM-dd"
        LangCode         lt_LT
 End
@@ -1063,6 +1081,11 @@ Language norsk
        LangCode         nb_NO
 End
 
+# supported by polyglossia but not LyX:
+# Language nko
+#      GuiName         "N’Ko"            
+#      PolyglossiaName nko
+
 Language nynorsk
        GuiName          "Norwegian (Nynorsk)"
        HasGuiSupport    true
@@ -1205,18 +1228,22 @@ Language scottish
        LangCode         gd_GB
 End
 
-# Note: script option is uppercase, even if the polyglossia
-#       manual states otherwise.
+# Serbian with Cyrillic script.
+# Up to Version 3.0 (2019-01-12), input encoding and
+# font encoding were set document-wide to "utf8x" and "T2A" respectively
+# by "babel-serbianc", overriding LyX settings and leading to errors
+# in mulit-lingual documents.
 Language serbian
        GuiName          "Serbian"
        HasGuiSupport    true
        BabelName        serbianc
        PolyglossiaName  serbian
        PolyglossiaOpts  "script=Cyrillic"
+       # Note: script option is uppercase, even if the polyglossia
+       #       manual states otherwise.
        QuoteStyle       polish
        Encoding         utf8
-        # Cyrillic font encoding required but not set by "serbianc".
-       # FontEncoding     T2A
+       FontEncoding     T2A
        DateFormats      "d. MMMM yyyy|d. MMM yyyy|dd.MM.yyyy"
        LangCode         sr_RS
 End
@@ -1328,6 +1355,8 @@ Language telugu
        LangCode         te_IN
 End
 
+# There is an alternative support with CJK package and Babel name "thaicjk".
+
 Language thai
        GuiName          "Thai"
        BabelName        thai
@@ -1337,12 +1366,25 @@ Language thai
        FontEncoding     LTH
        DateFormats      "dd MMMM yyyy|d MMM yyyy|dd/MM/yyyy"
        LangCode         th_TH
-       # Fixme: load font package?
-       # +1 support for font attributes in thai emphasizing etc.
-       # -1 conflict with custom font settings and other languages' fonts
-       # PostBabelPreamble
-       # \usepackage{fonts-tlwg}
-       # EndPostBabelPreamble
+       # The first workaround requires loading inputenc after babel
+       # (cf. BufferParams.cpp):
+       PostBabelPreamble
+         % Restore catcodes changed by thai.ldf (active characters required for inputenc)
+         \@tempcnta=161%
+         \@whilenum\@tempcnta<252\do{%
+           \catcode\@tempcnta=13
+           \advance\@tempcnta\@ne
+         }%      
+         % Restore \coyright definition corrupted by lthenc.def
+         \DeclareRobustCommand{\copyright}{%
+           \ifmmode{\nfss@text{\textcopyright}}\else\textcopyright\fi}
+         \DeclareTextSymbol{\textcopyright}{LTH}{8}
+          % set up Thai fonts as substitue for the default families
+          \usepackage{substitutefont}
+          \substitutefont{LTH}{\rmdefault}{norasi}
+          \substitutefont{LTH}{\sfdefault}{garuda}
+          \substitutefont{LTH}{\ttdefault}{ttypist}
+       EndPostBabelPreamble
 End
 
 # not supported by babel