From 6cff5138b1edbafb0303e83076a91478bab7bd79 Mon Sep 17 00:00:00 2001 From: Patrick Tang Date: Fri, 25 Oct 2024 13:26:57 -0700 Subject: [PATCH] Show appropriate language in ref in display --- .../step/core/utils/JSwordUtils.java | 17 ++++ .../step/core/service/jsword/impl/default.xsl | 91 +++++++++++++++---- 2 files changed, 88 insertions(+), 20 deletions(-) diff --git a/step-core/src/main/java/com/tyndalehouse/step/core/utils/JSwordUtils.java b/step-core/src/main/java/com/tyndalehouse/step/core/utils/JSwordUtils.java index 3aa708b98c..fe9d37bd26 100644 --- a/step-core/src/main/java/com/tyndalehouse/step/core/utils/JSwordUtils.java +++ b/step-core/src/main/java/com/tyndalehouse/step/core/utils/JSwordUtils.java @@ -8,6 +8,7 @@ import org.crosswire.jsword.book.basic.AbstractPassageBook; import org.crosswire.jsword.passage.*; import org.crosswire.jsword.versification.BibleBook; +import org.crosswire.jsword.versification.BibleNames; import org.crosswire.jsword.versification.Versification; import org.jdom2.Element; import org.jdom2.filter.ElementFilter; @@ -206,6 +207,22 @@ public static Key getSafeKey(final Versification v11n, final String reference) { } } + public static String getBookNameForLang(String bk, String lang1, String lang2){ + //if(lang.equals("ar")) { + + String bookName = bk; + String lang = lang1; + if(lang.isEmpty()) + lang = lang2; + if(!lang.isEmpty()) + bookName = BibleNames.instance().getShortBibleNameForLocale(new Locale(lang), bk); + + return bookName; + //} + //else + // return bk; + } + /** * Checks for the presence of the book first. If the book is present, then continues to check that at least 1 verse * in the scope is present. If it is, then returns true immediately. diff --git a/step-core/src/main/resources/com/tyndalehouse/step/core/service/jsword/impl/default.xsl b/step-core/src/main/resources/com/tyndalehouse/step/core/service/jsword/impl/default.xsl index fc1a9f39be..55cfb2ffa1 100644 --- a/step-core/src/main/resources/com/tyndalehouse/step/core/service/jsword/impl/default.xsl +++ b/step-core/src/main/resources/com/tyndalehouse/step/core/service/jsword/impl/default.xsl @@ -465,18 +465,19 @@ - + - - - - - - - + + + + + + + + @@ -486,15 +487,30 @@ + + + + + - + + + + + + + + + + + - + @@ -506,19 +522,54 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - () - - + + + + + + + + + + + + + () + + +