diff options
Diffstat (limited to 'lib/sisu/v2/texpdf_format.rb')
-rw-r--r-- | lib/sisu/v2/texpdf_format.rb | 56 |
1 files changed, 13 insertions, 43 deletions
diff --git a/lib/sisu/v2/texpdf_format.rb b/lib/sisu/v2/texpdf_format.rb index 9ebef9dc..465d4d90 100644 --- a/lib/sisu/v2/texpdf_format.rb +++ b/lib/sisu/v2/texpdf_format.rb @@ -604,6 +604,7 @@ module SiSU_TeX_Pdf end end class Format_head + require "#{SiSU_lib}/i18n" # defaults.rb def initialize(md,t_o) @md,@t_o=md,t_o @env=SiSU_Env::Info_env.new(@md.fns) @@ -621,47 +622,16 @@ module SiSU_TeX_Pdf @brace_url=SiSU_Viz::Skin.new.url_decoration @tex2pdf=@@tex3pdf ||=SiSU_Env::System_call.new.tex2pdf_engine @ps=@txt if @txt=~/(?:a4|letter|legal|book|a5|b5)/i - end - def language - @lang=if @md.language[:code] - case @md.language[:code] - when 'en'; 'english' - when 'us'; 'USenglish' # depreciated, see iso-639-2 - when 'fr'; 'french' - when 'de'; 'ngerman' - when 'it'; 'italian' - when 'es'; 'spanish' - when 'pt'; 'portuges' - #when 'br'; 'brazilian' # depreciated, see iso-639-2 - when 'sv'; 'swedish' - when 'da'; 'danish' - when 'fi'; 'finnish' - when 'no'; 'norske,nynorsk' - when 'is'; 'icelandic' - when 'nl'; 'dutch' - when 'et'; 'estonian' - when 'hu'; 'magyar' - when 'pl'; 'polish' - when 'ro'; 'romanian' - when 'ru'; 'russian' - when 'gl'; 'greek' - when 'uk'; 'ukrainian' - when 'tr'; 'turkish' - when 'sk'; 'slovak' - when 'sl'; 'slovenian' - when 'hr'; 'croatian' - when 'cs'; 'czech' - when 'bg'; 'bulgarian' - else 'english' - end - else 'english' - end + @lang ||=SiSU_i18n::Language.new(@md) end def tex_head_lang #babel 18n - language - lang=if @lang =~/^(?:en)$/; @lang - else "#{@lang},english" - end + lang_char_arr=@md.i18n + mainlang_char=lang_char_arr.slice(0) + mainlang=@lang.tex_name(mainlang_char) + otherlang=[] + lang_char_arr.slice(1..9).each { |ch| otherlang << @lang.tex_name(ch) } + otherlang=otherlang.join(',') + { :mainlang=>mainlang, :otherlang=>otherlang } end def tex_head_encode texpdf_font=if defined? @md.make.texpdf_font \ @@ -674,8 +644,8 @@ module SiSU_TeX_Pdf when /xe/ <<WOK \\usepackage{polyglossia, ucs, fontspec, xltxtra, xunicode} -\\setmainlanguage{#{tex_head_lang}} -\\setotherlanguage{english} +\\setmainlanguage{#{tex_head_lang[:mainlang]}} +\\setotherlanguage{#{tex_head_lang[:otherlang]}} \\setmainfont{#{texpdf_font}} WOK when /pdf/ @@ -913,7 +883,7 @@ WOK end def document_head_with_orientation endnotes=("\\usepackage{endnotes}" if @txt =~/endnotes?/)||'' #not implemented see also def endnotes - language + @lang.tex_name(@md.i18n[0]) <<WOK #{tex_head_paper} #{tex_head_encode} @@ -976,7 +946,7 @@ WOK {-\\baselineskip}{0.5\\baselineskip}% {\\normalfont\\normalsize\\itshape\\raggedright}} % \\makeatother -\\selectlanguage{#{language}} +\\selectlanguage{#{@lang.tex_name(@md.i18n[0])}} WOK end def a4generic |