air18n 0.4.11 → 0.4.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -708,9 +708,10 @@ module Air18n
708
708
  def self.detect_variables(search_in)
709
709
  case search_in
710
710
  when String
711
- search_in.scan(/\{\{(\w+)\}\}/).flatten +
711
+ search_in.scan(/\{\{([\w .\-_]+)\}\}/).flatten +
712
712
  search_in.scan(/\%\{(\w+)\}/).flatten +
713
- search_in.scan(/\%(?:\d\$)?(?:[0\.]\d)?[dfsu@]/).flatten
713
+ search_in.scan(/\%(?:\d\$)?(?:[0\.]\d)?[dfsu@]/).flatten +
714
+ search_in.scan(/__[A-Z_]+__/).flatten
714
715
 
715
716
  when Array
716
717
  search_in.inject(Set[]) { |carry, item| carry + detect_variables(item) }
@@ -1,3 +1,3 @@
1
1
  module Air18n
2
- VERSION = "0.4.11"
2
+ VERSION = "0.4.12"
3
3
  end
@@ -89,6 +89,13 @@ describe Air18n::PhraseTranslation do
89
89
  Air18n::PhraseTranslation.detect_variables('I am 45% sorry .for that.').
90
90
  should be_empty
91
91
  end
92
+
93
+ it 'should detect lantern variables' do
94
+ Air18n::PhraseTranslation.detect_variables('Hello {{ticket requester}} and __OTHER_HOST__, {{dc.excerpt-_general-_airbnb_community}}').
95
+ to_set.should == ['ticket requester',
96
+ '__OTHER_HOST__',
97
+ 'dc.excerpt-_general-_airbnb_community'].to_set
98
+ end
92
99
  end
93
100
 
94
101
  context 'validations' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: air18n
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.11
4
+ version: 0.4.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: