You are here

protected function TranslationStatusForm::createInfoString in Drupal 8

Same name and namespace in other branches
  1. 9 core/modules/locale/src/Form/TranslationStatusForm.php \Drupal\locale\Form\TranslationStatusForm::createInfoString()

Provides debug info for projects in case translation files are not found.

Translations files are being fetched either from Drupal translation server and local files or only from the local filesystem depending on the "Translation source" setting at admin/config/regional/translate/settings. This method will produce debug information including the respective path(s) based on this setting.

Parameters

array $project_info: An array which is the project information of the source.

Return value

string The string which contains debug information.

1 call to TranslationStatusForm::createInfoString()
TranslationStatusForm::prepareUpdateData in core/modules/locale/src/Form/TranslationStatusForm.php
Prepare information about projects with available translation updates.

File

core/modules/locale/src/Form/TranslationStatusForm.php, line 239

Class

TranslationStatusForm
Provides a translation status form.

Namespace

Drupal\locale\Form

Code

protected function createInfoString($project_info) {
  $remote_path = isset($project_info->files['remote']->uri) ? $project_info->files['remote']->uri : FALSE;
  $local_path = isset($project_info->files['local']->uri) ? $project_info->files['local']->uri : FALSE;
  if (locale_translation_use_remote_source() && $remote_path && $local_path) {
    return $this
      ->t('File not found at %remote_path nor at %local_path', [
      '%remote_path' => $remote_path,
      '%local_path' => $local_path,
    ]);
  }
  elseif ($local_path) {
    return $this
      ->t('File not found at %local_path', [
      '%local_path' => $local_path,
    ]);
  }
  return $this
    ->t('Translation file location could not be determined.');
}