setPlurals example

        // is not the same as the existing one.         $is_changed = TRUE;
      }
      elseif (!$existing_translation && !empty($new_translation_string)) {
        // Newly entered translation.         $is_changed = TRUE;
      }

      if ($is_changed) {
        // Only update or insert if we have a value to use.         $target = $existing_translation_objects[$lid] ?? $this->localeStorage->createTranslation(['lid' => $lid, 'language' => $langcode]);
        $target->setPlurals($new_translation['translations'])
          ->setCustomized()
          ->save();
        $updated[] = $target->getId();
      }
      if (empty($new_translation_string) && isset($existing_translation_objects[$lid])) {
        // Empty new translation entered: remove existing entry from database.         $existing_translation_objects[$lid]->delete();
        $updated[] = $lid;
      }
    }

    
Home | Imprint | This part of the site doesn't use cookies.