I am encountering difficulties while trying to integrate Hyphenopoly into a Django project. The functionality sometimes works smoothly, but other times it does not. Additionally, when viewed on a mobile browser, the hyphenation appears inconsistent or even nonexistent on elements containing Italian text. To make matters worse, I am struggling to comprehend the provided documentation. It seems to be my own fault.
Below is a snapshot of the project's directory structure
Based on my understanding, I have only loaded a few files from the original library in order to hyphenate Italian and English text fragments, whether separate or combined. The primary language remains English, as I have specified in the lang attribute of the html element. For elements containing Italian content, I have appropriately set the language attribute (and used spans for mixed content).
In the head section of my base.html:
<script src="{% static './hyphens/Hyphenopoly_Loader.js' %}"></script>
<script src="{% static 'HyphenConfig.js' %}"></script>
The HyphenConfig.js file contains:
$(document).ready(function() {
var Hyphenopoly = {
require: {
'en-us': 'ALL',
'en': 'ALL',
'it': 'ALL'
},
paths: {
patterndir: "./hyphens/patterns/",
maindir: "./hyphens/"
},
setup: {
selectors: {
'.hyphenate': {
compound: "all",
leftmin: 0,
rightmin: 0,
minWordLength: 4
}
}
}
};
});
I have also declared the hyphenate class in the global CSS file:
.hyphenate {
hyphens: auto !important;
-webkit-hyphens: auto !important;
-ms-hyphens: auto !important;
}
What was my expectation?
I expected a more satisfactory outcome for each element that has a language attribute (either en or it) and is assigned the hyphenate class. However, the results did not meet my expectations. Could it be an issue with the implementation, or am I missing a file or configuration?