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 /base.php
parentcd1f412b3506bc6c5df38820d2c06fdc7ee81d26 (diff)
update translation code to deal with xx_XX
Signed-off-by: Jos Poortvliet <jospoortvliet@gmail.com>
Diffstat (limited to 'base.php')
-rw-r--r--base.php11
1 files changed, 8 insertions, 3 deletions
diff --git a/base.php b/base.php
index ad9893b3..a2e4c7e9 100644
--- a/base.php
+++ b/base.php
@@ -202,9 +202,14 @@ $echoed = false;
$hl = '';
$path = parse_url(site_url())['path'];
$language = explode('/', substr($_SERVER['REQUEST_URI'], strlen($path)));
-if(isset($language[1]) && $language[1] === 'de') {
- $hl = strtolower((string)$language[1]);
- if (ctype_alnum($hl) && strlen($hl) === 2) {
+if(isset($language[1])) { // check if language is set.
+ if (strlen($hl) == 2) {
+ $hl = strtolower((string)$language[1]); // lowercase two-character country codes
+ } else {
+ $hl = (string)$language[1];
+ }
+ // check if $hl is either a 2-character alphanumeric code or a regexp matched, 5-character xx_YY style code
+ if ( (ctype_alnum($hl) && strlen($hl) === 2) || (preg_match("/^[a-z]{2}_[A-Z]{2}/",$language[1]) && strlen($hl) == 5) ) {
$l10nFiles = [
get_post()->post_name,
'header-navbar',