small improvement
This commit is contained in:
@@ -33,7 +33,7 @@ trait I18nTestTrait
|
|||||||
* @param array $fields list of field to populate
|
* @param array $fields list of field to populate
|
||||||
* @param array $localeList list of locale to use populate the object
|
* @param array $localeList list of locale to use populate the object
|
||||||
*/
|
*/
|
||||||
protected function setI18n(&$object, $fields = array("title"), $localeList = null)
|
protected function setI18n(&$object, $fields = array("Title"), $localeList = null)
|
||||||
{
|
{
|
||||||
if (null === $localeList) {
|
if (null === $localeList) {
|
||||||
|
|
||||||
@@ -49,14 +49,8 @@ trait I18nTestTrait
|
|||||||
}
|
}
|
||||||
|
|
||||||
foreach ($localeList as $locale) {
|
foreach ($localeList as $locale) {
|
||||||
|
|
||||||
$object->setLocale($locale);
|
|
||||||
|
|
||||||
foreach ($fields as $name) {
|
foreach ($fields as $name) {
|
||||||
|
$object->getTranslation($locale)->setByName($name, $locale . ' : ' . $name);
|
||||||
$func = "set" . ucfirst(strtolower($name));
|
|
||||||
|
|
||||||
$object->$func($locale . ' : ' . $name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user