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.



1070
1071
1072
# File 'lib/sisu/src_po4a_shelf.rb', line 1070

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

Instance Method Details

#dirObject



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

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

#languageObject



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

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



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

def po
  po4a_ + 'po'
end

#po4a_Object



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

def po4a_
  'po4a/' # ''
end

#po4a_cfgObject



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

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



1091
1092
1093
# File 'lib/sisu/src_po4a_shelf.rb', line 1091

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

#po4a_cfg_filenameObject



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

def po4a_cfg_filename
  'po4a.cfg'
end

#potObject



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

def pot
  po4a_ + 'pot'
end

#pwdObject



1077
1078
1079
# File 'lib/sisu/src_po4a_shelf.rb', line 1077

def pwd
  Dir.pwd
end

#sisu_languages_availableObject



1095
1096
1097
# File 'lib/sisu/src_po4a_shelf.rb', line 1095

def sisu_languages_available
  Px[:lng_lst]
end

#source_language_selected_strObject



1106
1107
1108
1109
1110
# File 'lib/sisu/src_po4a_shelf.rb', line 1106

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

#translation_languages_selectedObject



1098
1099
1100
1101
1102
# File 'lib/sisu/src_po4a_shelf.rb', line 1098

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

#translation_languages_selected_strObject



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

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

#translation_languages_selected_that_are_availableObject



1103
1104
1105
# File 'lib/sisu/src_po4a_shelf.rb', line 1103

def translation_languages_selected_that_are_available
  translation_languages_selected & sisu_languages_available
end

#translation_languages_selected_that_are_available_strObject



1111
1112
1113
# File 'lib/sisu/src_po4a_shelf.rb', line 1111

def translation_languages_selected_that_are_available_str
  translation_languages_selected_that_are_available.join(' ')
end