original_string: protected function replaceTranslationPlaceholders()
      {
          $locales     = $this->getTranslationLocales();
          $placeholder = $this->getTranslatedRulePlaceHolder();
          $processed   = [];
  
          // Detect and duplicate special rules for translated locales
          foreach ($this->rules as $key => $ruleSet) {
  
              if (false === strpos($key, $placeholder)) {
                  $processed[ $key ] = $ruleSet;
                  continue;
              }
  
              // Add the rule for each translatable locale separately
              foreach ($locales as $locale) {
  
                  $localizedKey  = str_replace($placeholder, $locale, $key);
                  $localizedRule = $ruleSet;
  
                  // Replace placeholders for rulesets, whether they formatted as string or array
                  if (is_array($localizedRule)) {
  
                      $localizedRule = array_map(
                          function ($part) use ($placeholder, $locale) {
                              return str_replace($placeholder, $locale, $part);
                          },
                          $localizedRule
                      );
  
                  } else {
  
                      $localizedRule = str_replace($placeholder, $locale, $localizedRule);
                  }
  
                  $processed[ $localizedKey ] = $localizedRule;
              }
          }
  
          $this->rules = $processed;
  
          return $this;
      }
code: protected function replaceTranslationPlaceholders()
      {
          $locales     = $this->getTranslationLocales();
          $placeholder = $this->getTranslatedRulePlaceHolder();
          $processed   = [];
  
          // Detect and duplicate special rules for translated locales
          foreach ($this->rules as $key => $ruleSet) {
  
              if (false === strpos($key, $placeholder)) {
                  $processed[ $key ] = $ruleSet;
                  continue;
              }
  
              // Add the rule for each translatable locale separately
              foreach ($locales as $locale) {
  
                  $localizedKey  = str_replace($placeholder, $locale, $key);
                  $localizedRule = $ruleSet;
  
                  // Replace placeholders for rulesets, whether they formatted as string or array
                  if (is_array($localizedRule)) {
  
                      $localizedRule = array_map(
                          function ($part) use ($placeholder, $locale) {
                              return str_replace($placeholder, $locale, $part);
                          },
                          $localizedRule
                      );
  
                  } else {
  
                      $localizedRule = str_replace($placeholder, $locale, $localizedRule);
                  }
  
                  $processed[ $localizedKey ] = $localizedRule;
              }
          }
  
          $this->rules = $processed;
  
          return $this;
      }
code_tokens: protected function replaceTranslationPlaceholders ( ) { $ locales = $ this -> getTranslationLocales ( ) ; $ placeholder = $ this -> getTranslatedRulePlaceHolder ( ) ; $ processed = [ ] ; // Detect and duplicate special rules for translated locales foreach ( $ this -> rules as $ key => $ ruleSet ) { if ( false === strpos ( $ key , $ placeholder ) ) { $ processed [ $ key ] = $ ruleSet ; continue ; } // Add the rule for each translatable locale separately foreach ( $ locales as $ locale ) { $ localizedKey = str_replace ( $ placeholder , $ locale , $ key ) ; $ localizedRule = $ ruleSet ; // Replace placeholders for rulesets, whether they formatted as string or array if ( is_array ( $ localizedRule ) ) { $ localizedRule = array_map ( function ( $ part ) use ( $ placeholder , $ locale ) { return str_replace ( $ placeholder , $ locale , $ part ) ; } , $ localizedRule ) ; } else { $ localizedRule = str_replace ( $ placeholder , $ locale , $ localizedRule ) ; } $ processed [ $ localizedKey ] = $ localizedRule ; } } $ this -> rules = $ processed ; return $ this ; }
docstring: Decorates rules by replacing translation placeholders and create rules per locale.
  
  @return $this
docstring_tokens: Decorates rules by replacing translation placeholders and create rules per locale .