src/Locale/Service/LocaleService.php
public function localize(Localizable $model, string $locale)
    {
        $properties = $this->getProperties($model);

        foreach ($properties as $property) {
            $name = ucfirst($property->getName());
            $values = $model->{'get'.$name}();

            if (array_key_exists($locale, $values)) {
                $model->{'set'.$name}([$locale => $values[$locale]]);
            } else {
                $model->{'set'.$name}([$locale => null]);
            }
        }
    }
public function localize(Localizable $model, string $locale)
    {
        $properties = $this->getProperties($model);

        foreach ($properties as $property) {
            $name = ucfirst($property->getName());
            $values = $model->{'get'.$name}();

            if (array_key_exists($locale, $values)) {
                $model->{'set'.$name}([$locale => $values[$locale]]);
            } else {
                $model->{'set'.$name}([$locale => null]);
            }
        }
    }
public function localize ( Localizable $ model , string $ locale ) { $ properties = $ this -> getProperties ( $ model ) ; foreach ( $ properties as $ property ) { $ name = ucfirst ( $ property -> getName ( ) ) ; $ values = $ model -> { 'get' . $ name } ( ) ; if ( array_key_exists ( $ locale , $ values ) ) { $ model -> { 'set' . $ name } ( [ $ locale => $ values [ $ locale ] ] ) ; } else { $ model -> { 'set' . $ name } ( [ $ locale => null ] ) ; } } }
Localize model

@param \Ds\Component\Locale\Model\Type\Localizable $model
@param string $locale
Localize model