diff options
-rw-r--r-- | conf/sisu/v3/sisurc.yml | 2 | ||||
-rw-r--r-- | data/doc/sisu/CHANGELOG_v3 | 3 | ||||
-rw-r--r-- | lib/sisu/v3/options.rb | 18 | ||||
-rw-r--r-- | lib/sisu/v3/sysenv.rb | 33 |
4 files changed, 31 insertions, 25 deletions
diff --git a/conf/sisu/v3/sisurc.yml b/conf/sisu/v3/sisurc.yml index f5473c79..9d69f0c2 100644 --- a/conf/sisu/v3/sisurc.yml +++ b/conf/sisu/v3/sisurc.yml @@ -59,13 +59,13 @@ flag: #% papersize, (LaTeX/pdf) available values: A4, US_letter, book_b5, book_a5, US_legal default: papersize: 'A4,letter' + #language: 'en' #texpdf_font: 'Liberation Serif' # 'Liberation Sans' 'Liberation Serif' #text_wrap: 78 #emphasis: 'bold' #make *{emphasis}* 'bold', 'italics' or 'underscore', default if not configured is 'bold' #digest: 'sha' #sha is sha256, default is md5 #multilingual: false #language_file: 2 - #language: 'English' #% markup, make *{emphasis}* 'bold' or 'italics', default if not configured is 'bold' #% settings used by ssh scp diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3 index fd01812a..9d00f986 100644 --- a/data/doc/sisu/CHANGELOG_v3 +++ b/data/doc/sisu/CHANGELOG_v3 @@ -22,6 +22,9 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.15.orig.tar.gz * options, default action on running "sisu3 [filename.sst]", fix + * sysenv, options, sisurc.yml base directory language setting, to be used + e.g. by po for setting original language, (instead of assuming English) + * objects.txt, removed, cleaning %% 3.0.14.orig.tar.gz (2011-07-26:30/2) diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb index 6626870f..5b179a57 100644 --- a/lib/sisu/v3/options.rb +++ b/lib/sisu/v3/options.rb @@ -62,11 +62,12 @@ module SiSU_commandline require_relative 'sysenv' # sysenv.rb @@base_path=nil class Options - attr_accessor :cmd,:mod,:act,:dir_structure_by,:f_pths,:files,:base_path,:base_stub,:paths,:lngs,:f_pth,:pth,:fns,:fnb,:fnc,:fncb,:lng,:what + attr_accessor :cmd,:mod,:act,:dir_structure_by,:f_pths,:files,:base_path,:base_stub,:paths,:lngs,:f_pth,:pth,:fns,:fnb,:fnc,:fncb,:lng,:lng_base,:what def initialize(a) - @cmd,@f_pth,@pth,@fns,@fnb,@fnc,@fncb,@what,@lng,@base_path,@base_stub='','','','','','','','','','','','' + @cmd,@f_pth,@pth,@fns,@fnb,@fnc,@fncb,@what,@lng,@lng_base,@base_path,@base_stub='','','','','','','','','','','','','' @f_pths,@files,@paths,@mod,@act=Array.new(5){[]} @env=SiSU_Env::Info_env.new + @lng_base=@env.language_default_set @dir_structure_by=SiSU_Env::Env_call.new.output_dir_structure.by? @@base_path ||=Dir.pwd @base_path=@@base_path @@ -134,7 +135,7 @@ module SiSU_commandline end end r=Px[:lng_lst].join('|') - r.gsub!(/\|en\|/,'|') + r.gsub!(/\|#{@lng_base}\|/,'|') @lang_regx=%r{(?:#{r})} z=if find_flag if f.length > 0 @@ -144,7 +145,7 @@ module SiSU_commandline end elsif a.inspect =~/"(?:-\S+?|--\S+?)"/ \ && a.inspect =~/"#{@lang_regx}\/?"/ \ - && a.inspect =~/"en\/\S+?\.ss[tm]"/ + && a.inspect =~/"#{@lng_base}\/\S+?\.ss[tm]"/ init_selected_lang_dirs(a) else b end @@ -154,7 +155,7 @@ module SiSU_commandline def init_selected_lang_dirs(a) @z=[] a.each do |y| - if y =~/^en\/(\S+?\.ss[tm])$/ + if y =~/^#{@lng_base}\/(\S+?\.ss[tm])$/ @fn=$1 @z << y elsif y =~/^#{@lang_regx}\/?$/ @@ -219,13 +220,13 @@ module SiSU_commandline l_p elsif x =~/~(#{r})\.ss[tm]/ $1 - else 'en' + else lng_base end lng_is =if l_p l_p elsif x =~/~(#{r})\.ss[tm]/ $1 - else 'en' + else lng_base end f_pths << { pth: pt.split[0].realpath.to_s, @@ -588,6 +589,9 @@ module SiSU_commandline def lng @lng end + def lng_base + @lng_base + end def fns @fns end diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb index 30ff2e9b..c265b010 100644 --- a/lib/sisu/v3/sysenv.rb +++ b/lib/sisu/v3/sysenv.rb @@ -154,8 +154,8 @@ module SiSU_Env PROCESSING_ENCODING=:processing_encoding PROCESSING_GIT=:processing_git PAPERSIZE=:papersize - LANGUAGE=:language - LANGUAGE_CODE=:language_code + #LANGUAGE=:language + #LANGUAGE_CODE=:language_code MULTILINGUAL=:multilingual BUNDLE=:bundle CONCORD_MAX=:concord_max @@ -198,8 +198,8 @@ module SiSU_Env PROCESSING_GIT => processing_git, #TEXINFO_STUB => 'texinfo', PAPERSIZE => 'A4', #A4, US_letter, book_b5, book_a5, US_legal - LANGUAGE => 'English', - LANGUAGE_CODE => 'en', #change, unecessary duplication though currently used + #LANGUAGE => 'English', + #LANGUAGE_CODE => 'en', #change, unecessary duplication though currently used MULTILINGUAL => false, BUNDLE => false, CONCORD_MAX => 260000, @@ -823,10 +823,9 @@ module SiSU_Env class Standardise_language require_relative 'i18n' # i18n.rb def initialize(l='') - @language=l - if @language.empty? - @language=Info_env.new.defaults[:language] - end + @language=(l.nil? || l.empty?) \ + ? Info_env.new.language_default_set + : l @r=%{(?:#{Px[:lng_lst].join('|')})} @lang_info=SiSU_i18n::Languages.new end @@ -907,19 +906,12 @@ module SiSU_Env lng end def name - #lang(@language)[:n].downcase - #lang[@language][:n].downcase - #language[:n].downcase language[:n].downcase end def title - #lang(@language)[:n] - #lang[@language][:n] language[:n] end def code - #lang[@language][:c] - #lang(@language)[:c] language[:c] end def tex_name @@ -986,12 +978,13 @@ module SiSU_Env @stub_md= @stub_pwd + '/sisu_site_metadata' pt=Pathname.new(Dir.pwd) stub=if output_dir_structure.by_language_code? - stub=if Dir.pwd =~/.+?\/([^\/]+)(?:\/(en|fr|es)$)/ + r=Px[:lng_lst].join('|') + stub=if Dir.pwd =~/.+?\/([^\/]+)(?:\/(#{r})$)/ lng=pt.split[-1].to_s lng_part='/' + lng base=pt.split[0].split[-1].to_s else - lng_part='/' + 'en' #fix default language + lng_part='/' + language_default_set base=pt.split[-1].to_s end base + lng_part @@ -1026,6 +1019,12 @@ module SiSU_Env ? @rc['processing']['concord_max'] \ : (defaults[:concord_max]) end + def language_default_set #set directory (default) language + ((defined? @rc['default']['language']) \ + && @rc['default']['language'] =~/\S+/) \ + ? @rc['default']['language'] \ + : 'en' + end def markup_emphasis if defined? @rc['default']['emphasis'] \ and @rc['default']['emphasis'] \ |