File tree Expand file tree Collapse file tree 1 file changed +66
-0
lines changed
src/DebugBar/DataCollector Expand file tree Collapse file tree 1 file changed +66
-0
lines changed Original file line number Diff line number Diff line change 1+ <?php
2+ /*
3+ * This file is part of the DebugBar package.
4+ *
5+ * (c) 2013 Maxime Bouroumeau-Fuseau
6+ *
7+ * For the full copyright and license information, please view the LICENSE
8+ * file that was distributed with this source code.
9+ */
10+
11+ namespace DebugBar \DataCollector ;
12+
13+ use Exception ;
14+
15+ /**
16+ * Collects info about the current localization state
17+ */
18+ class LocalizationCollector extends DataCollector implements Renderable
19+ {
20+ /**
21+ * Get the current locale
22+ *
23+ * @return string
24+ */
25+ public function getLocale ()
26+ {
27+ return setlocale (LC_ALL , 0 );
28+ }
29+
30+ /**
31+ * Get the current translations domain
32+ *
33+ * @return string
34+ */
35+ public function getDomain ()
36+ {
37+ return textdomain ();
38+ }
39+
40+ public function collect ()
41+ {
42+ return array (
43+ 'locale ' => $ this ->getLocale (),
44+ 'domain ' => $ this ->getDomain (),
45+ );
46+ }
47+
48+ public function getName ()
49+ {
50+ return 'localization ' ;
51+ }
52+
53+ public function getWidgets ()
54+ {
55+ return array (
56+ 'domain ' => array (
57+ 'icon ' => 'bookmark ' ,
58+ 'map ' => 'localization.domain ' ,
59+ ),
60+ 'locale ' => array (
61+ 'icon ' => 'flag ' ,
62+ 'map ' => 'localization.locale ' ,
63+ )
64+ );
65+ }
66+ }
You can’t perform that action at this time.
0 commit comments