プロジェクト

全般

プロフィール

Vote #80499

完了

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

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Time tracking_13
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
13
version_id:
157
issue_org_id:
32500
author_id:
188597
assigned_to_id:
332
comments:
5
status_id:
5
tracker_id:
1
plus1:
0
affected_version:
closed_on:
affected_version_id:
153
ステータス-->[Closed]

説明

To reproduce the error:

Create a spent time's custom field (list format) with two values. In this example it was named Perfil, with values Perfil1 and Perfil2

Log some time, with different Perfil values.

Go to Spent Time > Report

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:

!error.translation-missing.timelog.csv.png!

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

journals

--------------------------------------------------------------------------------
Changed method @l@ to @l_or_humanize@ . I attached a patch.

<pre><code class="diff">
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
</code></pre>
--------------------------------------------------------------------------------
I have confirmed that the patch fixes the issue.

Setting the target version to 4.0.6.
--------------------------------------------------------------------------------
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.
--------------------------------------------------------------------------------
Committed the fix. Thank you all for your contribution.
--------------------------------------------------------------------------------

Admin Redmine さんが3年以上前に更新

  • カテゴリTime tracking_13 にセット
  • 対象バージョン4.0.6_157 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0