about summary refs log tree commit diff
path: root/app/lib
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-10-05 21:48:25 +0200
committerThibaut Girka <thib@sitedethib.com>2018-10-05 21:48:25 +0200
commit98bb6815a774d6101cb0c6c909b4dba7599f2ef8 (patch)
treea6083a4b16dfffcb49ed787a719ddcdb4741cc49 /app/lib
parentc6e4c489425bd3b66a07d37f39e1678d69226fa8 (diff)
parent144d73730de38da84d605f876157bc9bd45c25b4 (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Diffstat (limited to 'app/lib')
-rw-r--r--app/lib/language_detector.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/lib/language_detector.rb b/app/lib/language_detector.rb
index 688d21fd8..58c8e2069 100644
--- a/app/lib/language_detector.rb
+++ b/app/lib/language_detector.rb
@@ -12,6 +12,7 @@ class LanguageDetector
   def detect(text, account)
     input_text = prepare_text(text)
     return if input_text.blank?
+
     detect_language_code(input_text) || default_locale(account)
   end
 
@@ -33,6 +34,7 @@ class LanguageDetector
 
   def detect_language_code(text)
     return if unreliable_input?(text)
+
     result = @identifier.find_language(text)
     iso6391(result.language.to_s).to_sym if result.reliable?
   end
@@ -75,6 +77,6 @@ class LanguageDetector
   end
 
   def default_locale(account)
-    account.user_locale&.to_sym || I18n.default_locale
+    return account.user_locale&.to_sym || I18n.default_locale if account.local?
   end
 end