Skip to content

Conversation

@nattsw
Copy link
Contributor

@nattsw nattsw commented Feb 26, 2025

This is a refactor to prepare for a fix, so that the fix PR is less messy. Related comment here: #215 (comment)

Comment on lines -26 to -30
return false if post.locale_matches?(I18n.locale)
return false if post.translation_for(I18n.locale).present?
true
post.translation_for(I18n.locale).nil?
else
return false if post.locale_matches?(I18n.locale)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Basically the only real change is the common condition is brought up top.

return false if post.locale_matches?(I18n.locale)
return false if post.translation_for(I18n.locale).present?
true
post.translation_for(I18n.locale).nil?
Copy link
Contributor

Choose a reason for hiding this comment

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

was going to say .blank? is the direct complement of .present? but I guess there's enough safeguards against this being something like empty string? (I see the presence: true validation for translation)

@nattsw nattsw merged commit 01744ed into main Feb 26, 2025
5 checks passed
@nattsw nattsw deleted the simplify-can-translate branch February 26, 2025 08:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants