aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/v3/sysenv.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2011-08-08 23:54:45 -0400
committerRalph Amissah <ralph@amissah.com>2011-08-08 23:54:53 -0400
commiteb474533a94f2c10d74d771c2b782e101ee11e4c (patch)
treecba165bed2f2816c5cb0464a7c0309ad64d84a07 /lib/sisu/v3/sysenv.rb
parentv3: options, default action on running "sisu3 [filename.sst]", fix (diff)
v3: options, sysenv, sisurc.yml, set/config default language (code)
* in absence of setting 'en' assumed * 'en' previously fixed
Diffstat (limited to 'lib/sisu/v3/sysenv.rb')
-rw-r--r--lib/sisu/v3/sysenv.rb33
1 files changed, 16 insertions, 17 deletions
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'] \