babelphish 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/lib/babelphish.rb CHANGED
@@ -2,7 +2,7 @@ $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
4
  module Babelphish
5
- VERSION = '0.1.1'
5
+ VERSION = '0.1.2'
6
6
 
7
7
  def self.load_tasks
8
8
  if File.exists?('Rakefile')
@@ -36,7 +36,15 @@ module Babelphish
36
36
  if translate_hash[key].is_a?(Hash)
37
37
  translate_keys(translate_hash[key], to, from)
38
38
  else
39
+ # pull out all the string substitutions so that google doesn't translate those
40
+ pattern = /\{\{.+\}\}/
41
+ holder = '{{---}}'
42
+ replacements = translate_hash[key].scan(pattern)
43
+ translate_hash[key].gsub!(pattern, holder)
39
44
  translate_hash[key] = translate(translate_hash[key], to, from)
45
+ replacements.each do |r|
46
+ translate_hash[key].sub!(holder, r)
47
+ end
40
48
  end
41
49
  end
42
50
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: babelphish
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Ball
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-19 00:00:00 -06:00
12
+ date: 2009-05-21 00:00:00 -06:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency