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.
151
152
153
|
# File 'lib/sisu/src_po4a_share.rb', line 151
def initialize(opt,file)
@opt,@file=opt,file
end
|
Instance Method Details
#build_src_master_to_pot_and_po_and_srcs ⇒ Object
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
# File 'lib/sisu/src_po4a_share.rb', line 191
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
243
244
245
246
247
|
# File 'lib/sisu/src_po4a_share.rb', line 243
def clean
FileUtils.rm_f Dir.glob("./#{dir.po}/*/*.po~")
end
|
#debug ⇒ Object
180
181
182
|
# File 'lib/sisu/src_po4a_share.rb', line 180
def debug
'-d -v'
end
|
#dir_mk(dir) ⇒ Object
234
235
236
237
238
|
# File 'lib/sisu/src_po4a_share.rb', line 234
def dir_mk(dir)
unless FileTest.directory?(dir)
FileUtils::mkdir_p(dir)
end
end
|
#distclean ⇒ Object
248
249
250
251
252
253
254
|
# File 'lib/sisu/src_po4a_share.rb', line 248
def distclean
FileUtils::rm_f(filename.po4a_cfg)
FileUtils::rm_r(language.possible_translations,:force => true)
end
|
#flags ⇒ Object
179
180
181
182
183
184
185
186
187
188
189
190
|
# File 'lib/sisu/src_po4a_share.rb', line 179
def flags
def debug
'-d -v'
end
def normal
''
end
def quiet
'-q'
end
self
end
|
#gettext_if_any_build_src_trans_po ⇒ Object
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
|
# File 'lib/sisu/src_po4a_share.rb', line 211
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
239
240
241
242
|
# File 'lib/sisu/src_po4a_share.rb', line 239
def make_paths
dir_mk(@file.output_path.pot.dir)
dir_mk(@file.output_path.po.dir)
end
|
#normal ⇒ Object
183
184
185
|
# File 'lib/sisu/src_po4a_share.rb', line 183
def normal
''
end
|
#quiet ⇒ Object
186
187
188
|
# File 'lib/sisu/src_po4a_share.rb', line 186
def quiet
'-q'
end
|
#song ⇒ Object
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
# File 'lib/sisu/src_po4a_share.rb', line 154
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
|