support for the Vietnamese languages

fileformat increased to 291

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@20738 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Uwe Stöhr 2007-10-04 23:20:39 +00:00
parent 98eff22b9a
commit ae0f514870
6 changed files with 41 additions and 7 deletions

View File

@ -1,6 +1,9 @@
LyX file-format changes
-----------------------
2007-10-04 Uwe Stöhr Uwe Stöhr <uwestoehr@web.de>
* Format incremented to 291: Support for Vietnamese.
2007-10-03 Uwe Stöhr Uwe Stöhr <uwestoehr@web.de>
* Format incremented to 290: Add table wrap floats.

View File

@ -66,4 +66,5 @@ thai thai "Thai" false tis620-0 th_TH "\usepackage{thswitch}"
turkish turkish "Turkish" false iso8859-9 tr_TR ""
ukrainian ukrainian "Ukrainian" false koi8-u uk_UA ""
usorbian usorbian "Upper Sorbian" false iso8859-2 hsb_DE ""
vietnamese vietnam "Vietnamese" false utf8 vi_VN ""
welsh welsh "Welsh" false iso8859-15 cy_GB ""

View File

@ -80,7 +80,7 @@ format_relation = [("0_06", [200], minor_versions("0.6" , 4)),
("1_3", [221], minor_versions("1.3" , 7)),
("1_4", range(222,246), minor_versions("1.4" , 5)),
("1_5", range(246,277), minor_versions("1.5" , 1)),
("1_6", range(277,291), minor_versions("1.6" , 0))] # Uwe Stöhr, wrap table
("1_6", range(277,292), minor_versions("1.6" , 0))] # Uwe Stöhr, Vietnamese
def formats_list():

View File

@ -402,6 +402,24 @@ def revert_wraptable(document):
i = i + 1
def revert_vietnamese(document):
"Set language Vietnamese to English"
# Set document language from Vietnamese to English
i = 0
if document.language == "vietnamese":
document.language = "english"
i = find_token(document.header, "\\language", 0)
if i != -1:
document.header[i] = "\\language english"
j = 0
while True:
j = find_token(document.body, "\\lang vietnamese", j)
if j == -1:
return
document.body[j] = document.body[j].replace("\\lang vietnamese", "\\lang english")
j = j + 1
##
# Conversion hub
#
@ -420,10 +438,12 @@ convert = [[277, [fix_wrong_tables]],
[287, [convert_wrapfig_options]],
[288, [convert_inset_command]],
[289, [convert_latexcommand_index]],
[290, []]
[290, []],
[291, []]
]
revert = [[289, [revert_wraptable]],
revert = [[290, [revert_vietnamese]],
[289, [revert_wraptable]],
[288, [revert_latexcommand_index]],
[287, [revert_inset_command]],
[286, [revert_wrapfig_options]],

View File

@ -154,7 +154,7 @@ namespace fs = boost::filesystem;
namespace {
int const LYX_FORMAT = 290; //Uwe Stöhr, wrap table
int const LYX_FORMAT = 291; //Uwe Stöhr, Vietnamese
} // namespace anon

View File

@ -54,6 +54,7 @@
using std::count;
using std::endl;
using std::find;
using std::string;
using std::istringstream;
using std::ostream;
@ -899,7 +900,12 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
language_options << ',';
language_options << language->babel();
}
if (lyxrc.language_global_options && !language_options.str().empty())
// when Vietnamese is used, babel must directly be loaded with the
// language options, not in the class options
int viet = language_options.str().find("vietnam");
// viet = string::npos when not found
if (lyxrc.language_global_options && !language_options.str().empty()
&& viet == string::npos)
clsoptions << language_options.str() << ',';
}
@ -1548,7 +1554,11 @@ string const BufferParams::babelCall(string const & lang_opts) const
// other languages are used (lang_opts is then empty)
if (lang_opts.empty())
return string();
if (!lyxrc.language_global_options)
// when Vietnamese is used, babel must directly be loaded with the
// language options
int viet = lang_opts.find("vietnam");
// viet = string::npos when not found
if (!lyxrc.language_global_options || viet != string::npos)
return "\\usepackage[" + lang_opts + "]{babel}";
return lang_pack;
}