Class: SiSU_Po4a_Project::Po4aProject
Instance Method Summary
collapse
#answer?, #available_selections_, #query, #response?, #response_short, #response_strict, #selection_options, #selections_available_
#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
Constructor Details
#initialize(opt, file) ⇒ Po4aProject
Returns a new instance of Po4aProject.
153
154
155
|
# File 'lib/sisu/src_po4a_share.rb', line 153
def initialize(opt,file)
@opt,@file=opt,file
end
|
Instance Method Details
#build_src_master_to_pot_and_po_and_srcs ⇒ Object
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
|
# File 'lib/sisu/src_po4a_share.rb', line 193
def build_src_master_to_pot_and_po_and_srcs
if SiSU_Sys_Call::SystemCall.new.po4a
pwd=Dir.pwd
cmd='po4a --keep 0 -M UTF-8' \
+ flags.normal + ' ' \
+ @file.base_filename.po4a_cfg
Dir.chdir(@file.output_path.po4a.dir)
system("
cd #{@file.output_path.po4a.dir}
#{cmd}
cd -
"); puts cmd
Dir.chdir(pwd)
end
end
|
#clean ⇒ Object
245
246
247
248
249
|
# File 'lib/sisu/src_po4a_share.rb', line 245
def clean
FileUtils.rm_f Dir.glob("./#{dir.po}/*/*.po~")
end
|
#debug ⇒ Object
182
183
184
|
# File 'lib/sisu/src_po4a_share.rb', line 182
def debug
'-d -v'
end
|
#dir_mk(dir) ⇒ Object
236
237
238
239
240
|
# File 'lib/sisu/src_po4a_share.rb', line 236
def dir_mk(dir)
unless FileTest.directory?(dir)
FileUtils::mkdir_p(dir)
end
end
|
#distclean ⇒ Object
250
251
252
253
254
255
256
|
# File 'lib/sisu/src_po4a_share.rb', line 250
def distclean
FileUtils::rm_f(filename.po4a_cfg)
FileUtils::rm_r(language.possible_translations,:force => true)
end
|
#flags ⇒ Object
181
182
183
184
185
186
187
188
189
190
191
192
|
# File 'lib/sisu/src_po4a_share.rb', line 181
def flags
def debug
'-d -v'
end
def normal
''
end
def quiet
'-q'
end
self
end
|
#gettext_if_any_build_src_trans_po ⇒ Object
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
|
# File 'lib/sisu/src_po4a_share.rb', line 213
def gettext_if_any_build_src_trans_po
Dir.chdir(@file.output_path.po4a.dir)
dirs=Dir['*/']
dirs_language=[]
dirs.each do |x|
dirs_language << x.gsub(/\/$/,'')
end
dirs_translation = \
(language.translation_languages_available & dirs_language)
files_src=Dir.glob("./#{source_language_selected_str}/*.ss[tmi]")
dirs_translation.each do |lng|
files_src.each do |file|
fn=file.gsub(/\.\/#{source_language_selected_str}\//,'')
system("
po4a-gettextize -f text -M utf-8 \
-m ./#{source_language_selected_str}/#{fn} \
-l ./#{lng}/#{fn} \
-p ./po/#{lng}/#{fn}.po
")
puts fn
end
end
end
|
#make_paths ⇒ Object
241
242
243
244
|
# File 'lib/sisu/src_po4a_share.rb', line 241
def make_paths
dir_mk(@file.output_path.pot.dir)
dir_mk(@file.output_path.po.dir)
end
|
#normal ⇒ Object
185
186
187
|
# File 'lib/sisu/src_po4a_share.rb', line 185
def normal
''
end
|
#quiet ⇒ Object
188
189
190
|
# File 'lib/sisu/src_po4a_share.rb', line 188
def quiet
'-q'
end
|
#song ⇒ Object
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
|
# File 'lib/sisu/src_po4a_share.rb', line 156
def song
make_paths
if FileTest.directory?(@file.output_path.po4a.dir)
Dir.chdir(@file.output_path.po4a.dir)
dirs=Dir['*/']
dirs_language=[]
dirs.each do |x|
dirs_language << x.gsub(/\/$/,'')
end
dirs_translation = \
(language.translation_languages_available & dirs_language)
end
if (language.translation_languages_available & [@opt.lng]).length == 1
puts %{gettext for: #{dirs_translation}
in #{Dir.pwd}}
ans=response?('gettext?')
if ans
gettext_if_any_build_src_trans_po
end
end
ans=response?('build project?')
if ans
build_src_master_to_pot_and_po_and_srcs
end
end
|