air18n 0.1.39 → 0.1.40
Sign up to get free protection for your applications and to get access to all the features.
@@ -108,7 +108,9 @@ module Air18n
|
|
108
108
|
else
|
109
109
|
message = error
|
110
110
|
end
|
111
|
-
elsif latest && latest.user_id != user_id
|
111
|
+
elsif latest && (latest.user_id != user_id || latest.is_verification)
|
112
|
+
# If the translator is different than the last, or the last
|
113
|
+
# translation was already a verification, this one is too.
|
112
114
|
pt.is_verification = true
|
113
115
|
|
114
116
|
do_save = true
|
data/lib/air18n/version.rb
CHANGED
@@ -177,7 +177,8 @@ describe Air18n::PhraseTranslation do
|
|
177
177
|
unchanged_translation = phrase.latest_translation(:es)
|
178
178
|
unchanged_translation.id.should == translation.id
|
179
179
|
|
180
|
-
##### 3. Tweak to existing translation to delete a word
|
180
|
+
##### 3. Tweak to existing translation to delete a word by a different
|
181
|
+
##### translator.
|
181
182
|
|
182
183
|
response = Air18n::PhraseTranslation.create_translation(
|
183
184
|
phrase.id, phrase.key, :es, 'whyo helloo newword1 newword2', user_id_second, do_xss_check, allow_verification)
|
@@ -187,6 +188,16 @@ describe Air18n::PhraseTranslation do
|
|
187
188
|
translation.source_word_count.should == 3
|
188
189
|
translation.source_hash.should == "2ac1a5cdad0d3ca0b0c318000c2f7378"
|
189
190
|
|
191
|
+
##### 3. Tweak to verified translation by same translator.
|
192
|
+
|
193
|
+
response = Air18n::PhraseTranslation.create_translation(
|
194
|
+
phrase.id, phrase.key, :es, 'whyo helloo newword1 newword3', user_id_second, do_xss_check, allow_verification)
|
195
|
+
|
196
|
+
translation = phrase.latest_translation(:es)
|
197
|
+
translation.value.should == 'whyo helloo newword1 newword3'
|
198
|
+
translation.source_word_count.should == 3
|
199
|
+
translation.source_hash.should == "2ac1a5cdad0d3ca0b0c318000c2f7378"
|
200
|
+
|
190
201
|
# Since November 2012, we automatically mark edits as verifications.
|
191
202
|
# This one is done by a different translator as the previous
|
192
203
|
# translator, so is a verification.
|
@@ -196,7 +207,7 @@ describe Air18n::PhraseTranslation do
|
|
196
207
|
##### already verified.
|
197
208
|
|
198
209
|
response = Air18n::PhraseTranslation.create_translation(
|
199
|
-
phrase.id, phrase.key, :es, 'whyo helloo newword1
|
210
|
+
phrase.id, phrase.key, :es, 'whyo helloo newword1 newword3', user_id_first, do_xss_check, allow_verification)
|
200
211
|
response.should include(
|
201
212
|
:status => 'error', :message => 'Translation already verified; nothing saved.')
|
202
213
|
|
@@ -209,12 +220,12 @@ describe Air18n::PhraseTranslation do
|
|
209
220
|
phrase.save!
|
210
221
|
|
211
222
|
response = Air18n::PhraseTranslation.create_translation(
|
212
|
-
phrase.id, phrase.key, :es, 'whyo helloo newword1
|
223
|
+
phrase.id, phrase.key, :es, 'whyo helloo newword1 newword3', user_id_second, do_xss_check, allow_verification)
|
213
224
|
response.should include(
|
214
225
|
:status => 'success', :message => 'Translation marked as up-to-date.')
|
215
226
|
|
216
227
|
translation = phrase.latest_translation(:es)
|
217
|
-
translation.value.should == 'whyo helloo newword1
|
228
|
+
translation.value.should == 'whyo helloo newword1 newword3'
|
218
229
|
translation.source_word_count.should == 3
|
219
230
|
translation.is_verification.should == true # Because last touch was verification.
|
220
231
|
translation.source_hash.should == "2ac1a5cdad0d3ca0b0c318000c2f7378"
|
@@ -224,12 +235,12 @@ describe Air18n::PhraseTranslation do
|
|
224
235
|
phrase.save!
|
225
236
|
|
226
237
|
response = Air18n::PhraseTranslation.create_translation(
|
227
|
-
phrase.id, phrase.key, :es, 'whyo helloo newword1
|
238
|
+
phrase.id, phrase.key, :es, 'whyo helloo newword1 newword3', user_id_first, do_xss_check, allow_verification)
|
228
239
|
response.should include(
|
229
240
|
:status => 'success', :message => 'Translation verified.')
|
230
241
|
|
231
242
|
translation = phrase.latest_translation(:es)
|
232
|
-
translation.value.should == 'whyo helloo newword1
|
243
|
+
translation.value.should == 'whyo helloo newword1 newword3'
|
233
244
|
translation.source_word_count.should == 5
|
234
245
|
translation.is_verification.should == true
|
235
246
|
translation.source_hash.should == "9fd16f4422eadae1c159d60ba063405f"
|
@@ -618,6 +629,25 @@ describe Air18n::PhraseTranslation do
|
|
618
629
|
words_translated.should == 1 # 3 / 17 * 5 = 0.88, ceils to 1
|
619
630
|
words_verified.should == 4
|
620
631
|
|
632
|
+
# Example from Chinese translators wondering if word count computation
|
633
|
+
# is fair.
|
634
|
+
pair = {
|
635
|
+
:translation=>"Airbnb是一個值得信賴的社區市場,在這里人們可以發布、尋找和預訂來自全球各地的獨特住所。",
|
636
|
+
:previous_translation=>"Airbnb的是市場的人列表中,發現一個值得信任的社區,和世界各地的本書獨特的住宿",
|
637
|
+
:was_stale=>false,
|
638
|
+
:locale=>"zh",
|
639
|
+
:user_id=>5,
|
640
|
+
:previous_user_id=>6,
|
641
|
+
:datetime=>Date.new(2012, 11, 04),
|
642
|
+
:source_word_count=>Air18n::PhraseTranslation.segment(
|
643
|
+
"Airbnb is a trusted community marketplace for people to list, " +
|
644
|
+
"discover, and book unique accommodations around the world").size,
|
645
|
+
:phrase_key=>'Airbnb is sick'
|
646
|
+
}
|
647
|
+
words_translated, words_verified = Air18n::PhraseTranslation.word_counts_from_translation_pair(pair)
|
648
|
+
words_translated.should == 11
|
649
|
+
words_verified.should == 7
|
650
|
+
|
621
651
|
# Test that Greek works. There was once a bug where word segmentation
|
622
652
|
# didn't work for non-Latin alphabets.
|
623
653
|
pair = {
|
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.40
|
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: 2012-11-
|
16
|
+
date: 2012-11-27 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: i18n
|