diff options
Diffstat (limited to 'cli/i18n/I18nData.php')
| -rw-r--r-- | cli/i18n/I18nData.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cli/i18n/I18nData.php b/cli/i18n/I18nData.php index 2f09a5525..5071c9be9 100644 --- a/cli/i18n/I18nData.php +++ b/cli/i18n/I18nData.php @@ -123,13 +123,17 @@ class I18nData { * Add a new language. It's a copy of the reference language. * * @param string $language + * @param string $reference * @throws Exception */ - public function addLanguage($language) { + public function addLanguage($language, $reference = null) { if (array_key_exists($language, $this->data)) { throw new Exception('The selected language already exist.'); } - $this->data[$language] = $this->data[static::REFERENCE_LANGUAGE]; + if (!is_string($reference) && !array_key_exists($reference, $this->data)) { + $reference = static::REFERENCE_LANGUAGE; + } + $this->data[$language] = $this->data[$reference]; } /** |
