air18n 0.1.54 → 0.1.55
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.
|
@@ -144,6 +144,15 @@ module Air18n
|
|
|
144
144
|
response_obj
|
|
145
145
|
end
|
|
146
146
|
|
|
147
|
+
def previous_translation
|
|
148
|
+
PhraseTranslation.where(:locale => locale,
|
|
149
|
+
:phrase_id => phrase_id,
|
|
150
|
+
:source_hash => source_hash).
|
|
151
|
+
where("created_at < ?", created_at).
|
|
152
|
+
order("created_at DESC").
|
|
153
|
+
first
|
|
154
|
+
end
|
|
155
|
+
|
|
147
156
|
# Computes monthly activity for months between opts[:since] and opts[:to].
|
|
148
157
|
# If opts[:to] is not set, starts from the current month.
|
|
149
158
|
# If opts[:since] is not set, goes back until a month in which there is no activity.
|
data/lib/air18n/version.rb
CHANGED
|
@@ -43,6 +43,32 @@ describe Air18n::PhraseTranslation do
|
|
|
43
43
|
end
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
+
context 'previous_translation' do
|
|
47
|
+
phrase = FactoryGirl.create(:phrase,
|
|
48
|
+
:key => 'previous_translation phrase key',
|
|
49
|
+
:value => 'val')
|
|
50
|
+
phrase.save!
|
|
51
|
+
original_translation = FactoryGirl.create(:phrase_translation,
|
|
52
|
+
:phrase => phrase,
|
|
53
|
+
:value => "original translation")
|
|
54
|
+
original_translation.previous_translation.should == nil
|
|
55
|
+
|
|
56
|
+
second_translation = FactoryGirl.create(:phrase_translation,
|
|
57
|
+
:phrase => phrase,
|
|
58
|
+
:value => "second translation")
|
|
59
|
+
second_translation.previous_translation.value.should == "original translation"
|
|
60
|
+
|
|
61
|
+
phrase.value = 'updated val'
|
|
62
|
+
phrase.save!
|
|
63
|
+
|
|
64
|
+
third_translation = FactoryGirl.create(:phrase_translation,
|
|
65
|
+
:phrase => phrase,
|
|
66
|
+
:value => "third translation")
|
|
67
|
+
|
|
68
|
+
# There was no previous translation of 'updated val'
|
|
69
|
+
third_translation.previous_translation.should == nil
|
|
70
|
+
end
|
|
71
|
+
|
|
46
72
|
context 'validations' do
|
|
47
73
|
it 'Should check maximum length' do
|
|
48
74
|
translation = FactoryGirl.create(:phrase_translation, :key => 'facebook description maxlength:10', :value => 'short')
|
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.55
|
|
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: 2013-01-
|
|
16
|
+
date: 2013-01-23 00:00:00.000000000 Z
|
|
17
17
|
dependencies:
|
|
18
18
|
- !ruby/object:Gem::Dependency
|
|
19
19
|
name: i18n
|
|
@@ -219,7 +219,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
219
219
|
version: '0'
|
|
220
220
|
requirements: []
|
|
221
221
|
rubyforge_project:
|
|
222
|
-
rubygems_version: 1.8.
|
|
222
|
+
rubygems_version: 1.8.22
|
|
223
223
|
signing_key:
|
|
224
224
|
specification_version: 3
|
|
225
225
|
summary: Dynamic I18n backend
|