Skip to content

Commit

Permalink
Merge pull request #128 from ARCANEDEV/update-1
Browse files Browse the repository at this point in the history
Customizing UTF-8 suffix
  • Loading branch information
arcanedev-maroc authored Sep 4, 2018
2 parents 0c7bb4e + 69c1241 commit bd087f4
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion _docs/2-Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<?php

return [

'supported-locales' => ['en', 'es', 'fr'],

'accept-language-header' => true,
Expand All @@ -23,6 +24,8 @@ return [

'facade' => 'Localization',

'utf-8-suffix' => '.UTF-8',

//...
```

Expand All @@ -32,7 +35,7 @@ return [
| accept-language-header | Using the locale negotiator to get locale from `Accept-Language` header. |
| hide-default-in-url | If `true`, the non localized root is treated as the application's default locale (`app.locale`). |
| facade | The alias name for the facade. |

|| Locale suffix for LC_TIME and LC_MONETARY: Defaults to most common ".UTF-8". Set to blank on Windows systems, change to ".utf8" on CentOS and similar. |
## Route

```php
Expand Down
3 changes: 3 additions & 0 deletions config/localization.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

'facade' => 'Localization',

'utf-8-suffix' => '.UTF-8',

/* -----------------------------------------------------------------
| Route
| -----------------------------------------------------------------
Expand Down Expand Up @@ -2148,4 +2150,5 @@
'regional' => 'zu_ZA',
],
],

];
6 changes: 4 additions & 2 deletions src/Utilities/LocalesManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,10 @@ private function updateRegional()
$currentLocale = $this->getCurrentLocaleEntity();

if ( ! empty($regional = $currentLocale->regional())) {
setlocale(LC_TIME, "$regional.UTF-8");
setlocale(LC_MONETARY, "$regional.UTF-8");
$suffix = $this->getConfig('utf-8-suffix', '.UTF-8');

setlocale(LC_TIME, $regional.$suffix);
setlocale(LC_MONETARY, $regional.$suffix);
}
}
}

0 comments on commit bd087f4

Please sign in to comment.