File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change 1212namespace CodeIgniter \HTTP ;
1313
1414use Config \App ;
15+ use Locale ;
1516use RuntimeException ;
1617
1718/**
@@ -280,4 +281,13 @@ private function returnNullOrEmptyArray($index)
280281 {
281282 return ($ index === null || is_array ($ index )) ? [] : null ;
282283 }
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+ }
283293}
Original file line number Diff line number Diff line change @@ -611,4 +611,9 @@ public function testGetGetPost()
611611 {
612612 $ this ->assertSame ([], $ this ->request ->getGetPost ());
613613 }
614+
615+ public function testGetLocale ()
616+ {
617+ $ this ->assertSame ('en ' , $ this ->request ->getLocale ());
618+ }
614619}
You can’t perform that action at this time.
0 commit comments