Remove language detection through cld3 (#17478)
* Remove language detection through cld3 * Update app/helpers/languages_helper.rb Co-authored-by: Yamagishi Kazutoshi <ykzts@desire.sh> Co-authored-by: Yamagishi Kazutoshi <ykzts@desire.sh>
This commit is contained in:
parent
85b86fe28c
commit
b6d7726ecb
16 changed files with 238 additions and 348 deletions
|
@ -2,6 +2,7 @@
|
|||
|
||||
class LinkDetailsExtractor
|
||||
include ActionView::Helpers::TagHelper
|
||||
include LanguagesHelper
|
||||
|
||||
# Some publications wrap their JSON-LD data in their <script> tags
|
||||
# in commented-out CDATA blocks, they need to be removed before
|
||||
|
@ -218,14 +219,6 @@ class LinkDetailsExtractor
|
|||
nil
|
||||
end
|
||||
|
||||
def valid_locale_or_nil(str)
|
||||
return nil if str.blank?
|
||||
|
||||
code, = str.split(/_-/) # Strip out the region from e.g. en_US or ja-JA
|
||||
locale = ISO_639.find(code)
|
||||
locale&.alpha2
|
||||
end
|
||||
|
||||
def link_tag(name)
|
||||
document.xpath("//link[@rel=\"#{name}\"]").map { |link| link['href'] }.first
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue