Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Package abbr uses the language code only, not a full BCP47 tag #113

Merged
merged 1 commit into from
Dec 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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