From ea2d5947e976964e91bc691ea2a4fe03ccf83d2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Uwe=20St=C3=B6hr?= Date: Tue, 28 May 2013 23:40:17 +0200 Subject: [PATCH] support to set Tibetan as document language - polyglossia supports http://en.wikipedia.org/wiki/Standard_Tibetan so we can support it too - fileformat change --- development/FORMAT | 3 +++ lib/languages | 8 ++++++++ lib/lyx2lyx/lyx_2_1.py | 22 +++++++++++++++++++++- src/tex2lyx/Preamble.cpp | 16 ++++++++-------- src/version.h | 4 ++-- 5 files changed, 42 insertions(+), 11 deletions(-) diff --git a/development/FORMAT b/development/FORMAT index fedfd4303b..079d978629 100644 --- a/development/FORMAT +++ b/development/FORMAT @@ -11,6 +11,9 @@ adjustments are made to tex2lyx and bugs are fixed in lyx2lyx. ----------------------- +2013-05-28 Uwe Stöhr + * Format incremented to 473: support to set Tibetan as document language + 2013-05-26 Uwe Stöhr * Format incremented to 472: added 2 new abstract styles to the aa.layout file diff --git a/lib/languages b/lib/languages index 7ece4117ab..740341df5e 100644 --- a/lib/languages +++ b/lib/languages @@ -918,6 +918,14 @@ Language thai EndPostBabelPreamble End +# not supported by babel +Language tibetan + GuiName "Tibetan" + PolyglossiaName tibetan + Encoding utf8 + LangCode bo_CN +End + Language turkish GuiName "Turkish" BabelName turkish diff --git a/lib/lyx2lyx/lyx_2_1.py b/lib/lyx2lyx/lyx_2_1.py index f97e6be58c..59c81420ec 100644 --- a/lib/lyx2lyx/lyx_2_1.py +++ b/lib/lyx2lyx/lyx_2_1.py @@ -4180,6 +4180,24 @@ def revert_aa2(document): return +def revert_tibetan(document): + "Set the document language for Tibetan to English" + + if document.language == "tibetan": + document.language = "english" + i = find_token(document.header, "\\language", 0) + if i != -1: + document.header[i] = "\\language english" + j = 0 + while j < len(document.body): + j = find_token(document.body, "\\lang tibetan", j) + if j != -1: + document.body[j] = document.body[j].replace("\\lang tibetan", "\\lang english") + j += 1 + else: + j = len(document.body) + + ## # Conversion hub # @@ -4244,10 +4262,12 @@ convert = [ [469, []], [470, []], [471, [convert_cite_engine_type_default]], - [472, []] + [472, []], + [473, []] ] revert = [ + [472, [revert_tibetan]], [471, [revert_aa1,revert_aa2]], [470, [revert_cite_engine_type_default]], [469, [revert_forced_local_layout]], diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp index 950eed39de..9759663808 100644 --- a/src/tex2lyx/Preamble.cpp +++ b/src/tex2lyx/Preamble.cpp @@ -304,10 +304,10 @@ const char * const Preamble::polyglossia_languages[] = { "armenian", "divehi", "interlingua", "polish", "telugu", "asturian", "dutch", "irish", "portuges", "thai", "bahasai", "english", "italian", "romanian", "turkish", "bahasam", "esperanto", "lao", "russian", "turkmen", "basque", "estonian", "latin", -"samin", "ukrainian", "bengali", "farsi", "latvian", "sanskrit", "urdu", "brazil", -"brazilian", "finnish", "lithuanian", "scottish", "usorbian", "breton", "french", -"lsorbian", "serbian", "vietnamese", "bulgarian", "galician", "magyar", "slovak", -"welsh", "catalan", "german", "malayalam", "slovenian", "coptic", "greek", +"samin", "ukrainian", "bengali", "farsi", "latvian", "sanskrit", "tibetan", "urdu", +"brazil", "brazilian", "finnish", "lithuanian", "scottish", "usorbian", "breton", +"french", "lsorbian", "serbian", "vietnamese", "bulgarian", "galician", "magyar", +"slovak", "welsh", "catalan", "german", "malayalam", "slovenian", "coptic", "greek", "marathi", "spanish", "american", "ancient", "australian", "british", "monotonic", "newzealand", "polytonic", 0}; @@ -322,10 +322,10 @@ const char * const Preamble::coded_polyglossia_languages[] = { "armenian", "divehi", "interlingua", "polish", "telugu", "asturian", "dutch", "irish", "portuges", "thai", "bahasa", "english", "italian", "romanian", "turkish", "bahasam", "esperanto", "lao", "russian", "turkmen", "basque", "estonian", "latin", -"samin", "ukrainian", "bengali", "farsi", "latvian", "sanskrit", "urdu", "brazilian", -"brazilian", "finnish", "lithuanian", "scottish", "uppersorbian", "breton", "french", -"lowersorbian", "serbian", "vietnamese", "bulgarian", "galician", "magyar", "slovak", -"welsh", "catalan", "ngerman", "malayalam", "slovene", "coptic", "greek", +"samin", "ukrainian", "bengali", "farsi", "latvian", "sanskrit", "tibetan", "urdu", +"brazilian", "brazilian", "finnish", "lithuanian", "scottish", "uppersorbian", "breton", +"french", "lowersorbian", "serbian", "vietnamese", "bulgarian", "galician", "magyar", +"slovak", "welsh", "catalan", "ngerman", "malayalam", "slovene", "coptic", "greek", "marathi", "spanish", "american", "ancientgreek", "australian", "british", "greek", "newzealand", "polutonikogreek", 0}; diff --git a/src/version.h b/src/version.h index ea4b18422a..3aa8ce8330 100644 --- a/src/version.h +++ b/src/version.h @@ -30,8 +30,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 472 // uwestoehr: updated layout for A&A class -#define LYX_FORMAT_TEX2LYX 472 +#define LYX_FORMAT_LYX 473 // uwestoehr: support Tibetan as document language +#define LYX_FORMAT_TEX2LYX 473 #if LYX_FORMAT_TEX2LYX != LYX_FORMAT_LYX #ifndef _MSC_VER