Defect #35248

Hard-coded error messages in IssueStatus

Added by Kam Nazir 5 months ago. Updated 5 months ago.

Status:ConfirmedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:I18n
Target version:-
Resolution: Affected version:

Description

Untranslated hard-coded string exists in source:trunk/app/models/issue_status.rb@20897#L113

def check_integrity
  if Issue.where(:status_id => id).any?
    raise "This status is used by some issues" 
  elsif Tracker.where(:default_status_id => id).any?
    raise "This status is used as the default status by some trackers" 
  end
end

Screenshot_2021-05-18.png (37.4 KB) Go MAEDA, 2021-05-18 08:54

History

#1 Updated by salman mp 5 months ago

Also in:

models/role.rb:301:         raise "Cannot delete role" if members.any?
models/role.rb:302:         raise "Cannot delete builtin role" if builtin?
models/role.rb:311:         raise "Unable to create the #{name} role (#{role.errors.full_messages.join(',')})." if role.new_record?
models/setting.rb:330:      raise "There's no setting named #{name}" unless available_settings.has_key?(name)
models/tracker.rb:147:      raise "Cannot delete tracker" if Issue.where(:tracker_id => self.id).any?
models/query.rb:1096:       raise "Unknown #{queried_class.name} association #{assoc}" unless customized_class
models/query.rb:1310:       raise "Unknown query operator #{operator}" 
models/enumeration.rb:135:  raise "Cannot delete enumeration" if self.in_use?

#2 Updated by Holger Just 5 months ago

  • Status changed from New to Needs feedback

The descriptions of those raised exceptions generally do not show up in the user interface. They are either handled by higher layers of the code (which may then render an appropriate translated error message in the response to the user) or if unhandled result in a 500 error which also doesn't show any further information to the user.

Generally, those exception descriptions only turn up in the application logs (e..g logs/production.log. Here, it is entirely fine to only use english messages (given that the entire code and database scheme uses english).

With that being said, if you can reproduce a case where those error messages do show up in the user interface unchanged, this might be considered for a fix.

#3 Updated by Kam Nazir 5 months ago

Thank you for your reply, Holger.
This error is shown to the user when he/she try to delete a status that has been used in some issues. something like:
Unable to delete issue status (This status is used by some issues)

I reproduce the scenario and check the Redmine log. There wasn't this error in the log.

#4 Updated by Go MAEDA 5 months ago

Kam Nazir wrote:

This error is shown to the user when he/she try to delete a status that has been used in some issues. something like:
Unable to delete issue status (This status is used by some issues)

Confirmed the issue. In the screenshot below, you can see an untranslated English sentence in a Japanese error message.

Also available in: Atom PDF