Twig icon indicating copy to clipboard operation
Twig copied to clipboard

Add function twig *_name for intl

Open seb-jean opened this issue 3 years ago • 1 comments

Hi,

I add language_names, script_names, country_names, locale_names, currency_names, timezone_names.

It allows us to have a list but on the Twig side and to use them in filters for example.

seb-jean avatar Sep 16 '22 14:09 seb-jean

issue #3741

seb-jean avatar Sep 16 '22 14:09 seb-jean

Can you add the related docs?

fabpot avatar Sep 30 '22 07:09 fabpot

Can you add the related docs?

I just added them.

seb-jean avatar Sep 30 '22 08:09 seb-jean

maybe some utest (coverage) could be added for the new code?

SpacePossum avatar Sep 30 '22 17:09 SpacePossum

maybe some utest (coverage) could be added for the new code?

I don't know how to do it.

seb-jean avatar Sep 30 '22 17:09 seb-jean

maybe some utest (coverage) could be added for the new code?

I don't know how to do it.

You can add test files in extra/intl-extra/Tests/Fixtures and run the test command:

cd extra/intl-extra
composer install
vendor/bin/simple-phpunit

GromNaN avatar Oct 02 '22 21:10 GromNaN

maybe some utest (coverage) could be added for the new code?

I don't know how to do it.

You can add test files in extra/intl-extra/Tests/Fixtures and run the test command:

cd extra/intl-extra
composer install
vendor/bin/simple-phpunit

I just added them.

seb-jean avatar Oct 03 '22 08:10 seb-jean

It looks like tests are broken.

fabpot avatar Oct 04 '22 06:10 fabpot

The fabbot issue is wrong.

You are right but I did not touch this part of the code. fabpot.io offers me the following code:

     public function formatDateTime(Environment $env, $date, ?string $dateFormat = 'medium', ?string $timeFormat = 'medium', string $pattern = '', $timezone = null, string $calendar = 'gregorian', string $locale = null): string
     {
-        $date = \twig_date_converter($env, $date, $timezone);
+        $date = twig_date_converter($env, $date, $timezone);
         $formatter = $this->createDateFormatter($locale, $dateFormat, $timeFormat, $pattern, $date->getTimezone(), $calendar);
 
         if (false === $ret = $formatter->format($date)) 

Otherwise, this is the link: https://fabbot.io/patch/twigphp/Twig/3742/cf584f042bf16324db8b8a7a74e067d2e41f03e8/cs.diff

seb-jean avatar Oct 04 '22 06:10 seb-jean

It looks like tests are broken.

Tests fail due to line break (\r, \r\n) I don't see how I could do better to pass the tests.

seb-jean avatar Oct 04 '22 09:10 seb-jean

@seb-jean Thank you fo all the changes. I'm going to take over the tests changes before merging the PR (I'd like to have it for the next versions that I'm going to release soon).

fabpot avatar Dec 27 '22 11:12 fabpot

Thank you @seb-jean.

fabpot avatar Dec 27 '22 11:12 fabpot

Thanks to the people who helped me build this PR.

seb-jean avatar Dec 27 '22 12:12 seb-jean