air18n 0.1.47 → 0.1.48
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.
- data/lib/air18n/class_methods.rb +12 -2
- data/lib/air18n/mock_priority.rb +4 -0
- data/lib/air18n/priority.rb +4 -0
- data/lib/air18n/version.rb +1 -1
- data/spec/lib/air18n/air18n_spec.rb +8 -0
- metadata +2 -2
data/lib/air18n/class_methods.rb
CHANGED
|
@@ -116,7 +116,15 @@ module Air18n
|
|
|
116
116
|
@contextual_translation= x
|
|
117
117
|
end
|
|
118
118
|
|
|
119
|
-
#
|
|
119
|
+
# The notion of which keys are still used are cached and never reloaded,
|
|
120
|
+
# except after this method is called.
|
|
121
|
+
def reset_notion_of_still_used_phrases
|
|
122
|
+
@priority.reset
|
|
123
|
+
@still_used_phrase_ids = nil
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
# Returns OrderedHash mapping key => times looked up today or in the last
|
|
127
|
+
# week.
|
|
120
128
|
def still_used_keys_hash
|
|
121
129
|
# If you want to test with the full allotment of still-used phrases from
|
|
122
130
|
# production, do this on mainframe:
|
|
@@ -143,10 +151,12 @@ module Air18n
|
|
|
143
151
|
key_to_phrase_id[record['key']] = record['id']
|
|
144
152
|
end
|
|
145
153
|
|
|
146
|
-
still_used_keys.map do |key|
|
|
154
|
+
raw_phrase_ids = still_used_keys.map do |key|
|
|
147
155
|
LoggingHelper.error "Mystery phrase key: #{key}" if !key_to_phrase_id.include? key
|
|
148
156
|
key_to_phrase_id[key]
|
|
149
157
|
end
|
|
158
|
+
|
|
159
|
+
raw_phrase_ids.compact.uniq
|
|
150
160
|
end
|
|
151
161
|
end
|
|
152
162
|
|
data/lib/air18n/mock_priority.rb
CHANGED
data/lib/air18n/priority.rb
CHANGED
data/lib/air18n/version.rb
CHANGED
|
@@ -61,6 +61,14 @@ describe Air18n do
|
|
|
61
61
|
mock_priority.key_usage.should_not include('priority, key 3')
|
|
62
62
|
end
|
|
63
63
|
end
|
|
64
|
+
|
|
65
|
+
it 'should be able to reset notion of still-used phrases' do
|
|
66
|
+
Air18n::MockPriority.mock_priority({'still used reset 1' => 1}) do |mock_priority|
|
|
67
|
+
I18n.still_used_keys_hash['still used reset 1'].should == 1
|
|
68
|
+
I18n.reset_notion_of_still_used_phrases
|
|
69
|
+
I18n.still_used_keys_hash.should_not include('still_used reset 1')
|
|
70
|
+
end
|
|
71
|
+
end
|
|
64
72
|
end
|
|
65
73
|
|
|
66
74
|
context 'XSS attack detection integration test' 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.1.
|
|
4
|
+
version: 0.1.48
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -13,7 +13,7 @@ authors:
|
|
|
13
13
|
autorequire:
|
|
14
14
|
bindir: bin
|
|
15
15
|
cert_chain: []
|
|
16
|
-
date:
|
|
16
|
+
date: 2013-01-03 00:00:00.000000000 Z
|
|
17
17
|
dependencies:
|
|
18
18
|
- !ruby/object:Gem::Dependency
|
|
19
19
|
name: i18n
|