aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v5/options.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/sisu/v5/options.rb')
-rw-r--r--lib/sisu/v5/options.rb26
1 files changed, 22 insertions, 4 deletions
diff --git a/lib/sisu/v5/options.rb b/lib/sisu/v5/options.rb
index b7bf98a6..031258af 100644
--- a/lib/sisu/v5/options.rb
+++ b/lib/sisu/v5/options.rb
@@ -137,7 +137,7 @@ module SiSU_Commandline
end
end
class Options
- attr_accessor :cmd,:mod,:act,:dir_structure_by,:f_pths,:files,:files_mod,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod
+ attr_accessor :cmd,:mod,:act,:dir_structure_by,:lingual,:f_pths,:files,:files_mod,:base_path,:base_stub,:sub_location,:paths,:lngs,:f_pth,:pth,:fno,:fns,:fnb,:fnc,:fng,:fncb,:lng,:lng_base,:what,:make_instructions,:make_instructions_pod
@@act=nil
def initialize(a)
@cmd,@f_pth,@pth,@fno,@fns,@fnb,@fnc,@fng,@fncb,@what,@lng,@lng_base,@base_path,@base_stub,@sub_location='','','','','','','','','','','','','',''
@@ -145,6 +145,7 @@ module SiSU_Commandline
@env=SiSU_Env::InfoEnv.new
@lng_base=@env.language_default_set
@dir_structure_by=SiSU_Env::EnvCall.new.output_dir_structure.by?
+ @lingual=SiSU_Env::EnvCall.new.mono_multi_lingual?
@@sisu_call_origin_path ||=Dir.pwd
@base_path=@@sisu_call_origin_path
r=Px[:lng_lst_rgx]
@@ -217,7 +218,7 @@ module SiSU_Commandline
end
end
end
- r=Px[:lng_lst_rgx].gsub(/\|#{@lng_base}\|/,'|')
+ r=Px[:lng_lst_rgx].gsub(/\|#{lng_base}\|/,'|')
@lang_regx=%r{(?:#{r})}
if find_flag
(f.length > 0) \
@@ -225,7 +226,7 @@ module SiSU_Commandline
: find_all(find_flag,b)
elsif a.inspect =~/"(?:-\S+?|--\S+?)"/ \
&& a.inspect =~/"#{@lang_regx}\/?"/ \
- && a.inspect =~/"#{@lng_base}\/\S+?\.ss[tm]"/
+ && a.inspect =~/"#{lng_base}\/\S+?\.ss[tm]"/
init_selected_lang_dirs(a)
else b
end
@@ -235,7 +236,7 @@ module SiSU_Commandline
def init_selected_lang_dirs(a)
@z=[]
a.each do |y|
- if y =~/^#{@lng_base}\/(\S+?\.ss[tm])$/
+ if y =~/^#{lng_base}\/(\S+?\.ss[tm])$/
@fn=$1
@z << y
elsif y =~/^#{@lang_regx}\/?$/
@@ -670,11 +671,28 @@ module SiSU_Commandline
{ bool: false, set: :off, off: off_list}
else { bool: true, set: :na, off: [] }
end
+ act[:default_language]=if mod.inspect =~/"--(?:default-)?language[-=](\S{2})"/
+ { set: :on, code: $1 }
+ elsif lng_base
+ { set: :on, code: lng_base }
+ else { set: :na, code: 'en' }
+ end
+ act[:i18n]=if mod.inspect =~/"(?:--monolingual|--i18n-mono(?:lingual)?)"/ #if monolingual possible outputs output_by :filename & :filetype only, without language code in default language name; give warning of conflict settings if monolingual & :language selected
+ @lingual=:mono
+ { set: :mono }
+ elsif mod.inspect =~/"(?:--multilingual|--i18n-multi(?:lingual)?)"/
+ @lingual=:multi
+ { set: :multi }
+ else { set: :na }
+ end
act[:output_by]=if mod.inspect =~/"--(?:output-)?by-language"/
+ @dir_structure_by=:language
{ set: :language }
elsif mod.inspect =~/"--(?:output-)?by-filename"/
+ @dir_structure_by=:filename
{ set: :filename }
elsif mod.inspect =~/"--(?:output-)?by-filetype"/
+ @dir_structure_by=:filetype
{ set: :filetype }
else { set: :na }
end