get( $key, $replace, $locale = $this->localeForChoice($locale) ); // If the given "number" is actually an array or countable we will simply count the // number of elements in an instance. This allows developers to pass an array of // items without having to count it on their end first which gives bad syntax. if (is_array($number) || $number instanceof Countable) { $number = count($number); } $replace['count'] = $number; $underscored_locale = str_replace("-","_",$locale); // OUR CHANGE. return $this->makeReplacements( // BELOW - that $underscored_locale is the *ONLY* modified part $this->getSelector()->choose($line, $number, $underscored_locale), $replace ); } public function get($key, array $replace = [], $locale = null, $fallback = true) { $modified_locale = $locale; $changed_fallback = false; $previous_fallback = $this->fallback; // 'legacy' translation directories tend to be two-char ('en'), not 5-char ('en-US'). // Here we try our best to handle that. foreach (self::$legacy_translation_namespaces as $namespace) { if (preg_match("/^$namespace/", $key)) { $modified_locale = Helper::mapBackToLegacyLocale($locale); $changed_fallback = true; $this->fallback = 'en'; //TODO - should this be 'env-able'? Or do we just put our foot down and say 'en'? break; } } $result = parent::get($key, $replace, $modified_locale, $fallback); if ($changed_fallback) { $this->fallback = $previous_fallback; } return $result; } }