about summary refs log tree commit diff
path: root/app/lib/link_details_extractor.rb
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-02-08 02:41:17 +0100
committerGitHub <noreply@github.com>2022-02-08 02:41:17 +0100
commitb6d7726ecbc833abd00f6a9d36b24d9776cfe623 (patch)
treee5d7c94933e0ee8b0b3abae97a60c7636e121b20 /app/lib/link_details_extractor.rb
parent85b86fe28c62b8c3b34de20a292b158526355ddd (diff)
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>
Diffstat (limited to 'app/lib/link_details_extractor.rb')
-rw-r--r--app/lib/link_details_extractor.rb9
1 files changed, 1 insertions, 8 deletions
diff --git a/app/lib/link_details_extractor.rb b/app/lib/link_details_extractor.rb
index d2bcf0c25..fabbd244d 100644
--- a/app/lib/link_details_extractor.rb
+++ b/app/lib/link_details_extractor.rb
@@ -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