We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 5e7b4fe commit 6aafff0Copy full SHA for 6aafff0
2 files changed
system/HTTP/CLIRequest.php
@@ -12,6 +12,7 @@
12
namespace CodeIgniter\HTTP;
13
14
use Config\App;
15
+use Locale;
16
use RuntimeException;
17
18
/**
@@ -280,4 +281,13 @@ private function returnNullOrEmptyArray($index)
280
281
{
282
return ($index === null || is_array($index)) ? [] : null;
283
}
284
+
285
+ /**
286
+ * Gets the current locale, with a fallback to the default
287
+ * locale if none is set.
288
+ */
289
+ public function getLocale(): string
290
+ {
291
+ return Locale::getDefault();
292
+ }
293
tests/system/HTTP/CLIRequestTest.php
@@ -611,4 +611,9 @@ public function testGetGetPost()
611
612
$this->assertSame([], $this->request->getGetPost());
613
614
615
+ public function testGetLocale()
616
617
+ $this->assertSame('en', $this->request->getLocale());
618
619
0 commit comments