From e125dc60cda3ad3bdbee1ebfc075669f5b808600 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Tue, 15 Apr 2014 15:12:25 +0200 Subject: [PATCH 1/2] introduce new function to force a language --- lib/private/l10n.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/private/l10n.php b/lib/private/l10n.php index 175360e27a..a397945b82 100644 --- a/lib/private/l10n.php +++ b/lib/private/l10n.php @@ -418,6 +418,14 @@ class OC_L10N implements \OCP\IL10N { return $text[$lang]; } + /** + * The given language is forced to be used while executing the current request + * @param string $lang + */ + public static function forceLanguage($lang) { + self::$language = $lang; + } + /** * @brief find the best language * @param array|string $app details below From 596177727afbab9950d29d44af94e4d03814ce72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= Date: Tue, 15 Apr 2014 15:32:08 +0200 Subject: [PATCH 2/2] OCS API calls will always return English messages --- ocs/v1.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ocs/v1.php b/ocs/v1.php index 62a3511e61..d69904fc49 100644 --- a/ocs/v1.php +++ b/ocs/v1.php @@ -30,6 +30,9 @@ try { // load all apps to get all api routes properly setup OC_App::loadApps(); + // api calls always will return English + \OC_L10N::forceLanguage('en'); + OC::$server->getRouter()->match('/ocs'.OC_Request::getRawPathInfo()); } catch (ResourceNotFoundException $e) { OC_API::setContentType();