Skip to content

Commit

Permalink
Fallback to english translation for empty strings (#9974)
Browse files Browse the repository at this point in the history
* Fallback to english translation for empty strings

* Adding spaces

* Adding spaces 2

Co-authored-by: imajit <[email protected]>
  • Loading branch information
imajit and imajit authored Aug 3, 2021
1 parent 93a78b2 commit a54bf46
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,10 @@ def translation(key, options = {}, html = true)
translated_string = t(key, options)
options[:fallback] = false
translated_string2 = t(key, options)
english_translation = t(key, locale: :en)

if html && current_user&.has_tag('translation-helper') && translated_string2.include?("translation missing") && !translated_string.include?("<")
raw(%(<span>#{translated_string} <a class="translationIcon" style='display: none; padding-left: 3px;' href="https://www.transifex.com/publiclab/publiclaborg/translate/#de/$?q=text%3A#{translated_string}">
if html && current_user&.has_tag('translation-helper') && (translated_string2.include?("translation missing") || translated_string === "") && !translated_string.include?("<")
raw(%(<span>#{english_translation} <a class="translationIcon" style='display: none; padding-left: 3px;' href="https://www.transifex.com/publiclab/publiclaborg/translate/#de/$?q=text%3A#{translated_string}">
<i data-toggle='tooltip' data-placement='top' title='Needs translation? Click to help translate the text \" #{translated_string} \" .' style='position:relative; right:2px; color:#bbb; font-size: 15px;' class='fa fa-globe'></i></a>
</span>))
else
Expand Down

0 comments on commit a54bf46

Please sign in to comment.