mirror of
https://github.com/maximebf/php-debugbar.git
synced 2025-01-17 13:28:35 +01:00
Add LocalizationCollector
This commit is contained in:
parent
14464b3781
commit
b3b5aae685
66
src/DebugBar/DataCollector/LocalizationCollector.php
Normal file
66
src/DebugBar/DataCollector/LocalizationCollector.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/*
|
||||
* This file is part of the DebugBar package.
|
||||
*
|
||||
* (c) 2013 Maxime Bouroumeau-Fuseau
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace DebugBar\DataCollector;
|
||||
|
||||
use Exception;
|
||||
|
||||
/**
|
||||
* Collects info about the current localization state
|
||||
*/
|
||||
class LocalizationCollector extends DataCollector implements Renderable
|
||||
{
|
||||
/**
|
||||
* Get the current locale
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getLocale()
|
||||
{
|
||||
return setlocale(LC_ALL, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current translations domain
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getDomain()
|
||||
{
|
||||
return textdomain();
|
||||
}
|
||||
|
||||
public function collect()
|
||||
{
|
||||
return array(
|
||||
'locale' => $this->getLocale(),
|
||||
'domain' => $this->getDomain(),
|
||||
);
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return 'localization';
|
||||
}
|
||||
|
||||
public function getWidgets()
|
||||
{
|
||||
return array(
|
||||
'domain' => array(
|
||||
'icon' => 'bookmark',
|
||||
'map' => 'localization.domain',
|
||||
),
|
||||
'locale' => array(
|
||||
'icon' => 'flag',
|
||||
'map' => 'localization.locale',
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user