Skip to content

Commit f2aaeed

Browse files
committed
Add separator argument to getLanguageLocale
Allow overriding the default separator for getLanguageLocale. It's sometimes useful to have the locale with an underscore instead of a dash.
1 parent aed2949 commit f2aaeed

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Browser/Language.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public static function getLanguage()
112112
*
113113
* @return string
114114
*/
115-
public static function getLanguageLocale()
115+
public static function getLanguageLocale($separator = '-')
116116
{
117117
if (!is_array(self::$languages)) {
118118
self::checkLanguages();
@@ -127,9 +127,9 @@ public static function getLanguageLocale()
127127
}
128128

129129
if (!empty($locale)) {
130-
return $userLanguage . "-" . strtoupper($locale);
130+
return $userLanguage . $separator . strtoupper($locale);
131131
} else {
132132
return $userLanguage;
133133
}
134134
}
135-
}
135+
}

0 commit comments

Comments
 (0)