aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--data/doc/sisu/CHANGELOG_v38
-rw-r--r--lib/sisu/v3/dal_doc_str.rb2
-rw-r--r--lib/sisu/v3/dal_metadata.rb2
-rw-r--r--lib/sisu/v3/db_columns.rb7
-rw-r--r--lib/sisu/v3/db_import.rb3
-rw-r--r--lib/sisu/v3/db_indexes.rb1
-rw-r--r--lib/sisu/v3/db_remove.rb4
-rw-r--r--lib/sisu/v3/db_select.rb10
-rw-r--r--lib/sisu/v3/digests.rb2
-rw-r--r--lib/sisu/v3/git.rb2
-rw-r--r--lib/sisu/v3/hub.rb1
-rw-r--r--lib/sisu/v3/manifest.rb4
-rw-r--r--lib/sisu/v3/options.rb23
-rw-r--r--lib/sisu/v3/param.rb23
-rw-r--r--lib/sisu/v3/shared_metadata.rb4
-rw-r--r--lib/sisu/v3/sitemaps.rb2
-rw-r--r--lib/sisu/v3/sst_do_inline_footnotes.rb2
-rw-r--r--lib/sisu/v3/sysenv.rb141
-rw-r--r--lib/sisu/v3/urls.rb3
19 files changed, 147 insertions, 97 deletions
diff --git a/data/doc/sisu/CHANGELOG_v3 b/data/doc/sisu/CHANGELOG_v3
index 36c0c28e..91f8b5c6 100644
--- a/data/doc/sisu/CHANGELOG_v3
+++ b/data/doc/sisu/CHANGELOG_v3
@@ -35,6 +35,10 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.8.orig.tar.gz
* *-cterm-ruby & *-cterm-sisu colors adjusted where other color groupings are
preferred for programming / sisu markup
+ * options, language setting, based on directory structure or filename
+ * sysenv, language setting from options
+ * affects multiple libraries
+
* sysenv, lowriter (instead of libreoffice)
* manpage, reinstate escape of hyphens (clearly preferred, else lintian
@@ -66,10 +70,10 @@ http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.8.orig.tar.gz
and develop for that
or some meaningful combination of any of the above.
- * vim colors colorscheme sparse-* frugal-* Slate minor changes
-
* concordance, output path, screen info correction
+ * vim colors colorscheme sparse-* frugal-* Slate minor changes
+
%% 3.0.7.orig.tar.gz (2011-04-20:16/3)
http://git.sisudoc.org/?p=code/sisu.git;a=log;h=refs/tags/debian/3.0.7-1
http://www.jus.uio.no/sisu/pkg/src/sisu_3.0.7.orig.tar.gz
diff --git a/lib/sisu/v3/dal_doc_str.rb b/lib/sisu/v3/dal_doc_str.rb
index 61348d28..063ddd82 100644
--- a/lib/sisu/v3/dal_doc_str.rb
+++ b/lib/sisu/v3/dal_doc_str.rb
@@ -482,7 +482,7 @@ module SiSU_document_structure_extract
meta=[]
dir=SiSU_Env::Info_env.new(@md.fns)
base_html="#{dir.url.root}/#{@md.fnb}"
- l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns)
+ l=SiSU_Env::Standardise_language.new(@md.opt.lng).language
language=l[:l]
tr=SiSU_Translate::Source.new(@md,language)
meta << @pb
diff --git a/lib/sisu/v3/dal_metadata.rb b/lib/sisu/v3/dal_metadata.rb
index 31a7e4b2..56ef662c 100644
--- a/lib/sisu/v3/dal_metadata.rb
+++ b/lib/sisu/v3/dal_metadata.rb
@@ -60,7 +60,7 @@ module SiSU_metadata
class Metadata
def initialize(md,metad)
@md,@metadata=md,metad
- l=SiSU_Env::Standardise_language.new.file_to_language(md.fns)
+ l=SiSU_Env::Standardise_language.new(@md.opt.lng).language
language=l[:l]
@tr=SiSU_Translate::Source.new(md,language)
end
diff --git a/lib/sisu/v3/db_columns.rb b/lib/sisu/v3/db_columns.rb
index 8b669b12..8b8a0b3c 100644
--- a/lib/sisu/v3/db_columns.rb
+++ b/lib/sisu/v3/db_columns.rb
@@ -621,9 +621,10 @@ module SiSU_DB_columns
IS 'metadata document language';}
end
def tuple
- t=if defined? @md.language.document_char \
- and @md.language.document_char=~/\S+/
- txt=@md.language.document_char
+ #modify check, is now required, SiSUv3d_
+ t=if defined? @md.opt.lng \
+ and @md.opt.lng=~/\S+/
+ txt=@md.opt.lng
special_character_escape(txt)
["#{name}, ","'#{txt}', "]
else ['','']
diff --git a/lib/sisu/v3/db_import.rb b/lib/sisu/v3/db_import.rb
index f1e7f064..45bb37f3 100644
--- a/lib/sisu/v3/db_import.rb
+++ b/lib/sisu/v3/db_import.rb
@@ -120,7 +120,8 @@ module SiSU_DB_import
@dal_array=SiSU_DAL::Source.new(@opt).get # dal file drawn here
SiSU_Screen::Ansi.new(@opt.cmd,"#{@db.psql.db}::#{@opt.fns}").puts_blue if @opt.cmd =~/vVM/
SiSU_Screen::Ansi.new(@opt.cmd,'Marshal Load',@fnc).puts_grey if @opt.cmd =~/v/
- select_first_match=%{ SELECT metadata_and_text.tid FROM metadata_and_text WHERE metadata_and_text.src_filename = '#{@opt.fns}'; }
+#%
+ select_first_match=%{ SELECT metadata_and_text.tid FROM metadata_and_text WHERE metadata_and_text.src_filename = '#{@opt.fns}' AND metadata_and_text.language_document_char = '#{@opt.lng}'; }
file_exist=@sql_type=~/sqlite/ \
? @conn.get_first_value(select_first_match) \
: @conn.select_one(select_first_match)
diff --git a/lib/sisu/v3/db_indexes.rb b/lib/sisu/v3/db_indexes.rb
index de20e4c4..64a51474 100644
--- a/lib/sisu/v3/db_indexes.rb
+++ b/lib/sisu/v3/db_indexes.rb
@@ -93,6 +93,7 @@ module SiSU_DB_index
%{CREATE INDEX idx_title ON metadata_and_text(title);},
%{CREATE INDEX idx_author ON metadata_and_text(creator_author);},
%{CREATE INDEX idx_filename ON metadata_and_text(src_filename);},
+ %{CREATE INDEX idx_language ON metadata_and_text(language_document_char);},
%{CREATE INDEX idx_topics ON metadata_and_text(classify_topic_register)},
]
conn_execute_array(sql_arr)
diff --git a/lib/sisu/v3/db_remove.rb b/lib/sisu/v3/db_remove.rb
index 025514b1..7644ad52 100644
--- a/lib/sisu/v3/db_remove.rb
+++ b/lib/sisu/v3/db_remove.rb
@@ -72,9 +72,9 @@ module SiSU_DB_remove
: false
end
del_id=if driver_sqlite3
- @conn.get_first_value(%{ SELECT tid FROM metadata_and_text WHERE src_filename = '#{@opt.fns}'; }).to_i
+ @conn.get_first_value(%{ SELECT tid FROM metadata_and_text WHERE src_filename = '#{@opt.fns}' AND metadata_and_text.language_document_char = '#{@opt.lng}'; }).to_i
else
- x=@conn.select_one(%{ SELECT metadata_and_text.tid FROM metadata_and_text WHERE metadata_and_text.src_filename = '#{@opt.fns}'; })
+ x=@conn.select_one(%{ SELECT metadata_and_text.tid FROM metadata_and_text WHERE metadata_and_text.src_filename = '#{@opt.fns}' AND metadata_and_text.language_document_char = '#{@opt.lng}'; })
x ? (x.join.to_i) : nil
end
if del_id
diff --git a/lib/sisu/v3/db_select.rb b/lib/sisu/v3/db_select.rb
index 9bf8acbc..0cd34bcd 100644
--- a/lib/sisu/v3/db_select.rb
+++ b/lib/sisu/v3/db_select.rb
@@ -164,7 +164,7 @@ module SiSU_DB_select
db_exist?
@sdb_import.marshal_load
tell=case @sql_type
- when /sqlite/; SiSU_Screen::Ansi.new(@opt.cmd,"sqlite #{@db.sqlite.db} database?")
+ when /sqlite/; SiSU_Screen::Ansi.new(@opt.cmd,"sqlite3 #{@db.sqlite.db} database?")
when /pg/; SiSU_Screen::Ansi.new(@opt.cmd,"pgaccess or psql #{@db.psql.db} database?")
else '???'
end
@@ -173,7 +173,13 @@ module SiSU_DB_select
db_exist?
@sdb_remove_doc.remove
@sdb_import.marshal_load
- SiSU_Screen::Ansi.new(@opt.cmd,"pgaccess or psql #{@db.psql.db} database?").puts_grey if @opt.cmd =~/v/
+ tell=case @sql_type
+ when /sqlite/; SiSU_Screen::Ansi.new(@opt.cmd,"sqlite3 #{@db.sqlite.db} database?")
+ when /pg/; SiSU_Screen::Ansi.new(@opt.cmd,"pgaccess or psql #{@db.psql.db} database?")
+ else '???'
+ end
+ tell.puts_grey if @opt.cmd =~/v/
+ when /^--update$/
when /^--remove$/
db_exist?
@sdb_remove_doc.remove
diff --git a/lib/sisu/v3/digests.rb b/lib/sisu/v3/digests.rb
index e11ac945..0e6852b2 100644
--- a/lib/sisu/v3/digests.rb
+++ b/lib/sisu/v3/digests.rb
@@ -101,7 +101,7 @@ module SiSU_Digest_view
@@dg ||=@env.digest.type
@@dl ||=@env.digest.length
@dg,@dl=@@dg,@@dl
- l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns)
+ l=SiSU_Env::Standardise_language.new(@md.opt.lng).language
@language=l[:l]
@tr=SiSU_Translate::Source.new(@md,@language)
@sp=' '
diff --git a/lib/sisu/v3/git.rb b/lib/sisu/v3/git.rb
index 9d1d9332..bef93bc3 100644
--- a/lib/sisu/v3/git.rb
+++ b/lib/sisu/v3/git.rb
@@ -67,7 +67,7 @@ module SiSU_Git
@env=SiSU_Env::Info_env.new
@md=SiSU_Param::Parameters.new(@opt).get
@file=SiSU_Env::SiSU_file.new(@md)
- l=SiSU_Env::Standardise_language.new.file_to_language(@opt.fns)
+ l=SiSU_Env::Standardise_language.new(@md.opt.lng).language
unless @md.i18n[0]==l[:c]
p "using: #{@md.i18n[0]} (@make: :language:); filename #{@md.fns} filename language: #{l[:c]}, mismatch"
end
diff --git a/lib/sisu/v3/hub.rb b/lib/sisu/v3/hub.rb
index e20b4293..ed3aad1d 100644
--- a/lib/sisu/v3/hub.rb
+++ b/lib/sisu/v3/hub.rb
@@ -105,6 +105,7 @@ module SiSU
@opt.fns=fns
@opt.pth=@opt.paths[i]
@opt.f_pth=@opt.f_pths[i]
+ @opt.lng=@opt.lngs[i]
@@pwd=@opt.pth
Dir.chdir(@opt.pth) #watch
env=SiSU_Env::Info_env.new(fns)
diff --git a/lib/sisu/v3/manifest.rb b/lib/sisu/v3/manifest.rb
index 38dc994c..98ccddb4 100644
--- a/lib/sisu/v3/manifest.rb
+++ b/lib/sisu/v3/manifest.rb
@@ -72,7 +72,7 @@ module SiSU_Manifest
def initialize(opt)
@opt=opt
@particulars=SiSU_Particulars::Combined_singleton.instance.get_all(opt)
- l=SiSU_Env::Standardise_language.new.file_to_language(@opt.fns)
+ l=SiSU_Env::Standardise_language.new(@opt.lng).language
@doc_language=l[:l]
end
def read
@@ -108,7 +108,7 @@ module SiSU_Manifest
@base_path=@md.file.output_path.manifest
@@dg ||=SiSU_Env::Info_env.new.digest.type
@dg=@@dg
- l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns)
+ l=SiSU_Env::Standardise_language.new(@md.opt.lng).language
@language=l[:l]
@translate=SiSU_Translate::Source.new(@md,@language)
@brace_url=SiSU_Viz::Skin.new.url_decoration
diff --git a/lib/sisu/v3/options.rb b/lib/sisu/v3/options.rb
index a1a448e6..110ebd85 100644
--- a/lib/sisu/v3/options.rb
+++ b/lib/sisu/v3/options.rb
@@ -61,10 +61,10 @@ module SiSU_commandline
require "pathname"
require_relative 'sysenv' # sysenv.rb
class Options
- attr_accessor :cmd,:mod,:act,:f_pths,:files,:paths,:f_pth,:pth,:fns,:fnb,:fnc,:fncb,:lng,:what
+ attr_accessor :cmd,:mod,:act,:f_pths,:files,:paths,:lngs,:f_pth,:pth,:fns,:fnb,:fnc,:fncb,:lng,:what
def initialize(a)
@a=a
- @cmd,@f_pth,@pth,@fns,@fnb,@fnc,@fncb,@what='','','','','','','','',''
+ @cmd,@f_pth,@pth,@fns,@fnb,@fnc,@fncb,@what,@lng='','','','','','','','','',''
@f_pths,@files,@paths,@mod,@act=Array.new(5){[]}
@env=SiSU_Env::Info_env.new
r=Px[:lng_lst].join('|')
@@ -109,6 +109,7 @@ module SiSU_commandline
@paths = q[:paths]
@files = q[:files]
@f_pths = q[:f_pths]
+ @lngs = q[:lngs]
if @files.length > 0 \
and @cmd.empty? \
and @mod.length==0 #% if no other action called on filename given, default is sisu -0 [filename(s)] configured as flag default
@@ -122,7 +123,7 @@ module SiSU_commandline
end
def set_files_and_paths_and_general_extract(s)
c,w='',''
- m,f,pth,z,lng=[],[],[],[],[]
+ m,f,pth,z,lng,lngs=[],[],[],[],[],[]
a=s.split(/\s+/)
a.each do |x|
if x =~/^-[a-z0-5]+/i \
@@ -138,12 +139,20 @@ module SiSU_commandline
pt=Pathname.new(x)
pth << pt.split[0].realpath.to_s #remove?
f << pt.split[1].to_s #remove?
- u=/.+?\/([^\/]+)(?:(?:\/(?:en|fr|es)$)|$)/
- t=/.+\/(en|fr|es)/
- lng << (pt.split[0].realpath.to_s[t,1]) \
+ r=Px[:lng_lst].join('|')
+ u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/
+ t=/.+\/(#{r})$/
+ l_p = (pt.split[0].realpath.to_s[t,1]) \
? pt.split[0].realpath.to_s[t,1] \
: nil
#: ''
+ lng << l_p
+ lngs << if l_p
+ l_p
+ elsif x =~/~(#{r})\.ss[tm]/
+ $1
+ else 'en'
+ end
f_pths << {
pth: pt.split[0].realpath.to_s,
f: pt.split[1].to_s,
@@ -163,7 +172,7 @@ module SiSU_commandline
puts "#{x} in #{a.join(' ')}?"
end
end
- { cmd: c, mod: m, what: w, paths: pth, files: f, f_pths: f_pths, lng: lng }
+ { cmd: c, mod: m, what: w, paths: pth, files: f, f_pths: f_pths, lng: lng, lngs: lngs }
end
def expand_numeric_shortcuts(a)
shortcut=SiSU_Env::Info_processing_flag.new
diff --git a/lib/sisu/v3/param.rb b/lib/sisu/v3/param.rb
index 8aa543db..357bc725 100644
--- a/lib/sisu/v3/param.rb
+++ b/lib/sisu/v3/param.rb
@@ -272,7 +272,7 @@ module SiSU_Param
l,n=Db[:col_language],'title.language'
validate_length(s,l,n)
end
- def language_char
+ def language_char # look into, this must be set, from 1 directory stub (.fi), 2 filename (~fi), [3 (not used) document header (@title:\n :language_char: fi)]
s=@h['language_char']
l,n=Db[:col_language_char],'title.language_char'
validate_length(s,l,n)
@@ -1232,7 +1232,7 @@ module SiSU_Param
end
end
@publisher ||= "#@@publisher (this copy)"
- fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(@fns)
+ fn_set_lang=SiSU_Env::Standardise_language.new(@opt.lng).language
unless @language[:code] \
and @language[:name]
lang=@env.i18n.language #default language settings for directory by name, or in sysrc.yml
@@ -1244,15 +1244,16 @@ module SiSU_Param
@language[:name]=fn_set_lang[:l]
end
@fnl=@env.i18n.lang_filename(fn_set_lang[:c])
- @flv.each do |l|
- lang=SiSU_Env::Standardise_language.new.file_to_language(l)
- c={ a: '', b: '', c: '' }
- if @fnl[:pre] =~/\S/; c[:a]="#{lang[:c]}."
- elsif @fnl[:mid] =~/\S/; c[:b]=".#{lang[:c]}"
- elsif @fnl[:post] =~/\S/; c[:c]=".#{lang[:c]}"
- end
- @lang << [lang[:l],"#{c[:a]}sisu_manifest#{c[:b]}.html#{c[:c]}"]
- end if @flv
+#fix
+# @flv.each do |l|
+# lang=SiSU_Env::Standardise_language.new.file_to_language(l)
+# c={ a: '', b: '', c: '' }
+# if @fnl[:pre] =~/\S/; c[:a]="#{lang[:c]}."
+# elsif @fnl[:mid] =~/\S/; c[:b]=".#{lang[:c]}"
+# elsif @fnl[:post] =~/\S/; c[:c]=".#{lang[:c]}"
+# end
+# @lang << [lang[:l],"#{c[:a]}sisu_manifest#{c[:b]}.html#{c[:c]}"]
+# end if @flv
@lang.uniq!
@fn=SiSU_Env::Env_call.new(@fns).lang(fn_set_lang[:c])
@identifier="#{@env.url.root}/#{@fnb}/#{@fn[:toc]}" #DC note constructed dc identifier
diff --git a/lib/sisu/v3/shared_metadata.rb b/lib/sisu/v3/shared_metadata.rb
index 167af5c4..25ca19f1 100644
--- a/lib/sisu/v3/shared_metadata.rb
+++ b/lib/sisu/v3/shared_metadata.rb
@@ -67,7 +67,7 @@ module Metadata
meta,tag=[],[]
dir=SiSU_Env::Info_env.new(@md.fns)
base_html="#{dir.url.root}/#{@md.fnb}"
- l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns)
+ l=SiSU_Env::Standardise_language.new(@md.opt.lng).language
language=l[:l]
tr=SiSU_Translate::Source.new(@md,language)
@attrib='md'
@@ -997,7 +997,7 @@ WOK
meta=[]
dir=SiSU_Env::Info_env.new(@md.fns)
base_html="#{dir.url.root}/#{@md.fnb}"
- l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns)
+ l=SiSU_Env::Standardise_language.new(@md.opt.lng).language
language=l[:l]
tr=SiSU_Translate::Source.new(@md,language)
tag="Document Manifest @"
diff --git a/lib/sisu/v3/sitemaps.rb b/lib/sisu/v3/sitemaps.rb
index 2241b5e6..c306ee99 100644
--- a/lib/sisu/v3/sitemaps.rb
+++ b/lib/sisu/v3/sitemaps.rb
@@ -75,7 +75,7 @@ module SiSU_Sitemaps
def songsheet
begin
@sys=SiSU_Env::System_call.new
- fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(@opt.fns)
+ fn_set_lang=SiSU_Env::Standardise_language.new(@opt.lng).language
@fn=SiSU_Env::Env_call.new(@opt.fns).lang(fn_set_lang[:c])
if @opt.cmd =~/Y/
@md=SiSU_Param::Parameters.new(@opt).get
diff --git a/lib/sisu/v3/sst_do_inline_footnotes.rb b/lib/sisu/v3/sst_do_inline_footnotes.rb
index 27ccf6db..3936d612 100644
--- a/lib/sisu/v3/sst_do_inline_footnotes.rb
+++ b/lib/sisu/v3/sst_do_inline_footnotes.rb
@@ -170,7 +170,7 @@ module SiSU_Convert_footnotes
@@word_mode=[]
@env=SiSU_Env::Info_env.new(@md.fns)
@skin=SiSU_Env::Info_skin.new(@md)
- l=SiSU_Env::Standardise_language.new.file_to_language(@md.fns)
+ l=SiSU_Env::Standardise_language.new(@md.opt.lng).language
@language=l[:l]
@translate=SiSU_Translate::Source.new(@md,@language)
end
diff --git a/lib/sisu/v3/sysenv.rb b/lib/sisu/v3/sysenv.rb
index 1b621c61..ac584e80 100644
--- a/lib/sisu/v3/sysenv.rb
+++ b/lib/sisu/v3/sysenv.rb
@@ -444,7 +444,7 @@ module SiSU_Env
end
self
end
- def document_language_versions_found
+ def document_language_versions_found #REVISIT
@fn={}
unless (@fns.nil? \
or @fns.empty?)
@@ -499,12 +499,12 @@ module SiSU_Env
fns_c="#{@fn[:m]}~#{lng.code}.#{@fn[:t]}"
fns_l="#{@fn[:m]}~#{lng.name}.#{@fn[:t]}"
if FileTest.file?(fns_c)
- fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(fns_c)
+ fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(fns_c) #reconsider file_to_language
lng=fn_set_lang[:l]
fn=SiSU_Env::Env_call.new(fns_c).lang(fn_set_lang[:c])
@m << { m: fn[:manifest], l: lng }
elsif FileTest.file?(fns_l)
- fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(fns_l)
+ fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(fns_l) #reconsider file_to_language
@fnl=dir.i18n.lang_filename(fn_set_lang[:c])
fn=SiSU_Env::Env_call.new(fns_l).lang(fn_set_lang[:c])
@m << { m: fn[:manifest], l: lng }
@@ -796,48 +796,67 @@ module SiSU_Env
@language=Info_env.new.defaults[:language]
end
end
- def language #use ISO_639-2
+ def language
lang={}
case @language
- when /American|^us$/i; d,c,l=false,'en','American English' #depreciated, see iso 639-2
- when /English|^en$/i; d,c,l=false,'en','English'
- when /French|Francais|^fr$/i; d,c,l=false,'fr','French'
- when /German|^de$/i; d,c,l=false,'de','German'
- when /Italian|^it$/i; d,c,l=false,'it','Italian'
- when /Spanish|Espanol|^es$/i; d,c,l=false,'es','Spanish'
- when /Brazilian(?: Portuguese)?|^br$/i; d,c,l=false,'pt','Brazilian Portuguese' #depreciated, see iso 639-2
- when /Portuguese|^pt$/i; d,c,l=false,'pt','Portuguese'
- when /Swedish|Svensk|^sv$/i; d,c,l=false,'sv','Swedish'
- when /Danish|Dansk|^da$/i; d,c,l=false,'da','Danish'
- when /Finnish|Finsk|Suomi|^fi$/i; d,c,l=false,'fi','Finnish'
- when /Norwegian|Norsk|^no$/i; d,c,l=false,'no','Norwegian'
- when /Icelandic|^is$/i; d,c,l=false,'is','Icelandic'
- when /Dutch|^nl$/i; d,c,l=false,'nl','Dutch'
- when /Estonian|^et$/i; d,c,l=false,'et','Estonian'
- when /Hungarian|^hu$/i; d,c,l=false,'hu','Hungarian'
- when /Polish|^pl$/i; d,c,l=false,'pl','Polish'
- when /Romanian|^ro$/i; d,c,l=false,'ro','Romanian'
- when /Russian|^ru$/i; d,c,l=false,'ru','Russian'
- when /Greek|^el$/i; d,c,l=false,'el','Greek'
- when /Ukranian|^uk$/i; d,c,l=false,'uk','Ukranian'
- when /Turkish|^tr$/i; d,c,l=false,'tr','Turkish'
- #when /Serbian/i; d,c,l=false,'', 'Serbian'
- #when /Welsh/i; d,c,l=false,'', 'Welsh'
- #when /Basque/i; d,c,l=false,'', 'Basque'
- #when /Breton/i; d,c,l=false,'', 'Breton'
- #when /Catalan/i; d,c,l=false,'', 'Catalan'
- #when /Galician/i; d,c,l=false,'', 'Galician'
- #when /Saa?mi/i; d,c,l=false,'', 'Saami'
- #when /Hebrew/i; d,c,l=false,'', 'Hebrew'
- #when /Latin/i; d,c,l=false,'', 'Latin'
- #when /Esperanto/i; d,c,l=false,'', 'Esperanto'
- when /Slovenian|^sl$/i; d,c,l=false,'sl','Slovenian'
- when /Croatian|^hr$/i; d,c,l=false,'hr','Croatian'
- when /Slovak(?:ian)?|^sk$/i; d,c,l=false,'sk','Slovakian'
- when /Czech|^cs$/i; d,c,l=false,'cs','Czech'
- when /Bulgarian|^bg$/i; d,c,l=false,'bg','Bulgarian'
- else d,c,l=true,'en','English (default)'
- #else d,c,l=true,'xx','Default'
+ when /^am$|Amharic/i; d,c,l=false,'am','Amharic'
+ when /^bg$|Bulgarian/i; d,c,l=false,'bg','Bulgarian'
+ when /^br$|Breton/i; d,c,l=false,'br','Breton'
+ when /^ca$|Catalan/i; d,c,l=false,'ca','Catalan'
+ when /^cs$|Czech/i; d,c,l=false,'cs','Czech'
+ when /^cy$|Welsh/i; d,c,l=false,'cy','Welsh'
+ when /^da$|Danish|Dansk/i; d,c,l=false,'da','Danish'
+ when /^de$|German/i; d,c,l=false,'de','German'
+ when /^el$|Greek/i; d,c,l=false,'el','Greek'
+ when /^en$|English/i; d,c,l=false,'en','English'
+ when /^eo$|Esperanto/i; d,c,l=false,'eo','Esperanto'
+ when /^es$|Spanish|Espanol/i; d,c,l=false,'es','Spanish'
+ when /^et$|Estonian/i; d,c,l=false,'et','Estonian'
+ when /^eu$|Basque/i; d,c,l=false,'eu','Basque'
+ when /^fi$|Finnish|Finsk|Suomi/i; d,c,l=false,'fi','Finnish'
+ when /^fr$|French|Francais/i; d,c,l=false,'fr','French'
+ when /^ga$|Irish/i; d,c,l=false,'ga','Irish'
+ when /^gl$|Galician/i; d,c,l=false,'gl','Galician'
+ when /^he$|Hebrew/i; d,c,l=false,'he','Hebrew'
+ when /^hi$|Hindi/i; d,c,l=false,'hi','Hindi'
+ when /^hr$|Croatian/i; d,c,l=false,'hr','Croatian'
+ when /^hy$|Armenian/i; d,c,l=false,'hy','Armenian'
+ when /^ia$|Interlingua/i; d,c,l=false,'ia','Interlingua'
+ when /^is$|Icelandic/i; d,c,l=false,'is','Icelandic'
+ when /^it$|Italian/i; d,c,l=false,'it','Italian'
+ when /^la$|Latin/i; d,c,l=false,'la','Latin'
+ when /^lo$|Lao/i; d,c,l=false,'lo','Lao'
+ when /^lt$|Lithuanian/i; d,c,l=false,'lt','Lithuanian'
+ when /^lv$|Latvian/i; d,c,l=false,'lv','Latvian'
+ when /^ml$|Malayalam/i; d,c,l=false,'ml','Malayalam'
+ when /^mr$|Marathi/i; d,c,l=false,'mr','Marathi'
+ when /^nl$|Dutch/i; d,c,l=false,'nl','Dutch'
+ when /^no$|Norwegian|Norsk/i; d,c,l=false,'no','Norwegian'
+ when /^nn$|Norwegian Nynorsk/i; d,c,l=false,'nn','Norwegian Nynorsk'
+ when /^oc$|Occitan/i; d,c,l=false,'oc','Occitan'
+ when /^pl$|Polish/i; d,c,l=false,'pl','Polish'
+ when /^pt$|Portuguese/i; d,c,l=false,'pt','Portuguese'
+ when /^pt_BR$|Portuguese Brazil/i; d,c,l=false,'pt_BR','Portuguese Brazil'
+ when /^ro$|Romanian/i; d,c,l=false,'ro','Romanian'
+ when /^ru$|Russian/i; d,c,l=false,'ru','Russian'
+ when /^sa$|Sanskrit/i; d,c,l=false,'sa','Sanskrit'
+ when /^se$|Sami/i; d,c,l=false,'se','Sami'
+ when /^sk$|Slovak/i; d,c,l=false,'sk','Slovak'
+ when /^sl$|Slovenian/i; d,c,l=false,'sl','Slovenian'
+ when /^sq$|Albanian/i; d,c,l=false,'sq','Albanian'
+ when /^sr$|Serbian/i; d,c,l=false,'sr','Serbian'
+ when /^sv$|Swedish|Svensk/i; d,c,l=false,'sv','Swedish'
+ when /^ta$|Tamil/i; d,c,l=false,'ta','Tamil'
+ when /^te$|Telugu/i; d,c,l=false,'te','Telugu'
+ when /^th$|Thai/i; d,c,l=false,'th','Thai'
+ when /^tk$|Turkmen/i; d,c,l=false,'tk','Turkmen'
+ when /^tr$|Turkish/i; d,c,l=false,'tr','Turkish'
+ when /^uk$|Ukranian/i; d,c,l=false,'uk','Ukranian'
+ when /^ur$|Urdu/i; d,c,l=false,'ur','Urdu'
+ #when /^us$|/i; d,c,l=false,'us',''
+ when /^vi$|Vietnamese/i; d,c,l=false,'vi','Vietnamese'
+ else d,c,l=true,'en','English (default)'
+ #else d,c,l=true,'xx','Default'
end
lang[:d],lang[:c],lang[:l]=d,c,l
lang
@@ -851,7 +870,7 @@ module SiSU_Env
def code
language[:c]
end
- def file_to_language(file)
+ def file_to_language(file) # used, fix and remove
m=/.+?\~(\w{2,3})\.(?:-|ssm\.)?sst$/
@language=if file =~m ; file[m,1]
else ''
@@ -859,7 +878,15 @@ module SiSU_Env
language
end
def codes
- codes=['us','en','fr','de','it','es','br','pt','sv','da','fi','no','is','nl','et','hu','pl','ro','ru','el','uk','tr','sk','hr','sl','cs','bg'] # remove us and br see iso-639-2
+ # Language List po4a
+ # <http://www.debian.org/international/l10n/po/>
+ # Px[:lng_lst]=%w[am bg bn br ca cs cy da de el en eo es et eu fi fr ga gl he hi hr hy ia is it la lo lt lv ml mr nl nn no oc pl pt pt_BR ro ru sa se sk sl sq sr sv ta te th tk tr uk ur us vi]
+ # see polyglossia for subset
+ # <http://mirrors.ctan.org/macros/xetex/latex/polyglossia/polyglossia.pdf>
+ # also note ISO_639-2
+ # <http://en.wikipedia.org/wiki/ISO_639-2>
+ # <http://en.wikipedia.org/wiki/List_of_ISO_639-2_codes>
+ Px[:lng_lst] # constants.rb
end
end
class Info_env < Env_call
@@ -3382,14 +3409,9 @@ WOK
end
self
end
- def lang_part
- (@md.opt.f_pth[:lng]) \
- ? @md.opt.f_pth[:lng] \
- : @md.i18n[0]
- end
def set_path_abc(ft)
if @env.output_dir_structure.by_language_code?
- "#{output_path.base}/#{lang_part}/#{ft}"
+ "#{output_path.base}/#{@md.opt.lng}/#{ft}"
elsif @env.output_dir_structure.by_filetype?
"#{output_path.base}/#{ft}"
else
@@ -3398,14 +3420,14 @@ WOK
end
def set_path_ab(ft)
if @env.output_dir_structure.by_language_code?
- "#{output_path.base}/#{lang_part}/#{ft}"
+ "#{output_path.base}/#{@md.opt.lng}/#{ft}"
else
"#{output_path.base}/#{ft}"
end
end
def set_path_ab_src(ft)
if @env.output_dir_structure.by_language_code?
- "#{output_path.base}/#{ft}/#{lang_part}"
+ "#{output_path.base}/#{ft}/#{@md.opt.lng}"
else
"#{output_path.base}/#{ft}"
end
@@ -3429,14 +3451,14 @@ WOK
path=set_path_ab_src(ft)
end
def po
- "#{output_path.base}/po4a/#{@md.fnb}/po/#{lang_part}"
+ "#{output_path.base}/po4a/#{@md.fnb}/po/#{@md.opt.lng}"
end
def pot
"#{output_path.base}/po4a/#{@md.fnb}/pot"
end
def po_git
ft=Gt[:po]
- pth=@env.processing_path.git + '/' + @md.fnb + '/' + ft + '/' + lang_part
+ pth=@env.processing_path.git + '/' + @md.fnb + '/' + ft + '/' + @md.opt.lng
mkdir_p(pth) unless FileTest.directory?(pth)
pth
end
@@ -3512,6 +3534,9 @@ WOK
ft='sitemaps'
path=set_path_ab(ft)
end
+ def sqlite
+ path=output_path.base
+ end
self
end
end
@@ -3638,8 +3663,10 @@ WOK
@@pwd ||=Dir.pwd
@pwd=Dir.pwd
@env=SiSU_Env::Info_env.new
- m=/.+\/(?:src\/)?(\S+)/m # m=/.+?\/(?:src\/)?([^\/]+)$/im # m=/.+\/(\S+)/m
- @pwd_stub=@pwd[m,1]
+ pt=Pathname.new(@pwd)
+ r=Px[:lng_lst].join('|')
+ u=/.+?\/([^\/]+)(?:\/(?:#{r})$|$)/
+ @pwd_stub=pt.realpath.to_s[u,1]
@rc=@@rc ||=Get_init.instance.sisu_yaml.rc
@defaults=Info_env.new.defaults
end
diff --git a/lib/sisu/v3/urls.rb b/lib/sisu/v3/urls.rb
index 77952d0b..14788c00 100644
--- a/lib/sisu/v3/urls.rb
+++ b/lib/sisu/v3/urls.rb
@@ -79,12 +79,11 @@ module SiSU_urls
def initialize(opt)
@opt=opt
@particulars=SiSU_Particulars::Combined_singleton.instance.get_env_md(opt)
- fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(@opt.fns)
@cmd=@opt.cmd
@md=@particulars.md
@env=@particulars.env
@fnb=@env.fnb
- fn_set_lang=SiSU_Env::Standardise_language.new.file_to_language(@opt.fns)
+ fn_set_lang=SiSU_Env::Standardise_language.new(@opt.lng).language
@fnl=@env.i18n.lang_filename(fn_set_lang[:c])
@fn=SiSU_Env::Env_call.new(@opt.fns).lang(fn_set_lang[:c])
@m_regular=/(.+?)\.(?:(?:-|ssm\.)?sst|ssm)$/