Skip to content

Commit

Permalink
Merge pull request #113 from Omikhleia/fix-abbr-lang
Browse files Browse the repository at this point in the history
fix: Package abbr uses the language code only, not a full BCP47 tag
  • Loading branch information
Omikhleia authored Dec 31, 2024
2 parents 17aba98 + 763ef8e commit 94b045f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/resilient/abbr/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ function package:registerCommands ()

self:registerCommand("abbr:no", function (_, content)
local lang = SILE.settings:get("document.language")
if SILE.Commands["abbr:no:"..lang] then
-- We only need the language code, so truncate any BCP-47 tag
lang = lang:match("([^%-_]+)")
if lang and SILE.Commands["abbr:no:"..lang] then
SILE.call("abbr:no:"..lang, {}, content)
else
SU.warn("Language not supported for abbr:no, fallback to English")
Expand All @@ -62,7 +64,9 @@ function package:registerCommands ()

self:registerCommand("abbr:nos", function (_, content)
local lang = SILE.settings:get("document.language")
if SILE.Commands["abbr:nos:"..lang] then
-- We only need the language code, so truncate any BCP-47 tag
lang = lang:match("([^%-_]+)")
if lang and SILE.Commands["abbr:nos:"..lang] then
SILE.call("abbr:nos:"..lang, {}, content)
else
SU.warn("Language not supported for abbr:nos, fallback to English")
Expand Down

0 comments on commit 94b045f

Please sign in to comment.