0
最後我能上手回報率的I18n的翻譯。RoR的驗證錯誤的翻譯得到titelized
我很難翻譯,顯示了當有填表過程中出現錯誤ActiveRecord的驗證錯誤。
雖然翻譯是OK,消息顯示titelized,例如:
* Parol Va Tasdig'i Bo'sh Bo'lishi Mumkin Emas
* Ism Uzun (Ko'pi Bilan 50 Belgi)
* Email Manzil Xato Kiritilgan
有什麼辦法來「利用」這些消息?因此,它應該是這樣的:
* Parol tasdig'i bo'sh bo'lishi mumkin emas
作爲一個說明,我懷疑是我做的方式有一些缺陷,比如,這是上述消息的HTML輸出:
<li>* <span class="translation_missing" title="translation missing: uzlt.Parol va tasdig'i bo'sh bo'lishi mumkin emas">Parol Va Tasdig'i Bo'sh Bo'lishi Mumkin Emas</span></li><li>* <span class="translation_missing" title="translation missing: uzlt.Ism uzun (ko'pi bilan 50 belgi)">Ism Uzun (Ko'pi Bilan 50 Belgi)</span></li><li>* <span class="translation_missing" title="translation missing: uzlt.Email manzil xato kiritilgan">Email Manzil Xato Kiritilgan</span></li>
<li>* <span class="translation_missing" title="translation missing: uzlt.Parol bo'sh bo'lishi mumkin emas">Parol Bo'sh Bo'lishi Mumkin Emas</span></li><li>* <span class="translation_missing" title="translation missing: uzlt.Parol qisqa (minimum 6 belgi)">Parol Qisqa (Minimum 6 Belgi)</span></li><li>* <span class="translation_missing" title="translation missing: uzlt.Parol tasdig'i bo'sh bo'lishi mumkin emas">Parol Tasdig'i Bo'sh Bo'lishi Mumkin Emas</span></li>
如您所見,有一些translation_missing字符串那裏。
以下是輸出消息件修身:
1 - if object.errors.any?
2 #error_explanation
3 .alert.alert-error
4 #{object.errors.count} dona xato mavjud
5 ul
6 - object.errors.full_messages.each do |msg|
7 li * #{t(msg)}
8 end
9 end
當我詢問了味精的對象類型,它給我的ActiveSupport :: SafeBuffer名。
再次感謝您提前!