Closed georgobermayr closed 4 years ago
You can already extend the included hyphenations by adding your own rules to the file (in your case) https://raw.githubusercontent.com/heiglandreas/Org_Heigl_Hyphenator/main/src/share/files/dictionaries/de_DE.ini
You can append that file with @:produktionsstrategie="000000000009800000000"
(please verify that there are one more digits that characters) which basically tells the hyphenator to hyphenate between "ss" and to never hyphenate between "st" in case it encounters the word "produktionsstrategie"
But being able to add an additional custom dictionary might be a good idea indeed...
Thank you for the super quick reply! Thats great. However in a composer setup I would have to fork your plugin to do that, right? There is no way to extend this file with my own rules outside of your code package?
Currentl not. I'll be working on that next weekend.
Thank you, that's great!
You can already solve that using this:
$hyphenator->getDictionaries()->getDictionaryWithKey(0)->addPattern('strategie', '9800000000');
But that is rather quirky and I'd prefer a cleaner solution for that. I also currently don't unterstand why I can not include the whole "produktionsstrategie" but I'll solve that on the weekend...
This has been addressed with #50
You should now be able to do the following to add your own dictionary in addition to the "default" one:
use \Org\Heigl\Hyphenator\Hyphenator;
use Org\Heigl\Hyphenator\Dictionary\Dictionary;
$hyphenator = new Hyphenator();
$dictionary = Dictionary::fromFile('/path/to/my/dictionary/file.ini');
$hyphenator->getDictionaries()->addDictionary($dictionary);
Wow, thank you, this helps a lot!
I have an issue with the German word "Produktionsstrategie" hyphened at Produktionss|trategie, wich seems to be wrong. For these cases it would great to have a dictionary of "hyphen exceptions" that overwrite the default rules for certain words. This would also be great for hyphens of company words etc. Or is something like this already possible?