Class: SiSU_Po4a_Project::Po4aCfg

Inherits:
Object
  • Object
show all
Includes:
SiSU_Composite_Doc_Utils, SiSU_Languages_Selected, SiSU_Response
Defined in:
lib/sisu/src_po4a_share.rb

Instance Method Summary collapse

Methods included from SiSU_Languages_Selected

#language, #sisu_languages_available, #source_language_selected_str, #translation_languages_available, #translation_languages_selected, #translation_languages_selected_str, #translation_languages_selected_that_are_available, #translation_languages_selected_that_are_available_str

Methods included from SiSU_Response

#answer?, #available_selections_, #query, #response?, #response_short, #response_strict, #selection_options, #selections_available_

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.



92
93
94
# File 'lib/sisu/src_po4a_share.rb', line 92

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

Instance Method Details

#dirObject



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
# File 'lib/sisu/src_po4a_share.rb', line 106

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

#poObject



117
118
119
120
# File 'lib/sisu/src_po4a_share.rb', line 117

def po
  #po4a_ + 'po'
  'po'
end

#po4a_Object



110
111
112
# File 'lib/sisu/src_po4a_share.rb', line 110

def po4a_
  'po4a/' # ''
end

#po4a_cfgObject



126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/sisu/src_po4a_share.rb', line 126

def po4a_cfg
  lng=language.source_language_selected_str
  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] #{lng}/#{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



123
124
125
# File 'lib/sisu/src_po4a_share.rb', line 123

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

#po4a_cfg_filenameObject



103
104
105
# File 'lib/sisu/src_po4a_share.rb', line 103

def po4a_cfg_filename
  'po4a.cfg'
end

#potObject



113
114
115
116
# File 'lib/sisu/src_po4a_share.rb', line 113

def pot
  #po4a_ + 'pot'
  'pot'
end

#pwdObject



107
108
109
# File 'lib/sisu/src_po4a_share.rb', line 107

def pwd
  Dir.pwd
end

#songObject



95
96
97
98
99
100
101
102
# File 'lib/sisu/src_po4a_share.rb', line 95

def song
  if @opt.lng==language.source_language_selected_str
    ans=response?('po4a config file')
    if ans
      po4a_cfg
    end
  end
end