From 9b39fbf5570f8572ad0d855d4fcc2ce08008fc9e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Fri, 28 Nov 2008 13:44:03 +0000 Subject: [PATCH] Add support for Swiss German (bug 5450). File format change. Babel doesn't support this variant (yet), so we use ngerman. However, for spell checking and thesaurus, this makes a difference. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@27725 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/languages | 1 + lib/lyx2lyx/LyX.py | 3 +-- lib/lyx2lyx/lyx_2_0.py | 22 ++++++++++++++++++---- src/Buffer.cpp | 2 +- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/lib/languages b/lib/languages index 5d1dcf2c7e..271022a3f2 100644 --- a/lib/languages +++ b/lib/languages @@ -41,6 +41,7 @@ french french "French" false iso8859-15 fr_FR "\addto\extrasfrench{\prov galician galician "Galician" false iso8859-15 gl_ES "" german german "German (old spelling)" false iso8859-15 de_DE "" ngerman ngerman "German" false iso8859-15 de_DE "" +german-ch ngerman "German (Switzerland)" false iso8859-15 de_CH "" greek greek "Greek" false iso8859-7 el_GR "" polutonikogreek polutonikogreek "Greek (polytonic)" false iso8859-7 el_GR "\makeatletter\let\lyx@tildeaccent\~\addto\extraspolutonikogreek{\bbl@deactivate{~}\let\~\lyx@tildeaccent}\addto\extrasgreek{\bbl@deactivate{~}\let\~\lyx@tildeaccent}\makeatother" hebrew hebrew "Hebrew" true cp1255 he_IL "" diff --git a/lib/lyx2lyx/LyX.py b/lib/lyx2lyx/LyX.py index ba3067d3f7..680f33c88f 100644 --- a/lib/lyx2lyx/LyX.py +++ b/lib/lyx2lyx/LyX.py @@ -81,8 +81,7 @@ format_relation = [("0_06", [200], minor_versions("0.6" , 4)), ("1_4", range(222,246), minor_versions("1.4" , 5)), ("1_5", range(246,277), minor_versions("1.5" , 7)), ("1_6", range(277,346), minor_versions("1.6" , 0)), - ] -# ("2_0", [], minor_versions("2.0", 0))] + ("2_0", [], minor_versions("2.0", 0))] #################################################################### # This is useful just for development versions # diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index 681e1089bb..b56f31123c 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -29,18 +29,32 @@ def find_end_of_inset(lines, i): #################################################################### -def dummy(document): - pass + +def revert_swiss(document): + "Set language german-ch to ngerman" + i = 0 + if document.language == "german-ch": + document.language = "ngerman" + i = find_token(document.header, "\\language", 0) + if i != -1: + document.header[i] = "\\language ngerman" + j = 0 + while True: + j = find_token(document.body, "\\lang german-ch", j) + if j == -1: + return + document.body[j] = document.body[j].replace("\\lang german-ch", "\\lang ngerman") + j = j + 1 ## # Conversion hub # supported_versions = ["2.2.0","2.0"] -convert = [[346, [dummy]] +convert = [[346, []] ] -revert = [[345, []] +revert = [[345, [revert_swiss]] ] diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 31fba248c8..5138c4227c 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -118,7 +118,7 @@ namespace { // Do not remove the comment below, so we get merge conflict in // independent branches. Instead add your own. -int const LYX_FORMAT = 345; // jamatos: xml elements +int const LYX_FORMAT = 346; // jspitzm: Swiss German typedef map DepClean; typedef map > RefCache;