aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/develop/po4a_set.rb
diff options
context:
space:
mode:
authorRalph Amissah <ralph@amissah.com>2014-12-31 08:50:09 -0500
committerRalph Amissah <ralph@amissah.com>2015-01-07 22:42:40 -0500
commita25c64083c10dc2b2b02fcee06b1e305a379ce90 (patch)
treed2d8d3fbf9bf37868afaa22a1759e55a8ee86273 /lib/sisu/develop/po4a_set.rb
parentd: po4a, reorganize a bit (diff)
d: po4a, continue reorganization (translation request dev stopped)
* --po4a run against different language versions of sisu markup files (representing the same document in different languages) initializes po4a structure to place those documents under future po4a management * includes command line translation request (use command line program 'trans' to pass request to translation.google.com, stopped for now) NOTE in case future development is restarted: to test, remove code line 'auto_translate?(:skip)' that follows 'def auto_translation(src_txt,markup=:src)'; place identical english sisu markup files in en/test.sst fr/test.sst (or under the language code to be tested) and run against en/test.sst fr/test.sst e.g. '--po4a --trans --glob test.sst' this send identical text objects to translate.google using 'trans' and populate po file with results for placing future translation under po4a management, however in initial tests insufficient cleanly translated paragraphs were returned, so stopped development for now. (no attempt at initialization of new non-existent files using --trans-en:es,fr,de format) * [hub_options, if development of trans is pursued later consider the possibility of modifying the --trans string options to add an optional timeout value, &; possibly modifying po4a code so timeout may occur a fixed number of times before skipping translation request attempts for the remainder].
Diffstat (limited to 'lib/sisu/develop/po4a_set.rb')
-rw-r--r--lib/sisu/develop/po4a_set.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/sisu/develop/po4a_set.rb b/lib/sisu/develop/po4a_set.rb
index 2ae73102..d56175fe 100644
--- a/lib/sisu/develop/po4a_set.rb
+++ b/lib/sisu/develop/po4a_set.rb
@@ -57,7 +57,8 @@
module SiSU_Po4aUtils
class Wrap
def initialize(md,orig='',trans='',is_desc='',n_char_max=76,n_indent=0,n_hang=nil)
- @md,@orig,@trans,@is_desc,@n_char_max,@n_indent=md,orig,trans,is_desc,n_char_max,n_indent
+ @md,@orig,@trans,@is_desc,@n_char_max,@n_indent=
+ md, orig, trans, is_desc, n_char_max, n_indent
@n_char_max_extend = n_char_max
@br="\n"
@n_hang=n_hang ? n_hang : @n_indent
@@ -66,7 +67,8 @@ module SiSU_Po4aUtils
end
def line_wrap
space=' '
- spaces_indent,spaces_hang="#{@br}#{space*@n_indent}",space*@n_hang
+ spaces_indent,spaces_hang=
+ "#{@br}#{space*@n_indent}",space*@n_hang
pot,i=[],0
pot_array=(@trans.empty?) ? [@orig] : [@orig,@trans]
pot_array.each do |pa|
@@ -76,7 +78,7 @@ module SiSU_Po4aUtils
@oldword='' #REMOVE @oldword
pa=pa.gsub(/<br>/,' <br> ').
gsub(/#{Mx[:br_nl]}/,"\n\n")
- words=pa.scan(/\n\n|<br>|\S+/m)
+ words=pa.scan(/\n\n|\\\\\\|<br>|\S+/m)
while words != ''
word=words.shift
if not word