Allows modification of all translations of an entry

@param $msgid string msgid of the entry which should be updated
@param $translation array of strings new Translation for all msgstr by msgid

@throws \Exception
178282
public function updateEntries($msgid, $translation)
    {
        if (
            !isset($this->entriesAsArrays[$msgid])
            || !is_array($translation)
            || sizeof($translation) != sizeof($this->entriesAsArrays[$msgid]['msgstr'])
        ) {
            throw new \Exception('Cannot update entry translation');
        }
        $this->removeFuzzyFlagForMsgId($msgid);
        $this->entriesAsArrays[$msgid]['msgstr'] = $translation;
    }
1319259
public function delete($msgid)
    {
        $ret = array();
        $ret['msgid'] = $msgid;
        $rst = $this->_request->post($this->_url . "message/mass/delete", $ret);
        return $this->_client->rst($rst);
    }
1354123
public function pgettext($msgctxt, $msgid)
    {
        $key = implode(chr(4), [$msgctxt, $msgid]);
        $ret = $this->gettext($key);
        if (strpos($ret, chr(4)) !== false) {
            return $msgid;
        }

        return $ret;
    }
444495
public function setMsgs( $messagesByKey, $domain = null, $lang = null ) {
		foreach ( $messagesByKey as $key => $message ) {
			$this->setMsg( $key, $message, $domain, $lang );
		}
	}
1294243
public function npgettext($msgctxt, $msgid, $msgidPlural, $number)
    {
        $key = implode(chr(4), [$msgctxt, $msgid]);
        $ret = $this->ngettext($key, $msgidPlural, $number);
        if (strpos($ret, chr(4)) !== false) {
            return $msgid;
        }

        return $ret;
    }
122564
public function setTranslations(ArrayCollection $translations)
    {
        foreach ($translations as $translation) {
            $translation->setObject($this);
        }

        $this->translations = $translations;
    }
598313
public function setTranslation($translation)
	{
		if (is_array($translation)) {
			$this->_translate = array_merge($this->_translate, $translation);
		}
  }
1024949
protected function addTranslationLanguageFromService($selfEdit, $msgInstanceName, $language) {
		$finePhpArrayTranslationService = new InstanceProxy($msgInstanceName, $selfEdit);
		$finePhpArrayTranslationService->createLanguageFile($language);
	}
290950
protected function getAllTranslationsForMessageFromService($selfEdit, $msgInstanceName, $key) {
		$translationService = new InstanceProxy($msgInstanceName, $selfEdit);
		return $translationService->getMessageForAllLanguages($key);
	}
1091125
public static function translate_plural($string, Translation $translation = null) {
		if ($translation !== null) {
			$translation = self::get($translation->language, $translation->application_name);
		} else {
			$translation = self::get();
		}

		return $translation->translate_string($string);
	}
973707
public function getRandomMissingTranslation(
        array $domains = [],
        array $languages = []
    ) : ? Translation {
        if (in_array($this->masterLanguage, $languages)) {
            throw new Exception('You cannot search by master language missing translations');
        }

        $candidates = [];
        $masterKeys = $this->getKeys(
            $domains,
            [$this->masterLanguage]
        );

        $languages = $languages ?: $this->getAvailableLanguages();

        foreach ($languages as $language) {
            $languageKeys = $this->getKeys(
                $domains,
                [$language]
            );

            $missingKeys = array_diff(
                $masterKeys,
                $languageKeys
            );
            foreach ($missingKeys as $missingKey) {
                $candidates[] = [
                    'language' => $language,
                    'key' => $missingKey,
                ];
            }
        }

        if (empty($candidates)) {
            return null;
        }

        $candidateKey = array_rand($candidates);
        $candidate = $candidates[$candidateKey];
        $masterCandidate = $this->getTranslation(
            $this->masterLanguage,
            $candidate['key']
        );

        $candidateTranslation = Translation::create(
            $candidate['key'],
            '',
            $candidate['language']
        );

        $candidateTranslation->setStructure($masterCandidate->getStructure());
        $candidateTranslation->setMasterTranslation($masterCandidate);

        return $candidateTranslation;
    }
63648
public function markElect(string $msgId, int $index, int $commentId)
    {
        $params = [
            'msg_data_id' => $msgId,
            'index' => $index,
            'user_comment_id' => $commentId,
        ];

        return $this->httpPostJson('cgi-bin/comment/markelect', $params);
    }
1260242
public void addFileTranslation(String translation) {

        m_fileTranslations.add(translation);
        if (CmsLog.INIT.isInfoEnabled()) {
            CmsLog.INIT.info(Messages.get().getBundle().key(Messages.INIT_VFS_ADD_FILE_TRANSLATION_1, translation));
        }
    }
711340
protected function writeMsgId(array $entry, $type = 'msgid')
    {
        $result = '';

        if (!isset($entry[$type])) {
            return $result;
        }

        $result .= $type . ' ';
        if (is_array($entry[$type])) {
            foreach ($entry[$type] as $id) {
                $result .= $this->cleanExport($id) . "\n";
            }
        } else {
            $result .= $this->cleanExport($entry[$type]) . "\n";
        }

        return $result;
    }
1135728
protected function approveTranslation($access, TranslationEntity $translation, UserEntity $user, $packageVersionID)
    {
        if ($access < Access::ADMIN) {
            throw new UserMessageException(t('Access denied'));
        }
        if ($translation->isCurrent()) {
            throw new UserMessageException(t('The selected translation is already the current one'));
        }
        $translationID = $translation->getID();
        $translations = $this->convertTranslationToGettext($translation, false);
        $importer = $this->app->make(Importer::class);
        $importer->import($translations, $translation->getLocale(), $user, ImportOptions::forAdministrators());
        $this->getEntityManager()->clear();
        $translation = $this->app->make(TranslationRepository::class)->find($translationID);
        $result = $this->app->make(Editor::class)->getTranslations($translation->getLocale(), $translation->getTranslatable());

        return $this->app->make(ResponseFactoryInterface::class)->json($result);
    }
1131353
@Override
    @GwtIncompatible("incompatible method")
    public int translate(final CharSequence input, final int index, final Writer out) throws IOException {
        for (final CharSequenceTranslator translator : translators) {
            final int consumed = translator.translate(input, index, out);
            if(consumed != 0) {
                return consumed;
            }
        }
        return 0;
    }
1202192
public function writeToStorage($domain, $translations)
    {
        foreach ($translations as $keys) {
            foreach ($keys as $key => $transMeta) {
                $search = $this->repository->createSearch();
                $search->addQuery(new MatchQuery('key', $key));
                $results = $this->repository->findDocuments($search);
                if (count($results)) {
                    continue;
                }

                $document = new Translation();
                $document->setDomain($domain);
                $document->setKey($key);
                $document->setPath($transMeta['path']);
                $document->setFormat($transMeta['format']);
                foreach ($transMeta['messages'] as $locale => $text) {
                    $message = new Message();
                    $message->setLocale($locale);
                    $message->setMessage($text);
                    $document->addMessage($message);
                }
                $this->manager->persist($document);
            }
        }

        $this->manager->commit();
    }