diff options
Diffstat (limited to 'scripts/context/ruby/ctxtools.rb')
-rw-r--r-- | scripts/context/ruby/ctxtools.rb | 214 |
1 files changed, 107 insertions, 107 deletions
diff --git a/scripts/context/ruby/ctxtools.rb b/scripts/context/ruby/ctxtools.rb index 70c9ce243..b5e231e27 100644 --- a/scripts/context/ruby/ctxtools.rb +++ b/scripts/context/ruby/ctxtools.rb @@ -305,112 +305,112 @@ class Commands end -class Commands - - include CommandBase - - public - - def translateinterface - - # since we know what kind of file we're dealing with, - # we do it quick and dirty instead of using rexml or - # xslt - - interfaces = @commandline.arguments - - if interfaces.empty? then - interfaces = ['cs','de','it','nl','ro','fr'] - else - interfaces.delete('en') - end - - interfaces.flatten.each do |interface| - - variables, constants, strings, list, data = Hash.new, Hash.new, Hash.new, '', '' - - keyfile, intfile, outfile = "keys-#{interface}.xml", "cont-en.xml", "cont-#{interface}.xml" - - report("generating #{keyfile}") - - begin - one = "texexec --make --all #{interface}" - two = "texexec --batch --silent --interface=#{interface} x-set-01" - if @commandline.option("force") then - system(one) - system(two) - elsif not system(two) then - system(one) - system(two) - end - rescue - end - - unless File.file?(keyfile) then - report("no #{keyfile} generated") - next - end - - report("loading #{keyfile}") - - begin - list = IO.read(keyfile) - rescue - list = empty - end - - if list.empty? then - report("error in loading #{keyfile}") - next - end - - list.i_load('cd:variable', variables) - list.i_load('cd:constant', constants) - list.i_load('cd:command' , strings) - # list.i_load('cd:element' , strings) - - report("loading #{intfile}") - - begin - data = IO.read(intfile) - rescue - data = empty - end - - if data.empty? then - report("error in loading #{intfile}") - next - end - - report("translating interface en to #{interface}") - - data.i_translate('cd:string' , 'value', strings) - data.i_translate('cd:variable' , 'value', variables) - data.i_translate('cd:parameter', 'name' , constants) - data.i_translate('cd:constant' , 'type' , variables) - data.i_translate('cd:variable' , 'type' , variables) - data.i_translate('cd:inherit' , 'name' , strings) - # data.i_translate('cd:command' , 'name' , strings) - - data.gsub!(/(\<cd\:interface[^\>]*?language=")en(")/) do - $1 + interface + $2 - end - - report("saving #{outfile}") - - begin - if f = File.open(outfile, 'w') then - f.write(data) - f.close - end - rescue - end - - end - - end - -end +# class Commands +# +# include CommandBase +# +# public +# +# def translateinterface +# +# # since we know what kind of file we're dealing with, +# # we do it quick and dirty instead of using rexml or +# # xslt +# +# interfaces = @commandline.arguments +# +# if interfaces.empty? then +# interfaces = ['cs','de','it','nl','ro','fr'] +# else +# interfaces.delete('en') +# end +# +# interfaces.flatten.each do |interface| +# +# variables, constants, strings, list, data = Hash.new, Hash.new, Hash.new, '', '' +# +# keyfile, intfile, outfile = "keys-#{interface}.xml", "cont-en.xml", "cont-#{interface}.xml" +# +# report("generating #{keyfile}") +# +# begin +# one = "texexec --make --all #{interface}" +# two = "texexec --batch --silent --interface=#{interface} x-set-01" +# if @commandline.option("force") then +# system(one) +# system(two) +# elsif not system(two) then +# system(one) +# system(two) +# end +# rescue +# end +# +# unless File.file?(keyfile) then +# report("no #{keyfile} generated") +# next +# end +# +# report("loading #{keyfile}") +# +# begin +# list = IO.read(keyfile) +# rescue +# list = empty +# end +# +# if list.empty? then +# report("error in loading #{keyfile}") +# next +# end +# +# list.i_load('cd:variable', variables) +# list.i_load('cd:constant', constants) +# list.i_load('cd:command' , strings) +# # list.i_load('cd:element' , strings) +# +# report("loading #{intfile}") +# +# begin +# data = IO.read(intfile) +# rescue +# data = empty +# end +# +# if data.empty? then +# report("error in loading #{intfile}") +# next +# end +# +# report("translating interface en to #{interface}") +# +# data.i_translate('cd:string' , 'value', strings) +# data.i_translate('cd:variable' , 'value', variables) +# data.i_translate('cd:parameter', 'name' , constants) +# data.i_translate('cd:constant' , 'type' , variables) +# data.i_translate('cd:variable' , 'type' , variables) +# data.i_translate('cd:inherit' , 'name' , strings) +# # data.i_translate('cd:command' , 'name' , strings) +# +# data.gsub!(/(\<cd\:interface[^\>]*?language=")en(")/) do +# $1 + interface + $2 +# end +# +# report("saving #{outfile}") +# +# begin +# if f = File.open(outfile, 'w') then +# f.write(data) +# f.close +# end +# rescue +# end +# +# end +# +# end +# +# end class Commands @@ -2742,7 +2742,7 @@ commandline.registeraction('jeditinterface' , 'generate jedit syntax files [- commandline.registeraction('bbeditinterface' , 'generate bbedit syntax files [--pipe]') commandline.registeraction('sciteinterface' , 'generate scite syntax files [--pipe]') commandline.registeraction('rawinterface' , 'generate raw syntax files [--pipe]') -commandline.registeraction('translateinterface', 'generate interface files (xml) [nl de ..]') +# commandline.registeraction('translateinterface', 'generate interface files (xml) [nl de ..]') commandline.registeraction('purgefiles' , 'remove temporary files [--all --recurse] [basename]') commandline.registeraction('documentation' , 'generate documentation [--type=] [filename]') commandline.registeraction('filterpages' ) # no help, hidden temporary feature |