Do not store missing translations in DB

When visiting http://localhost:3000/admin/site_customization/information_texts?locale=fr
and creating a translation, other languages where storing translations in db with
the following values:
"<span class=\"translation_missing\" title=\"translation missing: es.debates.index.search_results.one\">One</span>">

With this commit we are not storing this translations

Note that this only happened when using a param[:locale] in the url at least for french
This commit is contained in:
rgarcia
2018-07-27 03:19:01 +02:00
committed by Angel Perez
parent 4c8b174274
commit ea4f079588

View File

@@ -15,7 +15,7 @@ class Admin::SiteCustomization::InformationTextsController < Admin::SiteCustomiz
values.each do |key, value|
locale = key.split("_").last
if value == t(content[:id], locale: locale)
if value == t(content[:id], locale: locale) || value.match(/translation missing/)
next
else
text = I18nContent.find_or_create_by(key: content[:id])