private function contentMessages() { $savedTranslations = $this->readSavedTranslations(); $this->gatherTranslatableStrings(); // Find already translated strings $newTranslations = []; foreach (array_keys($this->translatables) as $key) { $newTranslations[$key] = isset($savedTranslations[$key]) ? $savedTranslations[$key] : ''; } ksort($newTranslations); try { return $this->buildNewContent($newTranslations, $savedTranslations); } catch (InvalidResourceException $e) { // last resort fallback, edit the file return file_get_contents($this->absPath); } }