From 75b5c9579fcaaa9531b87c161928ce6657c5a074 Mon Sep 17 00:00:00 2001
From: Robert Alessi <alessi@robertalessi.net>
Date: Sun, 25 Aug 2019 09:56:19 +0200
Subject: added babel autodetection in \lem

---
 ekdosis.dtx | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

(limited to 'ekdosis.dtx')

diff --git a/ekdosis.dtx b/ekdosis.dtx
index 8af64f2..5a585a0 100644
--- a/ekdosis.dtx
+++ b/ekdosis.dtx
@@ -360,6 +360,7 @@ Running "make install" installs the files in the local TeX tree.
 \RequirePackage{refcount}
 \RequirePackage{xspace}
 \RequirePackage[user,abspage]{zref}
+\RequirePackage{ltxcmds}
 \if@pkg@parnotes
   \RequirePackage{parnotes}
 \fi
@@ -550,13 +551,17 @@ idno={}, msName={}, origDate={}][3]{%
       \ifdefined\ekdlr@alt
         \ifdefined\ekdlr@pre%
           \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi
-        \unexpanded\expandafter{\ekdlr@alt}
+        \ltx@ifpackageloaded{babel}%
+          {{\noexpand\selectlanguage{\languagename}%
+            \unexpanded\expandafter{\ekdlr@alt}}}%
+          {\unexpanded\expandafter{\ekdlr@alt}}
         \ifdefined\ekdlr@post%
           \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi
       \else
         \ifdefined\ekdlr@pre%
           \space\unexpanded\expandafter{\ekdlr@pre}\space\else\fi
-        #2%
+          \ltx@ifpackageloaded{babel}%
+            {{\noexpand\selectlanguage{\languagename}#2}}{#2}%
         \ifdefined\ekdlr@post%
           \space\unexpanded\expandafter{\ekdlr@post}\space\else\fi
       \fi
-- 
cgit v1.2.3

