From 55a9aa714946c5f6301f5d7797dacd82b182c1e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrgen=20Spitzm=C3=BCller?= Date: Wed, 9 Jul 2008 07:27:31 +0000 Subject: [PATCH] Back to CJK sanity II: re-introduce Japanese (CJK) [bug 4700] git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@25511 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/languages | 1 + lib/lyx2lyx/lyx_1_6.py | 40 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/lib/languages b/lib/languages index b74afcdf6e..68bd1a7e3a 100644 --- a/lib/languages +++ b/lib/languages @@ -53,6 +53,7 @@ interlingua interlingua "Interlingua" false iso8859-15 ia "" irish irish "Irish" false iso8859-15 ga_IE "" italian italian "Italian" false iso8859-15 it_IT "" japanese japanese "Japanese" false jis-plain ja_JP "" +japanese-cjk "" "Japanese (CJK)" false euc-jp ja_JP "" kazakh kazakh "Kazakh" false pt154 kk_KZ "" # there is no country code for Korean because ko_KR is the same as ko_KI korean "" "Korean" false euc-kr ko "" diff --git a/lib/lyx2lyx/lyx_1_6.py b/lib/lyx2lyx/lyx_1_6.py index 0d3bd48966..4f6cd2dd9d 100644 --- a/lib/lyx2lyx/lyx_1_6.py +++ b/lib/lyx2lyx/lyx_1_6.py @@ -1080,6 +1080,24 @@ def revert_vietnamese(document): j = j + 1 +def convert_japanese_cjk(document): + "Set language japanese to japanese-cjk" + # Set document language from japanese-plain to japanese + i = 0 + if document.language == "japanese": + document.language = "japanese-cjk" + i = find_token(document.header, "\\language", 0) + if i != -1: + document.header[i] = "\\language japanese-cjk" + j = 0 + while True: + j = find_token(document.body, "\\lang japanese", j) + if j == -1: + return + document.body[j] = document.body[j].replace("\\lang japanese", "\\lang japanese-cjk") + j = j + 1 + + def revert_japanese(document): "Set language japanese-plain to japanese" # Set document language from japanese-plain to japanese @@ -1098,6 +1116,24 @@ def revert_japanese(document): j = j + 1 +def revert_japanese_cjk(document): + "Set language japanese-cjk to japanese" + # Set document language from japanese-plain to japanese + i = 0 + if document.language == "japanese-cjk": + document.language = "japanese" + i = find_token(document.header, "\\language", 0) + if i != -1: + document.header[i] = "\\language japanese" + j = 0 + while True: + j = find_token(document.body, "\\lang japanese-cjk", j) + if j == -1: + return + document.body[j] = document.body[j].replace("\\lang japanese-cjk", "\\lang japanese") + j = j + 1 + + def revert_japanese_encoding(document): "Set input encoding form EUC-JP-plain to EUC-JP etc." # Set input encoding form EUC-JP-plain to EUC-JP etc. @@ -2815,7 +2851,7 @@ convert = [[277, [fix_wrong_tables]], [289, [convert_latexcommand_index]], [290, []], [291, []], - [292, []], + [292, [convert_japanese_cjk]], [293, []], [294, [convert_pdf_options]], [295, [convert_htmlurl, convert_url]], @@ -2910,7 +2946,7 @@ revert = [[337, [revert_polytonicgreek]], [294, [revert_href, revert_url]], [293, [revert_pdf_options_2]], [292, [revert_inset_info]], - [291, [revert_japanese, revert_japanese_encoding]], + [291, [revert_japanese, revert_japanese_encoding, revert_japanese_cjk]], [290, [revert_vietnamese]], [289, [revert_wraptable]], [288, [revert_latexcommand_index]],