diff --git a/src/commands/TranslateFilesCommand.php b/src/commands/TranslateFilesCommand.php index 0bce817..fe3d828 100644 --- a/src/commands/TranslateFilesCommand.php +++ b/src/commands/TranslateFilesCommand.php @@ -231,10 +231,7 @@ public function translate_php_array_files($locale) } continue; } - $new_lang[$key] = self::translate($this->base_locale, $locale, $to_be_translated); - if ($this->verbose) { - $this->line($to_be_translated . ' : ' . $new_lang[$key]); - } + $new_lang[$key] = $this->translate_attribute($to_be_translated,$locale); } } //save new lang to new file @@ -246,6 +243,22 @@ public function translate_php_array_files($locale) return; } + private function translate_attribute($attribute,$locale){ + if(is_array($attribute)){ + $return = []; + foreach ($attribute as $k => $t){ + $return[$k] = $this->translate_attribute($t,$locale); + } + return $return; + }else{ + $translated = self::translate($this->base_locale, $locale, $attribute); + if ($this->verbose) { + $this->line($attribute . ' : ' . $translated); + } + return $translated; + } + } + /** * @return array */