Project

General

Profile

Bug #2588

LDAP auth sources form labels not translated due to STI

Added by Dominic Cleal almost 6 years ago. Updated almost 6 years ago.

Status:
Closed
Priority:
Normal
Category:
Internationalization
Target version:
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Team Backlog:
Fixed in Releases:
Found in Releases:

Description

When adding a new LDAP authentication source, none of the form labels have been translated. The field method in layout_helper calls s_() on the gettext Model|Field string, but this doesn't work well with STI, returning the subclass name while the translation extraction uses the base STI class name.

    122:   content_tag :div, :class => "control-group #{fluid ? "row-fluid" : ""} #{error.empty? ? "" : 'error'}" do
 => 123:     binding.pry
    124:     label   = options.delete(:label)
    125:     label ||= (f.object.class.respond_to?(:gettext_translation_for_attribute_name) &&
    126:                 s_(f.object.class.gettext_translation_for_attribute_name attr)) if f

[3] pry(#<#<Class:0x007f97e985cd60>>)> f.object.class.gettext_translation_for_attribute_name attr
=> "AuthSourceLdap|Tls" 

While the model attributes file is based off of the schema which doesn't have STI subclass names:

$ grep AuthSource locale/model_attributes.rb  | tail -3
_('AuthSource|Onthefly register')
_('AuthSource|Port')
_('AuthSource|Tls')

Related issues

Related to Foreman - Bug #2596: Upgrade to the new version of gettext_i18n_railsClosed2013-05-31

Associated revisions

Revision 2e1e6f71 (diff)
Added by Dmitri Dolguikh almost 6 years ago

fixes #2588 - table name used for localization is being determined correctly now for sti classes.

Revision b08d7e45 (diff)
Added by Dmitri Dolguikh almost 6 years ago

fixes #2588 - fixed regression introduced earlier: localization works for non-AR classes too now

Revision 90782aa1 (diff)
Added by Dmitri Dolguikh almost 6 years ago

fixes #2588 - fixed regression introduced earlier: localization works for non-AR classes too now
(cherry picked from commit b08d7e45fbdea5f80fad5254e70d8b2004c05e36)

Revision afe08f7c (diff)
Added by Dmitri Dolguikh almost 6 years ago

fixes #2588 - table name used for localization is being determined correctly now for sti classes.
(cherry picked from commit 2e1e6f713d49ef6f5274d798f8882faa2579f680)

History

#1 Updated by Dmitri Dolguikh almost 6 years ago

  • Assignee set to Dmitri Dolguikh

#3 Updated by Dmitri Dolguikh almost 6 years ago

  • Status changed from New to Ready For Testing

#4 Updated by Anonymous almost 6 years ago

  • Status changed from Ready For Testing to Closed
  • % Done changed from 0 to 100

Also available in: Atom PDF