From 4b83d984c824a227f8736826ca320492bd07e612 Mon Sep 17 00:00:00 2001 From: Rico Kaltofen Date: Tue, 4 Dec 2018 18:12:25 +0100 Subject: [PATCH] 1.2.6, check changelog --- CHANGELOG.md | 5 +++++ src/Hyphenator/FrontendHyphenator.php | 8 +++++++- src/Resources/contao/config/config.php | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c291e1b..3bdd34b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,11 @@ # Changelog All notable changes to this project will be documented in this file. +## [1.2.6] - 2018-12-04 + +### Fixed +- page language and naming of .tex files do not match, provide `$GLOBALS['TL_CONFIG']['hyphenator_locale_language_mapping']` in order to handle with + ## [1.2.5] - 2018-10-22 ### Fixed diff --git a/src/Hyphenator/FrontendHyphenator.php b/src/Hyphenator/FrontendHyphenator.php index 28c298c..06821eb 100644 --- a/src/Hyphenator/FrontendHyphenator.php +++ b/src/Hyphenator/FrontendHyphenator.php @@ -43,7 +43,13 @@ public function hyphenate($strBuffer) \Syllable::setCacheDir(System::getContainer()->getParameter('kernel.cache_dir')); - $h = new \Syllable($objPage->language); + $language = $objPage->language; + + if (isset($GLOBALS['TL_CONFIG']['hyphenator_locale_language_mapping'][$language])) { + $language = $GLOBALS['TL_CONFIG']['hyphenator_locale_language_mapping'][$language]; + } + + $h = new \Syllable($language); $h->setMinWordLength(Config::get('hyphenator_wordMin')); $h->setHyphen(Config::get('hyphenator_hyphen')); diff --git a/src/Resources/contao/config/config.php b/src/Resources/contao/config/config.php index 3eadc4c..e31d8b0 100644 --- a/src/Resources/contao/config/config.php +++ b/src/Resources/contao/config/config.php @@ -17,6 +17,7 @@ $GLOBALS['TL_CONFIG']['hyphenator_hyphen'] = '­'; $GLOBALS['TL_CONFIG']['hyphenator_skipPages'] = []; $GLOBALS['TL_CONFIG']['hyphenator_enableCache'] = true; +$GLOBALS['TL_CONFIG']['hyphenator_locale_language_mapping']['en'] = 'en-us'; // map page language to .tex files /** * Hooks