Add language detection (#1772)
* Add language detection via WhatLanguage and (de)serialization of it through Atom * Fix default language in ProcessFeedService * Re-add newline before 'react-rails' Gem to fix groupings Fixes Code Climate issue
This commit is contained in:
parent
6d70a80263
commit
e4af4898de
7 changed files with 23 additions and 4 deletions
|
@ -19,6 +19,7 @@ class PostStatusService < BaseService
|
|||
sensitive: options[:sensitive],
|
||||
spoiler_text: options[:spoiler_text] || '',
|
||||
visibility: options[:visibility],
|
||||
language: detect_language(text),
|
||||
application: options[:application])
|
||||
|
||||
attach_media(status, media)
|
||||
|
@ -51,6 +52,10 @@ class PostStatusService < BaseService
|
|||
media.update(status_id: status.id)
|
||||
end
|
||||
|
||||
def detect_language(text)
|
||||
WhatLanguage.new(:all).language_iso(text)
|
||||
end
|
||||
|
||||
def process_mentions_service
|
||||
@process_mentions_service ||= ProcessMentionsService.new
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue