Refactor #3061
closed
Remove copied code from gettext debug helper class
Added by Lukas Zapletal over 11 years ago.
Updated almost 11 years ago.
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.
- Target version deleted (
1.4.0)
- Target version set to 1.10.0
- 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.
- 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