Author: rgheck
Date: Tue Jan 18 17:50:43 2011
New Revision: 37254
URL: http://www.lyx.org/trac/changeset/37254

Log:
Add conversion of \language_use_babel.

Modified:
   lyx-devel/trunk/lib/scripts/prefs2prefs_prefs.py

Modified: lyx-devel/trunk/lib/scripts/prefs2prefs_prefs.py
==============================================================================
--- lyx-devel/trunk/lib/scripts/prefs2prefs_prefs.py    Tue Jan 18 16:42:27 
2011        (r37253)
+++ lyx-devel/trunk/lib/scripts/prefs2prefs_prefs.py    Tue Jan 18 17:50:43 
2011        (r37254)
@@ -24,20 +24,32 @@
 no_match = (False, [])
 
 def remove_obsolete(line):
-  tags = ("\\use_tempdir", "\\spell_command", "\\personal_dictionary",
-        "\\plaintext_roff_command", "\\use_alt_language", 
-        "\\use_escape_chars", "\\use_input_encoding",
-        "\\use_personal_dictionary", "\\use_pspell",
-        "\\use_spell_lib")
-  line = line.lstrip()
-  for tag in tags:
-    if line.startswith(tag):
-      return (True, "")
-  return no_match
+       tags = ("\\use_tempdir", "\\spell_command", "\\personal_dictionary",
+                               "\\plaintext_roff_command", 
"\\use_alt_language", 
+                               "\\use_escape_chars", "\\use_input_encoding",
+                               "\\use_personal_dictionary", "\\use_pspell",
+                               "\\use_spell_lib")
+       line = line.lstrip()
+       for tag in tags:
+               if line.startswith(tag):
+                       return (True, "")
+       return no_match
 
+def language_use_babel(line):
+       if not line.startswith("\language_use_babel"):
+               return no_match
+       re_lub = re.compile(r'^\\language_use_babel\s+(true|false)')
+       m = re_lub.match(line)
+       val = m.group(1)
+       newval = '0'
+       if val == 'false':
+               newval = '3'
+       newline = "\\language_package_selection " + newval
+       return (True, newline)
 
 conversions = [
        [ # this will be a long list of conversions for format 0
-    remove_obsolete
+               remove_obsolete,
+               language_use_babel
        ] # end conversions for format 0
 ]

Reply via email to