Skip to content

Commit aed8a72

Browse files
FOP-3270: Country specific hyphenation file not found
1 parent ea5d9b5 commit aed8a72

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

fop-core/src/main/java/org/apache/fop/hyphenation/HyphenationTreeCache.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,6 @@ public static String constructUserKey(String lang, String country, Map hyphPatNa
7979
String userKey = null;
8080
if (hyphPatNames != null) {
8181
String key = constructLlccKey(lang, country);
82-
key = key.replace('_', '-');
8382
userKey = (String) hyphPatNames.get(key);
8483
}
8584
return userKey;

fop-core/src/test/java/org/apache/fop/HyphenationTestCase.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@
2323
import java.io.FileOutputStream;
2424
import java.io.IOException;
2525
import java.io.ObjectOutputStream;
26+
import java.util.HashMap;
27+
import java.util.Map;
2628

2729
import org.junit.Test;
2830

@@ -99,4 +101,15 @@ public void testHyphenatorCache() throws IOException {
99101
frxml.delete();
100102
f.delete();
101103
}
104+
105+
@Test
106+
public void testHyphenatorCountry() {
107+
Map<String, String> hyphPatNames = new HashMap<>();
108+
hyphPatNames.put("de_CH", "test/resources/fop/fr.xml" + Hyphenator.XMLTYPE);
109+
InternalResourceResolver resourceResolver = ResourceResolverFactory.createDefaultInternalResourceResolver(
110+
new File(".").toURI());
111+
Hyphenation hyph = Hyphenator.hyphenate("de", "CH", resourceResolver, hyphPatNames,
112+
"hello", 0, 0, fopFactory.newFOUserAgent());
113+
assertEquals(hyph.toString(), "-hel-lo");
114+
}
102115
}

0 commit comments

Comments
 (0)