src/wcmf/lib/i18n/impl/DefaultLocalization.php
private function setTranslatedValue(PersistentObject $object, $valueName, $translation, $useDefaults) {
    $mapper = $object->getMapper();
    $isTranslatable = $mapper != null && $mapper->hasAttribute($valueName) ? $mapper->getAttribute($valueName)->hasTag('TRANSLATABLE') : false;
    if ($isTranslatable) {
      // empty the value, if the default language values should not be used
      if (!$useDefaults) {
        $object->setValue($valueName, null, true);
      }
      // translate the value
      if (!($useDefaults && strlen($translation) == 0)) {
        $object->setValue($valueName, $translation, true);
      }
    }
  }
private function setTranslatedValue(PersistentObject $object, $valueName, $translation, $useDefaults) {
    $mapper = $object->getMapper();
    $isTranslatable = $mapper != null && $mapper->hasAttribute($valueName) ? $mapper->getAttribute($valueName)->hasTag('TRANSLATABLE') : false;
    if ($isTranslatable) {
      // empty the value, if the default language values should not be used
      if (!$useDefaults) {
        $object->setValue($valueName, null, true);
      }
      // translate the value
      if (!($useDefaults && strlen($translation) == 0)) {
        $object->setValue($valueName, $translation, true);
      }
    }
  }
private function setTranslatedValue ( PersistentObject $ object , $ valueName , $ translation , $ useDefaults ) { $ mapper = $ object -> getMapper ( ) ; $ isTranslatable = $ mapper != null && $ mapper -> hasAttribute ( $ valueName ) ? $ mapper -> getAttribute ( $ valueName ) -> hasTag ( 'TRANSLATABLE' ) : false ; if ( $ isTranslatable ) { // empty the value, if the default language values should not be used if ( ! $ useDefaults ) { $ object -> setValue ( $ valueName , null , true ) ; } // translate the value if ( ! ( $ useDefaults && strlen ( $ translation ) == 0 ) ) { $ object -> setValue ( $ valueName , $ translation , true ) ; } } }
Set a translated value in the given PersistentObject instance.
@param $object The object to set the value on. The object
is supposed to have it's values in the default language.
@param $valueName The name of the value to translate
@param $translation Translation for the value.
@param $useDefaults Boolean whether to use the default language if no
translation is found or not.
Set a translated value in the given PersistentObject instance .