Defect #32500

Spent time report csv shows translation missing text if custom fields are involved

Added by Guillermo ML 2 months ago. Updated about 1 month ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:Go MAEDA% Done:

0%

Category:Time tracking
Target version:4.0.6
Resolution:Fixed Affected version:4.0.5

Description

To reproduce the error:
  1. Create a spent time's custom field (list format) with two values. In this example it was named Perfil, with values Perfil1 and Perfil2
  2. Log some time, with different Perfil values.
  3. Go to Spent Time > Report
  4. Group by custom field Perfil

The report on the page looks fine, but if you export it using the CSV link it shows a translation missing: en.Perfil message at first column, first row:

If you choose another language the message will change accordingly: translation missing: es.Perfil, translation missing: gl.Perfil, etc...

My environment:

Environment:
  Redmine version                4.0.5.stable
  Ruby version                   2.5.7-p206 (2019-10-01) [x86_64-linux]
  Rails version                  5.2.3
  Environment                    production
  Database adapter               Mysql2
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                smtp
SCM:
  Subversion                     1.12.2
  Cvs                            1.12.13
  Git                            2.19.1
  Filesystem                     
Redmine plugins:
  no plugin installed

error.translation-missing.timelog.csv.png (37.8 KB) Guillermo ML, 2019-11-21 17:43

fix-32500.patch Magnifier (1.53 KB) Yuichi HARADA, 2019-12-05 08:01

Associated revisions

Revision 19341
Added by Go MAEDA about 1 month ago

Fix that spent time report CSV shows translation missing text if custom fields are involved (#32500).

Patch by Yuichi HARADA.

Revision 19342
Added by Go MAEDA about 1 month ago

Merged r19341 from trunk to 4.1-stable (#32500).

Revision 19343
Added by Go MAEDA about 1 month ago

Merged r19341 from trunk to 4.0-stable (#32500).

History

#1 Updated by Go MAEDA about 1 month ago

  • Status changed from New to Confirmed

#2 Updated by Yuichi HARADA about 1 month ago

Changed method l to l_or_humanize . I attached a patch.

diff --git a/app/helpers/timelog_helper.rb b/app/helpers/timelog_helper.rb
index 019b441a0..2c3e500a5 100644
--- a/app/helpers/timelog_helper.rb
+++ b/app/helpers/timelog_helper.rb
@@ -79,7 +79,7 @@ module TimelogHelper
   def report_to_csv(report)
     Redmine::Export::CSV.generate(:encoding => params[:encoding]) do |csv|
       # Column headers
-      headers = report.criteria.collect {|criteria| l(report.available_criteria[criteria][:label]) }
+      headers = report.criteria.collect {|criteria| l_or_humanize(report.available_criteria[criteria][:label]) }
       headers += report.periods
       headers << l(:label_total_time)
       csv << headers

#3 Updated by Go MAEDA about 1 month ago

  • Category changed from Custom fields to Time tracking
  • Target version set to 4.0.6

I have confirmed that the patch fixes the issue.

Setting the target version to 4.0.6.

#4 Updated by Guillermo ML about 1 month ago

Go MAEDA wrote:

I have confirmed that the patch fixes the issue.

The patch also worked for us. Now it shows Perfil instead of translation missing: en.Perfil. CSV output is the same as html.
Many thanks to Yuichi HARADA and Go MAEDA.

#5 Updated by Go MAEDA about 1 month ago

  • Status changed from Confirmed to Closed
  • Assignee set to Go MAEDA
  • Resolution set to Fixed

Committed the fix. Thank you all for your contribution.

Also available in: Atom PDF