Merge pull request #8209 from owncloud/set-language-explicitly-master
Set language explicitly master
This commit is contained in:
commit
242b3e240d
|
@ -418,6 +418,14 @@ class OC_L10N implements \OCP\IL10N {
|
||||||
return $text[$lang];
|
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
|
* @brief find the best language
|
||||||
* @param array|string $app details below
|
* @param array|string $app details below
|
||||||
|
|
|
@ -30,6 +30,9 @@ try {
|
||||||
// load all apps to get all api routes properly setup
|
// load all apps to get all api routes properly setup
|
||||||
OC_App::loadApps();
|
OC_App::loadApps();
|
||||||
|
|
||||||
|
// api calls always will return English
|
||||||
|
\OC_L10N::forceLanguage('en');
|
||||||
|
|
||||||
OC::$server->getRouter()->match('/ocs'.OC_Request::getRawPathInfo());
|
OC::$server->getRouter()->match('/ocs'.OC_Request::getRawPathInfo());
|
||||||
} catch (ResourceNotFoundException $e) {
|
} catch (ResourceNotFoundException $e) {
|
||||||
OC_API::setContentType();
|
OC_API::setContentType();
|
||||||
|
|
Loading…
Reference in New Issue