Class: SiSU_Po4a::Source::Po4aCfg

Inherits:
Object
  • Object
show all
Includes:
SiSU_Composite_Doc_Utils
Defined in:
lib/sisu/src_po4a_shelf.rb

Instance Method Summary collapse

Methods included from SiSU_Composite_Doc_Utils

#composite_and_imported_filenames_array, #extract_filenames, #insert_filename?, #inserts_array

Constructor Details

#initialize(opt, file) ⇒ Po4aCfg

Returns a new instance of Po4aCfg.



1072
1073
1074
# File 'lib/sisu/src_po4a_shelf.rb', line 1072

def initialize(opt,file)
  @opt,@file=opt,file
end

Instance Method Details

#dirObject



1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
# File 'lib/sisu/src_po4a_shelf.rb', line 1078

def dir
  def pwd
    Dir.pwd
  end
  def po4a_
    'po4a/' # ''
  end
  def pot
    po4a_ + 'pot'
  end
  def po
    po4a_ + 'po'
  end
  self
end

#languageObject



1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
# File 'lib/sisu/src_po4a_shelf.rb', line 1096

def language
  def sisu_languages_available
    Px[:lng_lst]
  end
  def translation_languages_selected
    @opt.act[:po4a_lang_trans][:trn] \
    ? @opt.act[:po4a_lang_trans][:trn]
    : []
  end
  def translation_languages_selected_that_are_available
    translation_languages_selected & sisu_languages_available
  end
  def source_language_selected_str
    @opt.act[:po4a_lang_trans][:src] \
    ? @opt.act[:po4a_lang_trans][:src]
    : 'en'
  end
  def translation_languages_selected_that_are_available_str
    translation_languages_selected_that_are_available.join(' ')
  end
  def translation_languages_selected_str
    @opt.act[:po4a_lang_trans][:trn].join(' ')
  end
  self
end

#poObject



1088
1089
1090
# File 'lib/sisu/src_po4a_shelf.rb', line 1088

def po
  po4a_ + 'po'
end

#po4a_Object



1082
1083
1084
# File 'lib/sisu/src_po4a_shelf.rb', line 1082

def po4a_
  'po4a/' # ''
end

#po4a_cfgObject



1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
# File 'lib/sisu/src_po4a_shelf.rb', line 1121

def po4a_cfg
  doc_import_list=composite_and_imported_filenames_array(@opt.fno)
  po4a_cfg_arr=[]
  po4a_cfg_arr \
    << "[po4a_langs] #{language.translation_languages_selected_that_are_available_str}"
  po4a_cfg_arr \
    << "[po4a_paths] #{dir.pot}/$master.pot $lang:#{dir.po}/$lang/$master.po"
  doc_import_list.each do |file_src|
    file_src_fn=
      file_src.gsub(/#{language.source_language_selected_str}\//,'')
    po4a_cfg_arr \
      << "[type: text] #{file_src} $lang:$lang/#{file_src_fn}"
  end
  file=@file.write_file.po4a_cfg
  po4a_cfg_arr.each do |txt|
  puts txt
    file << txt << "\n"
  end
  file.close
end

#po4a_cfg_fileObject



1093
1094
1095
# File 'lib/sisu/src_po4a_shelf.rb', line 1093

def po4a_cfg_file
  File.open("#{Dir.pwd}/#{po4a_cfg_filename}",'w')
end

#po4a_cfg_filenameObject



1075
1076
1077
# File 'lib/sisu/src_po4a_shelf.rb', line 1075

def po4a_cfg_filename
  'po4a.cfg'
end

#potObject



1085
1086
1087
# File 'lib/sisu/src_po4a_shelf.rb', line 1085

def pot
  po4a_ + 'pot'
end

#pwdObject



1079
1080
1081
# File 'lib/sisu/src_po4a_shelf.rb', line 1079

def pwd
  Dir.pwd
end

#sisu_languages_availableObject



1097
1098
1099
# File 'lib/sisu/src_po4a_shelf.rb', line 1097

def sisu_languages_available
  Px[:lng_lst]
end

#source_language_selected_strObject



1108
1109
1110
1111
1112
# File 'lib/sisu/src_po4a_shelf.rb', line 1108

def source_language_selected_str
  @opt.act[:po4a_lang_trans][:src] \
  ? @opt.act[:po4a_lang_trans][:src]
  : 'en'
end

#translation_languages_selectedObject



1100
1101
1102
1103
1104
# File 'lib/sisu/src_po4a_shelf.rb', line 1100

def translation_languages_selected
  @opt.act[:po4a_lang_trans][:trn] \
  ? @opt.act[:po4a_lang_trans][:trn]
  : []
end

#translation_languages_selected_strObject



1116
1117
1118
# File 'lib/sisu/src_po4a_shelf.rb', line 1116

def translation_languages_selected_str
  @opt.act[:po4a_lang_trans][:trn].join(' ')
end

#translation_languages_selected_that_are_availableObject



1105
1106
1107
# File 'lib/sisu/src_po4a_shelf.rb', line 1105

def translation_languages_selected_that_are_available
  translation_languages_selected & sisu_languages_available
end

#translation_languages_selected_that_are_available_strObject



1113
1114
1115
# File 'lib/sisu/src_po4a_shelf.rb', line 1113

def translation_languages_selected_that_are_available_str
  translation_languages_selected_that_are_available.join(' ')
end