aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--spellcheck.lua5
1 files changed, 2 insertions, 3 deletions
diff --git a/spellcheck.lua b/spellcheck.lua
index 3ff757e..a8dd37d 100644
--- a/spellcheck.lua
+++ b/spellcheck.lua
@@ -1,9 +1,8 @@
-- Copyright (c) 2017-2019 Florian Fischer. All rights reserved.
-- Use of this source code is governed by a MIT license found in the LICENSE file.
local spellcheck = {}
-if os.getenv('LANG') then
- spellcheck.default_lang = os.getenv('LANG'):sub(0, 5)
-else
+spellcheck.default_lang = (os.getenv('LANG') or ''):gsub('[.].*', '')
+if not spellcheck.default_lang:match('^[a-z][a-z]_[A-Z][A-Z]$') then
spellcheck.default_lang = 'en_US'
end