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:
authorLukas Reschke <lukas@statuscode.ch>2016-11-09 23:53:47 +0300
committerLukas Reschke <lukas@statuscode.ch>2016-11-10 13:03:05 +0300
commit913dee125adea39abec363f55e2fb54a42e0c9b8 (patch)
tree9e4d2e4fad01b51e42b0063b8ef6580b1fdba84e /functions.php
parent1b97eccca1e8f21fa832227036c6e110c4808688 (diff)
Use /de/ for DE
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/functions.php b/functions.php
index cd8d1eb4..683d25d1 100644
--- a/functions.php
+++ b/functions.php
@@ -15,4 +15,18 @@ require_once locate_template('/lib/gallery.php'); // Custom [gallery] mo
require_once locate_template('/lib/comments.php'); // Custom comments modifications
require_once locate_template('/lib/relative-urls.php'); // Root relative URLs
require_once locate_template('/lib/widgets.php'); // Sidebars and widgets
-require_once locate_template('/lib/custom.php'); // Custom functions \ No newline at end of file
+require_once locate_template('/lib/custom.php'); // Custom functions
+
+function translationUrlFilter($url, $path, $orig_scheme, $blog_id) {
+ $path = parse_url(site_url())['path'];
+ $language = explode('/', substr($_SERVER['REQUEST_URI'], strlen($path)));
+ if(isset($language[1]) && $language[1] === 'de') {
+ $url = explode('/', $url);
+ $languageEntry = ['de'];
+ array_splice($url, 4, 0, $languageEntry);
+ return implode('/', $url);
+ }
+ return $url;
+}
+
+add_filter('home_url', 'translationUrlFilter');