Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bug #3257 IntlExtension > Handle MissingResourceException (ruudk)
This PR was submitted for the 3.x branch but it was merged into the 2.x branch instead (closes #3257). Discussion ---------- IntlExtension > Handle MissingResourceException When you want to get the language name of a language you can type: ```twig {{ inputLanguage | language_name }} ``` But if `inputLanguage` is not a valid language, a `MissingResourceException` is thrown, blowing up the whole page. Since in Twig, there is no way to catch this exception, it becomes extremely hard to work with these helpers if you have no control over the input. There is also no way to first check if the language exists before invoking the filter. Commits ------- 2df6814 IntlExtension > Handle MissingResourceException
- Loading branch information
Showing
8 changed files
with
50 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
--TEST-- | ||
"country_timezones" function | ||
--TEMPLATE-- | ||
{{ country_timezones('UNKNOWN')|length }} | ||
{{ country_timezones('FR')|join(', ') }} | ||
{{ country_timezones('US')|join(', ') }} | ||
--DATA-- | ||
return []; | ||
--EXPECT-- | ||
0 | ||
Europe/Paris | ||
America/Adak, America/Anchorage, America/Boise, America/Chicago, America/Denver, America/Detroit, America/Indiana/Knox, America/Indiana/Marengo, America/Indiana/Petersburg, America/Indiana/Tell_City, America/Indiana/Vevay, America/Indiana/Vincennes, America/Indiana/Winamac, America/Indianapolis, America/Juneau, America/Kentucky/Monticello, America/Los_Angeles, America/Louisville, America/Menominee, America/Metlakatla, America/New_York, America/Nome, America/North_Dakota/Beulah, America/North_Dakota/Center, America/North_Dakota/New_Salem, America/Phoenix, America/Sitka, America/Yakutat, Pacific/Honolulu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
--TEST-- | ||
"currency_symbol" filter | ||
--TEMPLATE-- | ||
{{ 'UNKNOWN'|currency_symbol }} | ||
{{ 'EUR'|currency_symbol }} | ||
{{ 'JPY'|currency_symbol }} | ||
--DATA-- | ||
return []; | ||
--EXPECT-- | ||
UNKNOWN | ||
€ | ||
¥ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
--TEST-- | ||
"timezone_name" filter | ||
--TEMPLATE-- | ||
{{ 'UNKNOWN'|timezone_name }} | ||
{{ 'Europe/Paris'|timezone_name }} | ||
{{ 'America/Los_Angeles'|timezone_name }} | ||
{{ 'America/Los_Angeles'|timezone_name('fr') }} | ||
--DATA-- | ||
return []; | ||
--EXPECT-- | ||
UNKNOWN | ||
Central European Time (Paris) | ||
Pacific Time (Los Angeles) | ||
heure du Pacifique nord-américain (Los Angeles) |