"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/I18n/Formatter/IcuFormatter.php" between
cakephp-4.2.2.tar.gz and cakephp-4.2.3.tar.gz

About: CakePHP is a rapid development framework for PHP applications. Source code.

IcuFormatter.php  (cakephp-4.2.2):IcuFormatter.php  (cakephp-4.2.3)
skipping to change at line 40 skipping to change at line 40
* message. Variables are interpolated using the MessageFormatter class. * message. Variables are interpolated using the MessageFormatter class.
* *
* @param string $locale The locale in which the message is presented. * @param string $locale The locale in which the message is presented.
* @param string $message The message to be translated * @param string $message The message to be translated
* @param array $tokenValues The list of values to interpolate in the messag e * @param array $tokenValues The list of values to interpolate in the messag e
* @return string The formatted message * @return string The formatted message
* @throws \Cake\I18n\Exception\I18nException * @throws \Cake\I18n\Exception\I18nException
*/ */
public function format(string $locale, string $message, array $tokenValues): string public function format(string $locale, string $message, array $tokenValues): string
{ {
unset($tokenValues['_singular'], $tokenValues['_count']);
return $this->_formatMessage($locale, $message, $tokenValues);
}
/**
* Does the actual formatting using the MessageFormatter class
*
* @param string $locale The locale in which the message is presented.
* @param string $message The message to be translated
* @param array $tokenValues The list of values to interpolate in the messag
e
* @return string The formatted message
* @throws \Cake\I18n\Exception\I18nException If any error related to the pa
ssed
* variables is found
*/
protected function _formatMessage(string $locale, string $message, array $to
kenValues): string
{
if ($message === '') { if ($message === '') {
return $message; return $message;
} }
$formatter = new MessageFormatter($locale, $message); $formatter = new MessageFormatter($locale, $message);
$result = $formatter->format($tokenValues); $result = $formatter->format($tokenValues);
if ($result === false) { if ($result === false) {
throw new I18nException($formatter->getErrorMessage(), $formatter->g etErrorCode()); throw new I18nException($formatter->getErrorMessage(), $formatter->g etErrorCode());
} }
 End of changes. 1 change blocks. 
20 lines changed or deleted 0 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)