Skip to content
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 #36839 - Optimize apipie-dsl translate method #9866

Merged

Conversation

ekohl
Copy link
Member

@ekohl ekohl commented Oct 17, 2023

No description provided.

@ekohl ekohl force-pushed the 36839-optimize-apipie-dsl-translate branch from 164f47d to ec40f41 Compare October 18, 2023 15:11
@ekohl
Copy link
Member Author

ekohl commented Oct 18, 2023

[test katello]

ofedoren
ofedoren previously approved these changes Oct 19, 2023
Copy link
Member

@ofedoren ofedoren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @ekohl, seems right, didn't test though yet.

Should we do the same for apipie-rails translate method?

@ekohl ekohl force-pushed the 36839-optimize-apipie-dsl-translate branch from ec40f41 to 30116da Compare October 19, 2023 19:59
@ekohl
Copy link
Member Author

ekohl commented Oct 19, 2023

I didn't test it either, but how about this?

ofedoren
ofedoren previously approved these changes Oct 19, 2023
Copy link
Member

@ofedoren ofedoren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks much cleaner, thanks!

AFAIU, with_locale is proper (recommended) way instead of reseting with set_locale, so functional-wise it should be the same.

FastGettext.set_locale(old_loc)
trans
end
config.translate = ->(stc, loc) { str ? FastGettext.with_locale(loc) { _(str) } : nil }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
config.translate = ->(stc, loc) { str ? FastGettext.with_locale(loc) { _(str) } : nil }
config.translate = ->(str, loc) { str ? FastGettext.with_locale(loc) { _(str) } : nil }

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Argh, I had that fixed on my laptop, then rebased on my desktop where I made the mistake in the first place ...

@ekohl ekohl force-pushed the 36839-optimize-apipie-dsl-translate branch from 30116da to 422ab27 Compare October 20, 2023 01:42
@ofedoren
Copy link
Member

I don't think Katello failures are related, but just in case...

[test katello]

Copy link
Member

@ofedoren ofedoren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @ekohl, merging.

@ofedoren ofedoren merged commit b8e2e05 into theforeman:develop Oct 20, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants