You are here

function locale_help in Drupal 8

Same name and namespace in other branches
  1. 4 modules/locale.module \locale_help()
  2. 5 modules/locale/locale.module \locale_help()
  3. 6 modules/locale/locale.module \locale_help()
  4. 7 modules/locale/locale.module \locale_help()
  5. 9 core/modules/locale/locale.module \locale_help()

Implements hook_help().

File

core/modules/locale/locale.module, line 149
Enables the translation of the user interface to languages other than English.

Code

function locale_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.locale':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('The Interface Translation module allows you to translate interface text (<em>strings</em>) into different languages, and to switch between them for the display of interface text. It uses the functionality provided by the <a href=":language">Language module</a>. For more information, see the <a href=":doc-url">online documentation for the Interface Translation module</a>.', [
        ':doc-url' => 'https://www.drupal.org/documentation/modules/locale/',
        ':language' => Url::fromRoute('help.page', [
          'name' => 'language',
        ])
          ->toString(),
      ]) . '</p>';
      $output .= '<h3>' . t('Uses') . '</h3>';
      $output .= '<dl>';
      $output .= '<dt>' . t('Importing translation files') . '</dt>';
      $output .= '<dd>' . t('Translation files with translated interface text are imported automatically when languages are added on the <a href=":languages">Languages</a> page, or when modules or themes are enabled. On the <a href=":locale-settings">Interface translation settings</a> page, the <em>Translation source</em> can be restricted to local files only, or to include the <a href=":server">Drupal translation server</a>. Although modules and themes may not be fully translated in all languages, new translations become available frequently. You can specify whether and how often to check for translation file updates and whether to overwrite existing translations on the <a href=":locale-settings">Interface translation settings</a> page. You can also manually import a translation file on the <a href=":import">Interface translation import</a> page.', [
        ':import' => Url::fromRoute('locale.translate_import')
          ->toString(),
        ':locale-settings' => Url::fromRoute('locale.settings')
          ->toString(),
        ':languages' => Url::fromRoute('entity.configurable_language.collection')
          ->toString(),
        ':server' => 'https://localize.drupal.org',
      ]) . '</dd>';
      $output .= '<dt>' . t('Checking the translation status') . '</dt>';
      $output .= '<dd>' . t('You can check how much of the interface on your site is translated into which language on the <a href=":languages">Languages</a> page. On the <a href=":translation-updates">Available translation updates</a> page, you can check whether interface translation updates are available on the <a href=":server">Drupal translation server</a>.', [
        ':languages' => Url::fromRoute('entity.configurable_language.collection')
          ->toString(),
        ':translation-updates' => Url::fromRoute('locale.translate_status')
          ->toString(),
        ':server' => 'https://localize.drupal.org',
      ]) . '<dd>';
      $output .= '<dt>' . t('Translating individual strings') . '</dt>';
      $output .= '<dd>' . t('You can translate individual strings directly on the <a href=":translate">User interface translation</a> page, or download the currently-used translation file for a specific language on the <a href=":export">Interface translation export</a> page. Once you have edited the translation file, you can then import it again on the <a href=":import">Interface translation import</a> page.', [
        ':translate' => Url::fromRoute('locale.translate_page')
          ->toString(),
        ':export' => Url::fromRoute('locale.translate_export')
          ->toString(),
        ':import' => Url::fromRoute('locale.translate_import')
          ->toString(),
      ]) . '</dd>';
      $output .= '<dt>' . t('Overriding default English strings') . '</dt>';
      $output .= '<dd>' . t('If translation is enabled for English, you can <em>override</em> the default English interface text strings in your site with other English text strings on the <a href=":translate">User interface translation</a> page. Translation is off by default for English, but you can turn it on by visiting the <em>Edit language</em> page for <em>English</em> from the <a href=":languages">Languages</a> page.', [
        ':translate' => Url::fromRoute('locale.translate_page')
          ->toString(),
        ':languages' => Url::fromRoute('entity.configurable_language.collection')
          ->toString(),
      ]) . '</dd>';
      $output .= '</dl>';
      return $output;
    case 'entity.configurable_language.collection':
      return '<p>' . t('Interface translations are automatically imported when a language is added, or when new modules or themes are enabled. The report <a href=":update">Available translation updates</a> shows the status. Interface text can be customized in the <a href=":translate">user interface translation</a> page.', [
        ':update' => Url::fromRoute('locale.translate_status')
          ->toString(),
        ':translate' => Url::fromRoute('locale.translate_page')
          ->toString(),
      ]) . '</p>';
    case 'locale.translate_page':
      $output = '<p>' . t('This page allows a translator to search for specific translated and untranslated strings, and is used when creating or editing translations. (Note: Because translation tasks involve many strings, it may be more convenient to <a title="User interface translation export" href=":export">export</a> strings for offline editing in a desktop Gettext translation editor.) Searches may be limited to strings in a specific language.', [
        ':export' => Url::fromRoute('locale.translate_export')
          ->toString(),
      ]) . '</p>';
      return $output;
    case 'locale.translate_import':
      $output = '<p>' . t('Translation files are automatically downloaded and imported when <a title="Languages" href=":language">languages</a> are added, or when modules or themes are enabled.', [
        ':language' => Url::fromRoute('entity.configurable_language.collection')
          ->toString(),
      ]) . '</p>';
      $output .= '<p>' . t('This page allows translators to manually import translated strings contained in a Gettext Portable Object (.po) file. Manual import may be used for customized translations or for the translation of custom modules and themes. To customize translations you can download a translation file from the <a href=":url">Drupal translation server</a> or <a title="User interface translation export" href=":export">export</a> translations from the site, customize the translations using a Gettext translation editor, and import the result using this page.', [
        ':url' => 'https://localize.drupal.org',
        ':export' => Url::fromRoute('locale.translate_export')
          ->toString(),
      ]) . '</p>';
      $output .= '<p>' . t('Note that importing large .po files may take several minutes.') . '</p>';
      return $output;
    case 'locale.translate_export':
      return '<p>' . t('This page exports the translated strings used by your site. An export file may be in Gettext Portable Object (<em>.po</em>) form, which includes both the original string and the translation (used to share translations with others), or in Gettext Portable Object Template (<em>.pot</em>) form, which includes the original strings only (used to create new translations with a Gettext translation editor).') . '</p>';
  }
}