Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/nextcloud.com.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJos Poortvliet <jospoortvliet@gmail.com>2018-07-30 20:25:39 +0300
committerJos Poortvliet <jospoortvliet@gmail.com>2018-07-30 20:25:39 +0300
commit3eb051a918947732c3d819274d4ecc7c487f4b01 (patch)
tree357e2f72d0ccf01acfca4037ff15e56156d1f78f /l10n.php
parentcd1f412b3506bc6c5df38820d2c06fdc7ee81d26 (diff)
update translation code to deal with xx_XX
Signed-off-by: Jos Poortvliet <jospoortvliet@gmail.com>
Diffstat (limited to 'l10n.php')
-rw-r--r--l10n.php9
1 files changed, 6 insertions, 3 deletions
diff --git a/l10n.php b/l10n.php
index 0fa0f7bc..2906f74c 100644
--- a/l10n.php
+++ b/l10n.php
@@ -37,15 +37,18 @@ class L10N {
/**
* Gets the currently used language either from the hl parameter or the current domain
+ * Checks if the length is either 2 or 5 and if it is either alphanumeric or matches the xx_XX format
*
* @return string
*/
private function getCurrentLanguage() {
$path = parse_url(site_url())['path'];
$language = explode('/', substr($_SERVER['REQUEST_URI'], strlen($path)));
- if(isset($language[1]) && strlen($language[1]) === 2) {
- if(ctype_alnum($language[1])) {
- return $language[1];
+ if(isset($language[1])) {
+ if(strlen($language[1]) === 2 || strlen($language[1]) === 5) {
+ if(ctype_alnum($language[1]) || preg_match("/^[a-z]{2}_[A-Z]{2}/",$language[1])) {
+ return $language[1];
+ }
}
}