aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib/sisu/develop/hub_options.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/hub_options.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/hub_options.rb')
-rw-r--r--lib/sisu/develop/hub_options.rb36
1 files changed, 32 insertions, 4 deletions
diff --git a/lib/sisu/develop/hub_options.rb b/lib/sisu/develop/hub_options.rb
index e7df01db..1ea96af8 100644
--- a/lib/sisu/develop/hub_options.rb
+++ b/lib/sisu/develop/hub_options.rb
@@ -1301,10 +1301,38 @@ module SiSU_Commandline
=~/"--harvest"/) \
? { bool: true, set: :on }
: { bool: false, set: :na }
- act[:po4a]=(select_arr.inspect \
- =~/"--po4a"|"--pot?"/) \
- ? { bool: true, set: :on }
- : { bool: false, set: :na }
+ act[:po4a]=if (select_arr.inspect \
+ =~/"--po4a"|"--pot?"/)
+ act[:po4a_lang_trans]=if select_arr.inspect \
+ =~/"--trans-([a-z]{2}):((?:(?:[a-z]{2}\b),?)+)/
+ lng_src,lng_trn=$1,$2.split(',')
+ { bool: true, set: :on, src: lng_src, trn: lng_trn }
+ elsif select_arr.inspect \
+ =~/"--trans"/
+ { bool: true, set: :on }
+ { bool: true, set: :on, src: 'en', trn: [] }
+ else
+ { bool: false, set: :na }
+ end
+ act[:po4a_lang_init]=if select_arr.inspect \
+ =~/"--init-([a-z]{2}):((?:(?:[a-z]{2}\b),?)+)/
+ lng_src,lng_trn=$1,$2.split(',')
+ { bool: true, set: :on, src: lng_src, trn: lng_trn }
+ else
+ { bool: false, set: :na }
+ end
+ { bool: true, set: :on }
+ else
+ act[:po4a_lang_trans]= \
+ { bool: false, set: :na }
+ act[:po4a_lang_init]= \
+ { bool: false, set: :na }
+ { bool: false, set: :na }
+ end
+ #act[:po4a]=(select_arr.inspect \
+ #=~/"--po4a"|"--pot?"/) \
+ #? { bool: true, set: :on }
+ #: { bool: false, set: :na }
act[:git]=(select_arr.inspect \
=~/"--git"/) \
? { bool: true, set: :on }