-
-
Notifications
You must be signed in to change notification settings - Fork 167
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
Hide rel="alternative" xreflang if only one language exists #474
Conversation
src/language.py
Outdated
@@ -18,22 +18,25 @@ def __repr__(self): | |||
|
|||
@property | |||
def lang_attribute(self): | |||
# Returns the language attribute (eg "en-US") to be used in HTML. | |||
return '%s-%s' % (self._lang_code, self._region_code) | |||
# Returns the language attribute (eg "en" or "en-US") to be used in HTML. |
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 keep the region in the Language
instantiation but since we only want to remove it from the lang
attribute we can simplify this method to only return the lang_code
:
return self._lang_code
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.
To be clear you mean on the last line, like this?:
def lang_attribute(self):
# Returns the language attribute (eg "en" or "en-US") to be used in HTML.
if (self._region_code):
return '%s-%s' % (self._lang_code, self._region_code)
return self._lang_code
I do wonder if we should just rip out any references to region
completely from this file?
If you want a new region, could just set up a new language called 'en-US' for example, cause the current chapter folder structure doesn't support regions so, it would basically need to be set up as a language anyway to work.
So why bother having regions at all?
WDYT?
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.
Sent you #482 with my suggestions. If it LGTY we can merge it into this PR.
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 accepted that and then updated the comments to explain why we have two functions the same.
Also did a slight change:
return '%s' % (self._lang_code)
to
return self._lang_code
Merge away if happy!
Images automagically compressed by Calibre's image-actions ✨ Compression reduced images by 38.3%, saving 42.75 KB
Some images were already optimised
|
Images automagically compressed by Calibre's image-actions ✨ Compression reduced images by 38.3%, saving 42.75 KB
Some images were already optimised
|
As discussed here: #286 (comment)