Project

General

Profile

Refactor #3061

Remove copied code from gettext debug helper class

Added by Lukas Zapletal over 9 years ago. Updated over 9 years ago.

Status:
Rejected
Priority:
Low
Category:
-
Target version:
-
Difficulty:
Triaged:
No
Bugzilla link:
Pull request:
Fixed in Releases:
Found in Releases:
Red Hat JIRA:

Description

The Foreman::Gettext::Debug uses slightly modified versions of D_* methods from fast_gettext 0.8+.

I would like to enable return blocks on these methods so we are able to refactor these into nice code again.


Related issues

Related to Foreman - Feature #2942: Plugin i18n supportClosed2013-08-16

History

#1 Updated by Dominic Cleal over 9 years ago

#2 Updated by Greg Sutcliffe over 9 years ago

  • Target version deleted (1.4.0)

#3 Updated by Anonymous over 9 years ago

  • Target version set to 1.10.0

#4 Updated by Lukas Zapletal over 9 years ago

  • Target version deleted (1.10.0)

Okay the thing is - I plan to add block support for D_ methods upstream, then we can remove duplicated code in Foreman.

Please do not put this on Sprint until let's say 20, I will need to work upstream first.

#5 Updated by Lukas Zapletal over 9 years ago

  • Status changed from New to Rejected

I wonder if this is worth the effort, these are three methods on three lines, it's only used in gettext debug (mark_translated). Upstream, passing block can cause issues because the multi domain version needs to call it twice - could cause side effects and comparsion could we wrong for some values (e.g. new instance returned).

    def D_(key)
      FastGettext.translation_repositories.each_key do |domain|
        result = FastGettext::TranslationMultidomain.d_(domain, key) {nil}
        return result unless result.nil?
      end
      key
    end

In the current upstream code safe value (nil) is used. I am closing this one.

Also available in: Atom PDF