You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by ss...@apache.org on 2025/09/02 12:38:11 UTC

(xmlgraphics-fop) branch main updated: FOP-3270: Country specific hyphenation file not found

This is an automated email from the ASF dual-hosted git repository.

ssteiner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/xmlgraphics-fop.git


The following commit(s) were added to refs/heads/main by this push:
     new aed8a7212 FOP-3270: Country specific hyphenation file not found
aed8a7212 is described below

commit aed8a7212d6ff4465f67c727143a2e5fd6065b47
Author: Simon Steiner <ss...@apache.org>
AuthorDate: Tue Sep 2 13:37:39 2025 +0100

    FOP-3270: Country specific hyphenation file not found
---
 .../org/apache/fop/hyphenation/HyphenationTreeCache.java    |  1 -
 .../src/test/java/org/apache/fop/HyphenationTestCase.java   | 13 +++++++++++++
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/fop-core/src/main/java/org/apache/fop/hyphenation/HyphenationTreeCache.java b/fop-core/src/main/java/org/apache/fop/hyphenation/HyphenationTreeCache.java
index ec16810b3..1c89336bc 100644
--- a/fop-core/src/main/java/org/apache/fop/hyphenation/HyphenationTreeCache.java
+++ b/fop-core/src/main/java/org/apache/fop/hyphenation/HyphenationTreeCache.java
@@ -79,7 +79,6 @@ public class HyphenationTreeCache {
         String userKey = null;
         if (hyphPatNames != null) {
             String key = constructLlccKey(lang, country);
-            key = key.replace('_', '-');
             userKey = (String) hyphPatNames.get(key);
         }
         return userKey;
diff --git a/fop-core/src/test/java/org/apache/fop/HyphenationTestCase.java b/fop-core/src/test/java/org/apache/fop/HyphenationTestCase.java
index 818e269be..87ea7d4c1 100644
--- a/fop-core/src/test/java/org/apache/fop/HyphenationTestCase.java
+++ b/fop-core/src/test/java/org/apache/fop/HyphenationTestCase.java
@@ -23,6 +23,8 @@ import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.ObjectOutputStream;
+import java.util.HashMap;
+import java.util.Map;
 
 import org.junit.Test;
 
@@ -99,4 +101,15 @@ public class HyphenationTestCase {
         frxml.delete();
         f.delete();
     }
+
+    @Test
+    public void testHyphenatorCountry() {
+        Map<String, String> hyphPatNames = new HashMap<>();
+        hyphPatNames.put("de_CH", "test/resources/fop/fr.xml" + Hyphenator.XMLTYPE);
+        InternalResourceResolver resourceResolver = ResourceResolverFactory.createDefaultInternalResourceResolver(
+                new File(".").toURI());
+        Hyphenation hyph = Hyphenator.hyphenate("de", "CH", resourceResolver, hyphPatNames,
+                "hello", 0, 0, fopFactory.newFOUserAgent());
+        assertEquals(hyph.toString(), "-hel-lo");
+    }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org