You are here

function language_help in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/language/language.module \language_help()

Implements hook_help().

File

core/modules/language/language.module, line 27
Add language handling functionality to Drupal.

Code

function language_help($route_name, RouteMatchInterface $route_match) {
  switch ($route_name) {
    case 'help.page.language':
      $output = '';
      $output .= '<h3>' . t('About') . '</h3>';
      $output .= '<p>' . t('The Language module allows you to configure the languages used on your site, and provides information for the for <a href=":content">Content Translation</a>, <a href=":interface">Interface Translation</a>, and <a href=":configuration">Configuration Translation</a> modules, if they are enabled. For more information, see the <a href=":doc_url">online documentation for the Language module</a>.', array(
        ':doc_url' => 'https://www.drupal.org/documentation/modules/language',
        ':content' => \Drupal::moduleHandler()
          ->moduleExists('content_translation') ? \Drupal::url('help.page', array(
          'name' => 'content_translation',
        )) : '#',
        ':interface' => \Drupal::moduleHandler()
          ->moduleExists('locale') ? \Drupal::url('help.page', array(
          'name' => 'locale',
        )) : '#',
        ':configuration' => \Drupal::moduleHandler()
          ->moduleExists('config_translation') ? \Drupal::url('help.page', array(
          'name' => 'config_translation',
        )) : '#',
      )) . '</p>';
      $output .= '<h3>' . t('Uses') . '</h3>';
      $output .= '<dl>';
      $output .= '<dt>' . t('Adding languages') . '</dt>';
      $output .= '<dd>' . t('You can add languages on the <a href=":language_list">Languages</a> page by selecting <em>Add language</em> and choosing a language from the drop-down menu. This language is then displayed in the languages list, where it can be configured further. If the <a href=":interface">Interface translation module</a> is enabled, and the <em>translation server</em> is set as a translation source, then the interface translation for this language is automatically downloaded as well.', array(
        ':language_list' => \Drupal::url('entity.configurable_language.collection'),
        ':interface' => \Drupal::moduleHandler()
          ->moduleExists('locale') ? \Drupal::url('help.page', array(
          'name' => 'locale',
        )) : '#',
      )) . '</dd>';
      $output .= '<dt>' . t('Adding custom languages') . '</dt>';
      $output .= '<dd>' . t('You can add a language that is not provided in the drop-down list by choosing <em>Custom language</em> at the end of the list. You then have to configure its language code, name, and direction in the form provided.') . '</dd>';
      $output .= '<dt>' . t('Configuring content languages') . '</dt>';
      $output .= '<dd>' . t('By default, content is created in the site\'s default language and no language selector is displayed on content creation pages. On the <a href=":content_language">Content language</a> page you can customize the language configuration for any supported content entity on your site (for example for content types or menu links). After choosing an entity, you are provided with a drop-down menu to set the default language and a check-box to display language selectors.', array(
        ':content_language' => \Drupal::url('language.content_settings_page'),
      )) . '</dd>';
      $output .= '<dt>' . t('Adding a language switcher block') . '</dt>';
      $output .= '<dd>' . t('If the Block module is enabled, then you can add a language switcher block on the <a href=":blocks">Block layout</a> page to allow users to switch between languages.', array(
        ':blocks' => \Drupal::moduleHandler()
          ->moduleExists('block') ? \Drupal::url('block.admin_display') : '#',
      )) . '</dd>';
      $output .= '<dt>' . t('Making a block visible per language') . '</dt>';
      $output .= '<dd>' . t('If the Block module is enabled, then the Language module allows you to set the visibility of a block based on selected languages on the <a href=":blocks">Block layout</a> page.', array(
        ':blocks' => \Drupal::moduleHandler()
          ->moduleExists('block') ? \Drupal::url('block.admin_display') : '#',
      )) . '</dd>';
      $output .= '<dt>' . t('Choosing user languages') . '</dt>';
      $output .= '<dd>' . t('Users can choose a <em>Site language</em> on their profile page. This language is used for email messages, and can be used by modules to determine a user\'s language. It can also be used for interface text, if the <em>User</em> method is enabled as a <em>Detection and selection</em> method (see below). Administrative users can choose a separate <em>Administration pages language</em> for the interface text on administration pages. This configuration is only available on the user\'s profile page if the <em>Account administration pages</em> method is enabled (see below).') . '</dd>';
      $output .= '<dt>' . t('Language detection and selection') . '</dt>';
      $output .= '<dd>' . t('The <a href=":detection">Detection and selection</a> page provides several methods for deciding which language is used for displaying interface text. When a method detects and selects an interface language, then the following methods in the list are not applied. You can order them by importance, with your preferred method at the top of the list, followed by one or several fall-back methods.', array(
        ':detection' => \Drupal::url('language.negotiation'),
      ));
      $output .= '<ul><li>' . t('<em>URL</em> sets the interface language based on a path prefix or domain (for example specifying <em>de</em> for German would result in URLs like <em>example.com/de/contact</em>). The default language does not require a path prefix, but can have one assigned as well. If the language detection is done by domain name, a domain needs to be specified for each language.') . '</li>';
      $output .= '<li>' . t('<em>Session</em> determines the interface language from a request or session parameter (for example <em>example.com?language=de</em> would set the interface language to German based on the use of <em>de</em> as the <em>language</em> parameter).') . '</li>';
      $output .= '<li>' . t('<em>User</em> follows the language configuration set on the user\'s profile page.') . '</li>';
      $output .= '<li>' . t('<em>Browser</em> sets the interface language based on the browser\'s language settings. Since browsers use different language codes to refer to the same languages, you can add and edit languages codes to map the browser language codes to the <a href=":language_list">language codes</a> used on your site.', array(
        ':language_list' => \Drupal::url('entity.configurable_language.collection'),
      )) . '</li>';
      $output .= '<li>' . t('<em>Account administration pages</em> follows the configuration set as <em>Administration pages language</em> on the profile page of an administrative user. This method is similar to the <em>User</em> method, but only sets the interface text language on administration pages, independent of the interface text language on other pages.') . '</li>';
      $output .= '<li>' . t('<em>Selected language</em> allows you to specify the site\'s default language or a specific language as the fall-back language. This method should be listed last.') . '</li></ul></dd>';
      $output .= '</dl>';
      return $output;
    case 'entity.configurable_language.collection':
      $output = '<p>' . t('Reorder the configured languages to set their order in the language switcher block and, when editing content, in the list of selectable languages. This ordering does not impact <a href=":detection">detection and selection</a>.', array(
        ':detection' => \Drupal::url('language.negotiation'),
      )) . '</p>';
      $output .= '<p>' . t('The site default language can also be set. It is not recommended to change the default language on a working site. <a href=":language-detection">Configure the Selected language</a> setting on the detection and selection page to change the fallback language for language selection.', array(
        ':language-detection' => \Drupal::url('language.negotiation'),
      )) . '</p>';
      return $output;
    case 'language.add':
      return '<p>' . t('Add a language to be supported by your site. If your desired language is not available, pick <em>Custom language...</em> at the end and provide a language code and other details manually.') . '</p>';
    case 'language.negotiation':
      $output = '<p>' . t('Define how to decide which language is used to display page elements (primarily text provided by modules, such as field labels and help text). This decision is made by evaluating a series of detection methods for languages; the first detection method that gets a result will determine which language is used for that type of text. Be aware that some language detection methods are unreliable under certain conditions, such as browser detection when page-caching is enabled and a user is not currently logged in. Define the order of evaluation of language detection methods on this page. The default language can be changed in the <a href=":admin-change-language">list of languages</a>.', array(
        ':admin-change-language' => \Drupal::url('entity.configurable_language.collection'),
      )) . '</p>';
      return $output;
    case 'language.negotiation_session':
      $output = '<p>' . t('Determine the language from a request/session parameter. Example: "http://example.com?language=de" sets language to German based on the use of "de" within the "language" parameter.') . '</p>';
      return $output;
    case 'language.negotiation_browser':
      $output = '<p>' . t('Browsers use different language codes to refer to the same languages. Internally, a best effort is made to determine the correct language based on the code that the browser sends. You can add and edit additional mappings from browser language codes to <a href=":configure-languages">site languages</a>.', array(
        ':configure-languages' => \Drupal::url('entity.configurable_language.collection'),
      )) . '</p>';
      return $output;
    case 'language.negotiation_selected':
      $output = '<p>' . t('Changing the selected language here (and leaving this option as the last among the detection and selection options) is the easiest way to change the fallback language for the website, if you need to change how your site works by default (e.g., when using an empty path prefix or using the default domain). <a href=":admin-change-language">Changing the site\'s default language</a> itself might have other undesired side effects.', array(
        ':admin-change-language' => \Drupal::url('entity.configurable_language.collection'),
      )) . '</p>';
      return $output;
    case 'entity.block.edit_form':
      if (($block = $route_match
        ->getParameter('block')) && $block
        ->getPluginId() == 'language_block:language_interface') {
        return '<p>' . t('With multiple languages configured, registered users can select their preferred language and authors can assign a specific language to content.') . '</p>';
      }
      break;
    case 'block.admin_add':
      if ($route_match
        ->getParameter('plugin_id') == 'language_block:language_interface') {
        return '<p>' . t('With multiple languages configured, registered users can select their preferred language and authors can assign a specific language to content.') . '</p>';
      }
      break;
    case 'language.content_settings_page':
      return t('Change language settings for <em>content types</em>, <em>taxonomy vocabularies</em>, <em>user profiles</em>, or any other supported element on your site. By default, language settings hide the language selector and the language is the site\'s default language.');
  }
}