diff options
author | Florian Fischer <gitlab@muhq.space> | 2023-02-21 07:55:49 +0000 |
---|---|---|
committer | Florian Fischer <gitlab@muhq.space> | 2023-02-21 07:55:49 +0000 |
commit | 40f20dfde4a5702b0b02b2d89ad746a93d851c27 (patch) | |
tree | db452ac30c5c6dc9ba9d1a826b1f6e2627e3689e /spellcheck.lua | |
parent | 807e77ed35600753bea8d943d65c0a6be4b9e1f0 (diff) | |
parent | e26067aae38ec7a98845b31b8324325384532cc0 (diff) | |
download | vis-spellcheck-40f20dfde4a5702b0b02b2d89ad746a93d851c27.tar.gz |
Merge branch 'master' into 'master'
Sanitize LANG environment variable
See merge request muhq/vis-spellcheck!10
Diffstat (limited to 'spellcheck.lua')
-rw-r--r-- | spellcheck.lua | 5 |
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 |