original_string: public static function getTranslator($name = 'default', $locale = null)
      {
          $translators = static::translators();
  
          if ($locale) {
              $currentLocale = $translators->getLocale();
              $translators->setLocale($locale);
          }
  
          $translator = $translators->get($name);
  
          if (isset($currentLocale)) {
              $translators->setLocale($currentLocale);
          }
  
          return $translator;
      }
code: public static function getTranslator($name = 'default', $locale = null)
      {
          $translators = static::translators();
  
          if ($locale) {
              $currentLocale = $translators->getLocale();
              $translators->setLocale($locale);
          }
  
          $translator = $translators->get($name);
  
          if (isset($currentLocale)) {
              $translators->setLocale($currentLocale);
          }
  
          return $translator;
      }
code_tokens: public static function getTranslator ( $ name = 'default' , $ locale = null ) { $ translators = static :: translators ( ) ; if ( $ locale ) { $ currentLocale = $ translators -> getLocale ( ) ; $ translators -> setLocale ( $ locale ) ; } $ translator = $ translators -> get ( $ name ) ; if ( isset ( $ currentLocale ) ) { $ translators -> setLocale ( $ currentLocale ) ; } return $ translator ; }
docstring: Returns an instance of a translator that was configured for the name and locale.
  
  If no locale is passed then it takes the value returned by the `getLocale()` method.
  
  @param string $name The domain of the translation messages.
  @param string|null $locale The locale for the translator.
  @return \Aura\Intl\TranslatorInterface The configured translator.
  @throws \Aura\Intl\Exception
docstring_tokens: Returns an instance of a translator that was configured for the name and locale .