air18n 0.1.34 → 0.1.35
Sign up to get free protection for your applications and to get access to all the features.
@@ -108,6 +108,11 @@ module Air18n
|
|
108
108
|
else
|
109
109
|
message = error
|
110
110
|
end
|
111
|
+
elsif latest && latest.user_id != user_id
|
112
|
+
pt.is_verification = true
|
113
|
+
|
114
|
+
do_save = true
|
115
|
+
message = "Translation saved, marked as verified."
|
111
116
|
else
|
112
117
|
do_save = true
|
113
118
|
message = "Translation saved."
|
data/lib/air18n/version.rb
CHANGED
@@ -163,46 +163,68 @@ describe Air18n::PhraseTranslation do
|
|
163
163
|
translation.source_word_count.should == 3
|
164
164
|
translation.source_hash.should == "2ac1a5cdad0d3ca0b0c318000c2f7378"
|
165
165
|
|
166
|
+
# Since November 2012, we automatically mark edits as verifications.
|
167
|
+
# But not when the translator is the same as the one before.
|
168
|
+
translation.should_not be_verification
|
169
|
+
|
170
|
+
##### 3.5. Submission of unchanged translation by same translator.
|
171
|
+
|
172
|
+
response = Air18n::PhraseTranslation.create_translation(
|
173
|
+
phrase.id, phrase.key, :es, 'whyo helloo newword1 thereo newword2', user_id_first, do_xss_check, allow_verification)
|
174
|
+
response.should include(
|
175
|
+
:status => 'error', :message => 'You last translated this phrase, so somebody else must verify it.')
|
176
|
+
|
177
|
+
unchanged_translation = phrase.latest_translation(:es)
|
178
|
+
unchanged_translation.id.should == translation.id
|
179
|
+
|
166
180
|
##### 3. Tweak to existing translation to delete a word.
|
167
181
|
|
168
182
|
response = Air18n::PhraseTranslation.create_translation(
|
169
|
-
phrase.id, phrase.key, :es, 'whyo helloo newword1 newword2',
|
183
|
+
phrase.id, phrase.key, :es, 'whyo helloo newword1 newword2', user_id_second, do_xss_check, allow_verification)
|
170
184
|
|
171
185
|
translation = phrase.latest_translation(:es)
|
172
186
|
translation.value.should == 'whyo helloo newword1 newword2'
|
173
187
|
translation.source_word_count.should == 3
|
174
188
|
translation.source_hash.should == "2ac1a5cdad0d3ca0b0c318000c2f7378"
|
175
189
|
|
176
|
-
|
190
|
+
# Since November 2012, we automatically mark edits as verifications.
|
191
|
+
# This one is done by a different translator as the previous
|
192
|
+
# translator, so is a verification.
|
193
|
+
translation.should be_verification
|
194
|
+
|
195
|
+
##### 4. Submission of unchanged translation for a phrase that is
|
196
|
+
##### already verified.
|
177
197
|
|
178
198
|
response = Air18n::PhraseTranslation.create_translation(
|
179
199
|
phrase.id, phrase.key, :es, 'whyo helloo newword1 newword2', user_id_first, do_xss_check, allow_verification)
|
180
200
|
response.should include(
|
181
|
-
:status => 'error', :message => '
|
201
|
+
:status => 'error', :message => 'Translation already verified; nothing saved.')
|
182
202
|
|
183
203
|
unchanged_translation = phrase.latest_translation(:es)
|
184
204
|
unchanged_translation.id.should == translation.id
|
185
205
|
|
186
|
-
##### 5. Submission of unchanged translation for stale phrase.
|
206
|
+
##### 5. Submission of unchanged translation for stale phrase by same translator.
|
187
207
|
|
188
208
|
phrase.value = 'why hello there, good day'
|
189
209
|
phrase.save!
|
190
210
|
|
191
211
|
response = Air18n::PhraseTranslation.create_translation(
|
192
|
-
phrase.id, phrase.key, :es, 'whyo helloo newword1 newword2',
|
212
|
+
phrase.id, phrase.key, :es, 'whyo helloo newword1 newword2', user_id_second, do_xss_check, allow_verification)
|
193
213
|
response.should include(
|
194
214
|
:status => 'success', :message => 'Translation marked as up-to-date.')
|
195
215
|
|
196
216
|
translation = phrase.latest_translation(:es)
|
197
217
|
translation.value.should == 'whyo helloo newword1 newword2'
|
198
218
|
translation.source_word_count.should == 3
|
199
|
-
translation.is_verification.should ==
|
219
|
+
translation.is_verification.should == true # Because last touch was verification.
|
200
220
|
translation.source_hash.should == "2ac1a5cdad0d3ca0b0c318000c2f7378"
|
201
221
|
|
202
|
-
##### 6.
|
222
|
+
##### 6. Submission of unchanged translation for stale phrase by different translator.
|
223
|
+
phrase.value = 'why hello there, happy day'
|
224
|
+
phrase.save!
|
203
225
|
|
204
226
|
response = Air18n::PhraseTranslation.create_translation(
|
205
|
-
phrase.id, phrase.key, :es, 'whyo helloo newword1 newword2',
|
227
|
+
phrase.id, phrase.key, :es, 'whyo helloo newword1 newword2', user_id_first, do_xss_check, allow_verification)
|
206
228
|
response.should include(
|
207
229
|
:status => 'success', :message => 'Translation verified.')
|
208
230
|
|
@@ -210,7 +232,7 @@ describe Air18n::PhraseTranslation do
|
|
210
232
|
translation.value.should == 'whyo helloo newword1 newword2'
|
211
233
|
translation.source_word_count.should == 5
|
212
234
|
translation.is_verification.should == true
|
213
|
-
translation.source_hash.should == "
|
235
|
+
translation.source_hash.should == "9fd16f4422eadae1c159d60ba063405f"
|
214
236
|
end
|
215
237
|
end
|
216
238
|
|