Show message when locale is invalid.

This commit is contained in:
James Cole
2017-09-14 16:12:07 +02:00
parent a20d9fa8f1
commit 768c7e53b4
2 changed files with 18 additions and 1 deletions

View File

@@ -98,7 +98,13 @@ class Range
$locale = array_map('trim', $locale);
setlocale(LC_TIME, $locale);
setlocale(LC_MONETARY, $locale);
$moneyResult = setlocale(LC_MONETARY, $locale);
// send error to view if could not set money format
if($moneyResult === false) {
View::share('invalidMonetaryLocale', true);
}
// save some formats:

View File

@@ -1,3 +1,13 @@
{# LOCALE ERROR MESSAGE #}
{% if invalidMonetaryLocale %}
<div class="alert alert-info alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert">
<span>&times;</span><span class="sr-only">{{ 'close'|_ }}</span>
</button>
<strong>{{ 'invalid_server_configuration'|_ }}:</strong> <i class="fa fa-money"></i> {{ 'invalid_locale_settings'|_ }}
</div>
{% endif %}
{# SUCCESS MESSAGE (ALWAYS SINGULAR) #}
{% if Session.has('success') %}
<div class="alert alert-success alert-dismissible" role="alert">
@@ -80,3 +90,4 @@
</div>
{% endif %}