ChiliProject is not maintained anymore. Please be advised that there will be no more updates.

We do not recommend that you setup new ChiliProject instances and we urge all existing users to migrate their data to a maintained system, e.g. Redmine. We will provide a migration script later. In the meantime, you can use the instructions by Christian Daehn.

Don't hardcode user viewable labels (like "Path to .git repository") (Bug #209)


Added by Holger Just at 2011-02-19 09:15 am. Updated at 2011-03-19 02:41 pm.


Status:Closed Start date:2011-02-19
Priority:Normal Due date:
Assignee:Felix Schäfer % Done:

0%

Category:SCM
Target version:1.2.0
Remote issue URL: Affected version:

Description

The repository helper has hardcoded English labels which are shown in the repository creation view in the project's settings. These should be replaced by i18n strings.

These strings are used in almost all *:_field_tags methods in the repository_helper: source:app/helpers/repository_helper.rb#L174


chili.png (20.6 kB) Toshi MARUYAMA, 2011-03-19 11:21 am

redmine.png (25.4 kB) Toshi MARUYAMA, 2011-03-19 11:21 am


Associated revisions

Revision 5fc8ff47
Added by Ivan Evtuhovich at 2011-03-18 09:08 am

Move repositories_helper labels to translation, refs #209

Revision 3377e5b5
Added by Felix Schäfer at 2011-03-19 10:57 am

Add new translation strings to all locales. #209

History

Updated by Ivan Evtuhovich at 2011-03-18 08:11 am

https://github.com/chiliproject/chiliproject/pull/28

Please review my request, i've fixed this problem

Updated by Felix Schäfer at 2011-03-18 08:42 am

First quick look: looks good, the strings are missing in all but the english and russian locale files though. There's a rake task to go through all locale files and copy the missing ones from the en locale file, remember to use it next time :-)

  • Status changed from Open to Ready for review

Updated by Eric Davis at 2011-03-18 11:57 pm

Looks good to me too. I'll merge it this weekend unless someone else does it first.

  • Target version set to 1.2.0
  • Assignee set to Eric Davis

Updated by Felix Schäfer at 2011-03-19 10:00 am

  • Assignee changed from Eric Davis to Felix Schäfer
  • Status changed from Ready for review to Closed

Updated by Felix Schäfer at 2011-03-19 10:02 am

And now I've forgotten the most important part: thanks Ivan :-)

Updated by Toshi MARUYAMA at 2011-03-19 11:21 am

Not fixed.

If repository path is empty, "URL can't be blank" shows.

chili

redmine

  • File redmine.png added
  • Status changed from Closed to Open
  • File chili.png added

Updated by Ivan Evtuhovich at 2011-03-19 12:23 pm

I think I18n brokes standard rails behavior.

I've tried to translate repository/git url attribute in a standard rails way, adding:


  activerecord:
    models:
      repository/git:
        attributes:
          url: Path to git repository

But there an error occur, when i try to save git repo with empty url:


ActionView::TemplateError (translation data {:attributes=>{:url=>"Path to git repository"}} can not be used with :count => 1) on line #6 of app/views/projects/settings/_repository.rhtml:
3:                    :builder => TabularFormBuilder,
4:                    :lang => current_language do |f| %>
5: 
6: <%= error_messages_for 'repository' %>
7: 
8: <div class="box tabular">
9: <p><%= label_tag('repository_scm', l(:label_scm)) %><%= scm_select_tag(@repository) %></p>

    /home/brun/.rvm/gems/ruby-1.8.7-p334/gems/i18n-0.4.2/lib/i18n/backend/base.rb:138:in `pluralize'
    /home/brun/.rvm/gems/ruby-1.8.7-p334/gems/i18n-0.4.2/lib/i18n/backend/base.rb:45:in `translate'
    /home/brun/.rvm/gems/ruby-1.8.7-p334/gems/i18n-0.4.2/lib/i18n/backend/fallbacks.rb:47:in `translate'
    /home/brun/.rvm/gems/ruby-1.8.7-p334/gems/i18n-0.4.2/lib/i18n/backend/fallbacks.rb:45:in `each'
    /home/brun/.rvm/gems/ruby-1.8.7-p334/gems/i18n-0.4.2/lib/i18n/backend/fallbacks.rb:45:in `translate'
    /home/brun/.rvm/gems/ruby-1.8.7-p334/gems/i18n-0.4.2/lib/i18n.rb:160:in `translate'
    config/initializers/10-patches.rb:36:in `full_messages'
    config/initializers/10-patches.rb:21:in `each'
    config/initializers/10-patches.rb:21:in `full_messages'
    config/initializers/10-patches.rb:20:in `full_messages'

And the other problem with TabularFormBuilder#label_for_field - it isn't render translated name for AR attributes.

I want some comments from you, to continue work on problem

Updated by Ivan Evtuhovich at 2011-03-19 01:06 pm

source:config/initializers/10-patches.rb#L10

1    def self.human_attribute_name(attr)
2      l("field_#{attr.to_s.gsub(/_id$/, '')}")
3    end

Therefore it translates url field in all models as a 'URL'. I think this behavior is unclear for most rails developers

Updated by Felix Schäfer at 2011-03-19 01:34 pm

Toshi MARUYAMA wrote:

Not fixed.

If repository path is empty, "URL can't be blank" shows.

Thanks for reporting, but this does not affect this issue directly, please open a new related issue for this.

Ivan Evtuhovich wrote:

I think this behavior is unclear for most rails developers

It is. We should evaluate if we want to continue to support it or if we should try to phase it out. This should go to a new issue too, though probably not the same as the one Toshi reported.

  • Status changed from Open to Closed

Updated by Ivan Evtuhovich at 2011-03-19 02:41 pm

#296, #297 - i create two separate tasks

Also available in: Atom PDF