-
Notifications
You must be signed in to change notification settings - Fork 993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #36574 - Update fast_gettext to ~> 2.1 #9770
Conversation
505d278
to
1252a16
Compare
I needed to avoid translating during startup because it led to infinite recursion. #9771 is that PR and included here. |
There's another case here: foreman/app/models/operatingsystem.rb Line 82 in df3a0b0
The human method is here: I'll dig a bit deeper. |
1252a16
to
f9380a7
Compare
Glad to see this getting tackled, for both Ruby / Rails reasons and to fix a conflict we've had in packaging for a while now:
|
5eb9e7a
to
3c54db7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ekohl, I think I found why we're not compatible with the new version of library: grosser/fast_gettext@v1.8.0...v2.0.0#diff-8798cc5941a4b48c4af929b84b9f804cbaca42547d48dc66471f7e0c4e12d1cf (lib/fast_gettext/translation.rb)
I suggest to update few things: ofedoren@eb42a44
That's not the best or prettiest way, but the logic is kinda in this. Similar changes would be needed for Foreman::Gettext::Debug
as well.
Thanks. Given the trace of the infinite loop I saw it makes sense. I'll see about giving it a spin. If that works, then I can also drop the 36757 commits from this PR. They'll still be good, but no longer a blocker to this PR. |
3c54db7
to
43ea6a3
Compare
# include this module to translate in all domains by default | ||
module Foreman | ||
module Gettext | ||
module AllDomains | ||
class Localizator | ||
prepend FastGettext::TranslationMultidomain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to use include
here and then it crashes. I also had the impression this file was loaded twice. At least debug
appears to be:
/home/ekohl/dev/foreman/lib/foreman/gettext/debug.rb:7: warning: already initialized constant Foreman::Gettext::Debug::DL
/home/ekohl/dev/foreman/lib/foreman/gettext/debug.rb:7: warning: previous definition of DL was here
/home/ekohl/dev/foreman/lib/foreman/gettext/debug.rb:8: warning: already initialized constant Foreman::Gettext::Debug::DR
/home/ekohl/dev/foreman/lib/foreman/gettext/debug.rb:8: warning: previous definition of DR was here
So perhaps that's related to the infinite recursion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, when I was checking (not debug
version), I've noticed that due to changes in the library, we ended up calling our _()
method instead of the lib's one due to including
stuff wrongly. I don't think double loading has something to do with the recursion. Might be wrong though...
43ea6a3
to
63e931d
Compare
In theory this is now ready, but I'd like to postpone this until after branching. |
63e931d
to
c04d773
Compare
We've branched twice. Let's get this in. |
@ekohl, could you please fix rubocop failures? So we can see if the tests are passing at least. |
The code defines an additional method on Fastgettext but there's no reason to do so. It can just as well define a method on itself.
c04d773
to
c8f67ae
Compare
Updated, but didn't have time to test this myself. I'll check back what CI says after lunch. |
Everything seems to be green, except that it cannot be built for some reason :/ |
Yeah, RPM will fail as it has no 2.1 package yet.
|
Let's see: theforeman/foreman-packaging#10515 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Packaging ACK
@ofedoren can I get an ACK on the code? I have not the slightest idea about gettext :/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have not the slightest idea about gettext :/
Me neither :/ But looks correct, tests are green, the app is booting and the translations are working, so I'd say GTG. Haven't tested on Ruby 2.7 though.
No description provided.