3 namespace Drupal\language;
5 use Drupal\Core\Config\ConfigFactoryInterface;
6 use Drupal\Core\Language\LanguageInterface;
7 use Drupal\Core\Session\AccountInterface;
8 use Symfony\Component\HttpFoundation\Request;
11 * Interface for language negotiation classes.
13 interface LanguageNegotiationMethodInterface {
16 * Injects the language manager.
18 * @param \Drupal\language\ConfigurableLanguageManagerInterface $language_manager
19 * The language manager to be used to retrieve the language list and the
20 * already negotiated languages.
22 public function setLanguageManager(ConfigurableLanguageManagerInterface $language_manager);
25 * Injects the configuration factory.
27 * @param \Drupal\Core\Config\ConfigFactoryInterface $config
28 * The configuration factory.
30 public function setConfig(ConfigFactoryInterface $config);
33 * Injects the current user.
35 * @param \Drupal\Core\Session\AccountInterface $current_user
36 * The current active user.
38 public function setCurrentUser(AccountInterface $current_user);
41 * Performs language negotiation.
43 * @param \Symfony\Component\HttpFoundation\Request $request
44 * (optional) The current request. Defaults to NULL if it has not been
48 * A valid language code or FALSE if the negotiation was unsuccessful.
50 public function getLangcode(Request $request = NULL);
53 * Notifies the plugin that the language code it returned has been accepted.
55 * @param \Drupal\Core\Language\LanguageInterface $language
56 * The accepted language.
58 public function persist(LanguageInterface $language);