air18n 0.4.11 → 0.4.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -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) }
|
data/lib/air18n/version.rb
CHANGED
@@ -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
|