-
-
Notifications
You must be signed in to change notification settings - Fork 102
Add filter for languages with ll_CC description #133
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
Conversation
tldr.py
Outdated
os.environ.get( | ||
'LANG', | ||
'C' | ||
).split('.')[0]) |
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.
Does anyone know how to apply this filter with chain notation for a nicer syntax like
.split('.')[0].apply(filter_languages)
?
Couldn't find a solution with a quick search.
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.
Let's move the .split('.')[0]
step into filter_languages
as its first line, given we're doing a similar step below, and it would be good to condense it to one place, and would allow simplifying the double map below into a singular one.
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.
Sure, that makes sense.
tldr.py
Outdated
os.environ.get( | ||
'LANG', | ||
'C' | ||
).split('.')[0]) |
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.
Let's move the .split('.')[0]
step into filter_languages
as its first line, given we're doing a similar step below, and it would be good to condense it to one place, and would allow simplifying the double map below into a singular one.
tldr.py
Outdated
'C' | ||
).split('_')[0] | ||
|
||
def filter_languages(lang): |
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'm not a fan of this name as it feels like what you might think it does from the name (given a list of languages, filter it down) is not the same as what it actually does (given a language, rewrite it to appropriate form). get_language_code(language)
or get_tldr_language_code(language)
maybe?
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.
Ok, for me a filter is something which modifies or removes an input and outputs the result, but I see your point.
Thanks for this! Sorry for taking a bit to review, some minor comments, but definitely an improvement on the state of things! |
1ce5d5f
to
b526ebe
Compare
No Problem. I noticed, open source can take it's time, since it's freetime for most of us. Thanks for the review. |
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 again for your contributions!
Thanks for merging! |
Implementing the proposed solution in #125