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
Do not hardcode locale unless certainly necessary #6791
Conversation
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.
As a non-english native, I can only approve this 😄
This was added in #6509. Was it necessary for something, or just boilerplate that got included? |
/cc @alextsui05 |
It's required. |
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.
(removed by maintainer)
So removing this default could lead to problems if plugins expect it to be there? |
Sorry, I wrote that line when adding latin mode and the situation is as ashmaroli says. I don't think there's any particular need other than to clear the error, and this PR looks good to limit setting it only where it's necessary. |
@pathawks Since this default was just added in Ideally, we'd release this as a backport in |
If there were enough bug fixes to merit a |
I believe all other reported bugs have been fixed as part of |
@@ -203,7 +203,10 @@ def slugify(string, mode: nil, cased: false) | |||
end | |||
|
|||
# Drop accent marks from latin characters. Everything else turns to ? | |||
string = ::I18n.transliterate(string) if mode == "latin" | |||
if mode == "latin" | |||
I18n.config.available_locales = :en if I18n.config.available_locales.empty? |
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.
Should we set available_locales
to an array ([:en]
) instead?
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 don't think its necessary.
If you were to add a print I18n.config.available_locales
immediately after this line, the output would return [:en]
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.
👍 Thanks for checking!
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.
This code only gets run if mode
is set to latin
. If it's not you break everyone else's code by removing I18n.config.available_locales = :en
from jekyll module which is exactly what happened to me.
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.
@milosgajdos83 I18n.config.available_locales = :en
was specifically added to the Jekyll
module for the sole use in the slugify
filter.
Please open a new separate issue for better tracking..
@jekyllbot: merge +bug |
Fixes #6669
We shouldn't be hardcoding locales unnecessarily