diff --git a/src/PhpWord/Style/Language.php b/src/PhpWord/Style/Language.php index 8bb6014986..d99957f231 100644 --- a/src/PhpWord/Style/Language.php +++ b/src/PhpWord/Style/Language.php @@ -120,6 +120,7 @@ public function __construct($latin = null, $eastAsia = null, $bidirectional = nu */ public function setLatin($latin) { + $latin = $this->correctLocale($latin); $this->validateLocale($latin); $this->latin = $latin; @@ -223,4 +224,18 @@ private function validateLocale($locale) throw new \InvalidArgumentException($locale . ' is not a valid language code'); } } + + /** + * @param string|null $locale + * @return string|null + */ + private function correctLocale($locale) + { + // This is a workaround for the error "en is not a valid language code". + if ($locale === 'en') { + return self::EN_GB; + } + + return $locale; + } }