summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/base.php5
-rw-r--r--lib/private/app.php4
-rw-r--r--lib/private/avatar.php4
-rw-r--r--lib/private/defaults.php2
-rw-r--r--lib/private/installer.php6
-rw-r--r--lib/private/json.php12
-rw-r--r--lib/private/l10n/factory.php7
-rw-r--r--lib/private/server.php5
-rw-r--r--lib/private/setup.php2
-rw-r--r--lib/private/share/mailnotifications.php2
-rw-r--r--lib/private/share/share.php10
-rw-r--r--lib/private/tags.php2
-rw-r--r--lib/private/template.php2
-rw-r--r--lib/private/template/functions.php2
-rw-r--r--lib/private/user/manager.php2
-rwxr-xr-xlib/private/util.php10
-rw-r--r--lib/public/files/locknotacquiredexception.php4
-rw-r--r--lib/public/util.php2
18 files changed, 43 insertions, 40 deletions
diff --git a/lib/base.php b/lib/base.php
index 0539814589e..176f799f94d 100644
--- a/lib/base.php
+++ b/lib/base.php
@@ -193,7 +193,7 @@ class OC {
}
public static function checkConfig() {
- $l = OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
if (file_exists(self::$configDir . "/config.php")
and !is_writable(self::$configDir . "/config.php")
) {
@@ -574,7 +574,7 @@ class OC {
// Check whether the sample configuration has been copied
if(OC_Config::getValue('copied_sample_config', false)) {
- $l = \OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
header('HTTP/1.1 503 Service Temporarily Unavailable');
header('Status: 503 Service Temporarily Unavailable');
OC_Template::printErrorPage(
@@ -672,7 +672,6 @@ class OC {
* Handle the request
*/
public static function handleRequest() {
- $l = \OC_L10N::get('lib');
// load all the classpaths from the enabled apps so they are available
// in the routing files of each app
OC::loadAppClassPaths();
diff --git a/lib/private/app.php b/lib/private/app.php
index 70f8980d2c1..d10d352b432 100644
--- a/lib/private/app.php
+++ b/lib/private/app.php
@@ -359,7 +359,7 @@ class OC_App {
* entries are sorted by the key 'order' ascending.
*/
public static function getSettingsNavigation() {
- $l = OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
$settings = array();
// by default, settings only contain the help menu
@@ -1094,7 +1094,7 @@ class OC_App {
* @throws Exception if no app-name was specified
*/
public static function installApp($app) {
- $l = OC_L10N::get('core');
+ $l = \OC::$server->getL10N('core');
$appData=OC_OCSClient::getApplication($app);
// check if app is a shipped app or not. OCS apps have an integer as id, shipped apps use a string
diff --git a/lib/private/avatar.php b/lib/private/avatar.php
index 2286b896878..a9d9346d50a 100644
--- a/lib/private/avatar.php
+++ b/lib/private/avatar.php
@@ -62,12 +62,12 @@ class OC_Avatar implements \OCP\IAvatar {
$type = 'jpg';
}
if ($type !== 'jpg' && $type !== 'png') {
- $l = \OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
throw new \Exception($l->t("Unknown filetype"));
}
if (!$img->valid()) {
- $l = \OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
throw new \Exception($l->t("Invalid image"));
}
diff --git a/lib/private/defaults.php b/lib/private/defaults.php
index dfd114cd2fe..3996cc081ed 100644
--- a/lib/private/defaults.php
+++ b/lib/private/defaults.php
@@ -27,7 +27,7 @@ class OC_Defaults {
private $defaultMailHeaderColor;
function __construct() {
- $this->l = OC_L10N::get('lib');
+ $this->l = \OC::$server->getL10N('lib');
$version = OC_Util::getVersion();
$this->defaultEntity = 'ownCloud'; /* e.g. company name, used for footers and copyright notices */
diff --git a/lib/private/installer.php b/lib/private/installer.php
index dc9a3558b75..02e2190aaf2 100644
--- a/lib/private/installer.php
+++ b/lib/private/installer.php
@@ -62,7 +62,7 @@ class OC_Installer{
* @return integer
*/
public static function installApp( $data = array()) {
- $l = \OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
list($extractDir, $path) = self::downloadApp($data);
$info = self::checkAppsIntegrity($data, $extractDir, $path);
@@ -229,7 +229,7 @@ class OC_Installer{
* @throws Exception
*/
public static function downloadApp($data = array()) {
- $l = \OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
if(!isset($data['source'])) {
throw new \Exception($l->t("No source specified when installing app"));
@@ -285,7 +285,7 @@ class OC_Installer{
* @throws \Exception
*/
public static function checkAppsIntegrity($data = array(), $extractDir, $path, $isShipped=false) {
- $l = \OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
//load the info.xml file of the app
if(!is_file($extractDir.'/appinfo/info.xml')) {
//try to find it in a subdir
diff --git a/lib/private/json.php b/lib/private/json.php
index da38654997f..f2719dd2bc7 100644
--- a/lib/private/json.php
+++ b/lib/private/json.php
@@ -25,7 +25,7 @@ class OC_JSON{
*/
public static function checkAppEnabled($app) {
if( !OC_App::isEnabled($app)) {
- $l = OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
self::error(array( 'data' => array( 'message' => $l->t('Application is not enabled'), 'error' => 'application_not_enabled' )));
exit();
}
@@ -36,7 +36,7 @@ class OC_JSON{
*/
public static function checkLoggedIn() {
if( !OC_User::isLoggedIn()) {
- $l = OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' )));
exit();
}
@@ -47,7 +47,7 @@ class OC_JSON{
*/
public static function callCheck() {
if( !OC_Util::isCallRegistered()) {
- $l = OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
self::error(array( 'data' => array( 'message' => $l->t('Token expired. Please reload page.'), 'error' => 'token_expired' )));
exit();
}
@@ -58,7 +58,7 @@ class OC_JSON{
*/
public static function checkAdminUser() {
if( !OC_User::isAdminUser(OC_User::getUser())) {
- $l = OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' )));
exit();
}
@@ -70,7 +70,7 @@ class OC_JSON{
*/
public static function checkUserExists($user) {
if (!OCP\User::userExists($user)) {
- $l = OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
OCP\JSON::error(array('data' => array('message' => $l->t('Unknown user'), 'error' => 'unknown_user' )));
exit;
}
@@ -83,7 +83,7 @@ class OC_JSON{
*/
public static function checkSubAdminUser() {
if(!OC_SubAdmin::isSubAdmin(OC_User::getUser())) {
- $l = OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
self::error(array( 'data' => array( 'message' => $l->t('Authentication error'), 'error' => 'authentication_error' )));
exit();
}
diff --git a/lib/private/l10n/factory.php b/lib/private/l10n/factory.php
index d0c3799b9c2..fcc3f3e3394 100644
--- a/lib/private/l10n/factory.php
+++ b/lib/private/l10n/factory.php
@@ -20,12 +20,15 @@ class Factory {
/**
* get an L10N instance
+ *
* @param string $app
* @param string|null $lang
* @return \OC_L10N
*/
- public function get($app) {
- if (!isset($this->instances[$app])) {
+ public function get($app, $lang = null) {
+ if (!is_null($lang)) {
+ return new \OC_L10N($app, $lang);
+ } else if (!isset($this->instances[$app])) {
$this->instances[$app] = new \OC_L10N($app);
}
return $this->instances[$app];
diff --git a/lib/private/server.php b/lib/private/server.php
index 53aab7a586a..bf1801a5ce8 100644
--- a/lib/private/server.php
+++ b/lib/private/server.php
@@ -369,10 +369,11 @@ class Server extends SimpleContainer implements IServerContainer {
* get an L10N instance
*
* @param string $app appid
+ * @param string $lang
* @return \OC_L10N
*/
- function getL10N($app) {
- return $this->query('L10NFactory')->get($app);
+ function getL10N($app, $lang = null) {
+ return $this->query('L10NFactory')->get($app, $lang);
}
/**
diff --git a/lib/private/setup.php b/lib/private/setup.php
index fdf98ab0959..2e23aae8838 100644
--- a/lib/private/setup.php
+++ b/lib/private/setup.php
@@ -15,7 +15,7 @@ class OC_Setup {
);
public static function getTrans(){
- return OC_L10N::get('lib');
+ return \OC::$server->getL10N('lib');
}
public static function install($options) {
diff --git a/lib/private/share/mailnotifications.php b/lib/private/share/mailnotifications.php
index 1f4645eed9f..4a92503bdd3 100644
--- a/lib/private/share/mailnotifications.php
+++ b/lib/private/share/mailnotifications.php
@@ -52,7 +52,7 @@ class MailNotifications {
* @param string $sender user id (if nothing is set we use the currently logged-in user)
*/
public function __construct($sender = null) {
- $this->l = \OC_L10N::get('core');
+ $this->l = \OC::$server->getL10N('core');
$this->senderId = $sender;
diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index c3593beac45..e2e9b94125e 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -479,7 +479,7 @@ class Share extends \OC\Share\Constants {
public static function shareItem($itemType, $itemSource, $shareType, $shareWith, $permissions, $itemSourceName = null, \DateTime $expirationDate = null) {
$uidOwner = \OC_User::getUser();
$shareWithinGroupOnly = self::shareWithGroupMembersOnly();
- $l = \OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
if (is_null($itemSourceName)) {
$itemSourceName = $itemSource;
@@ -849,7 +849,7 @@ class Share extends \OC\Share\Constants {
* @return boolean true on success or false on failure
*/
public static function setPermissions($itemType, $itemSource, $shareType, $shareWith, $permissions) {
- $l = \OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
if ($item = self::getItems($itemType, $itemSource, $shareType, $shareWith,
\OC_User::getUser(), self::FORMAT_NONE, null, 1, false)) {
// Check if this item is a reshare and verify that the permissions
@@ -938,7 +938,7 @@ class Share extends \OC\Share\Constants {
* @throws \Exception
*/
private static function validateExpireDate($expireDate, $shareTime, $itemType, $itemSource) {
- $l = \OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
$date = new \DateTime($expireDate);
$today = new \DateTime('now');
@@ -1083,7 +1083,7 @@ class Share extends \OC\Share\Constants {
* @return \OCP\Share_Backend
*/
public static function getBackend($itemType) {
- $l = \OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
if (isset(self::$backends[$itemType])) {
return self::$backends[$itemType];
} else if (isset(self::$backendTypes[$itemType]['class'])) {
@@ -1516,7 +1516,7 @@ class Share extends \OC\Share\Constants {
private static function put($itemType, $itemSource, $shareType, $shareWith, $uidOwner,
$permissions, $parentFolder = null, $token = null, $itemSourceName = null, \DateTime $expirationDate = null) {
$backend = self::getBackend($itemType);
- $l = \OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
// Check if this is a reshare
if ($checkReshare = self::getItemSharedWithBySource($itemType, $itemSource, self::FORMAT_NONE, null, true)) {
diff --git a/lib/private/tags.php b/lib/private/tags.php
index 0b62caf2dd8..0e58789ecd5 100644
--- a/lib/private/tags.php
+++ b/lib/private/tags.php
@@ -178,7 +178,7 @@ class Tags implements \OCP\ITags {
}
if($tagId === false) {
- $l10n = \OC_L10N::get('core');
+ $l10n = \OC::$server->getL10N('core');
throw new \Exception(
$l10n->t('Could not find category "%s"', $tag)
);
diff --git a/lib/private/template.php b/lib/private/template.php
index 73fa53a2fa3..d95943a714c 100644
--- a/lib/private/template.php
+++ b/lib/private/template.php
@@ -56,7 +56,7 @@ class OC_Template extends \OC\Template\Base {
$requesttoken = (OC::$server->getSession() and $registerCall) ? OC_Util::callRegister() : '';
$parts = explode('/', $app); // fix translation when app is something like core/lostpassword
- $l10n = OC_L10N::get($parts[0]);
+ $l10n = \OC::$server->getL10N($parts[0]);
$themeDefaults = new OC_Defaults();
list($path, $template) = $this->findTemplate($theme, $app, $name, $fext);
diff --git a/lib/private/template/functions.php b/lib/private/template/functions.php
index 46e48274001..3cbf0d9748f 100644
--- a/lib/private/template/functions.php
+++ b/lib/private/template/functions.php
@@ -117,7 +117,7 @@ function strip_time($timestamp){
* @return OC_L10N_String timestamp
*/
function relative_modified_date($timestamp, $fromTime = null, $dateOnly = false) {
- $l=OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
if (!isset($fromTime) || $fromTime === null){
$fromTime = time();
}
diff --git a/lib/private/user/manager.php b/lib/private/user/manager.php
index a54755e71c5..5c155c27aba 100644
--- a/lib/private/user/manager.php
+++ b/lib/private/user/manager.php
@@ -237,7 +237,7 @@ class Manager extends PublicEmitter implements IUserManager {
* @return bool|\OC\User\User the created user of false
*/
public function createUser($uid, $password) {
- $l = \OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
// Check the name for bad characters
// Allowed are: "a-z", "A-Z", "0-9" and "_.@-"
if (preg_match('/[^a-zA-Z0-9 _\.@\-]/', $uid)) {
diff --git a/lib/private/util.php b/lib/private/util.php
index ad078e8a44c..adb7fb83d28 100755
--- a/lib/private/util.php
+++ b/lib/private/util.php
@@ -392,7 +392,7 @@ class OC_Util {
$offset = $clientTimeZone - $systemTimeZone;
$timestamp = $timestamp + $offset * 60;
}
- $l = OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
return $l->l($dateOnly ? 'date' : 'datetime', $timestamp);
}
@@ -402,7 +402,7 @@ class OC_Util {
* @return array arrays with error messages and hints
*/
public static function checkServer() {
- $l = OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
$errors = array();
$CONFIG_DATADIRECTORY = OC_Config::getValue('datadirectory', OC::$SERVERROOT . '/data');
@@ -626,7 +626,7 @@ class OC_Util {
* @return array errors array
*/
public static function checkDatabaseVersion() {
- $l = OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
$errors = array();
$dbType = \OC_Config::getValue('dbtype', 'sqlite');
if ($dbType === 'pgsql') {
@@ -707,7 +707,7 @@ class OC_Util {
* @return array arrays with error messages and hints
*/
public static function checkDataDirectoryPermissions($dataDirectory) {
- $l = OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
$errors = array();
if (self::runningOnWindows()) {
//TODO: permissions checks for windows hosts
@@ -738,7 +738,7 @@ class OC_Util {
* @return bool true if the data directory is valid, false otherwise
*/
public static function checkDataDirectoryValidity($dataDirectory) {
- $l = OC_L10N::get('lib');
+ $l = \OC::$server->getL10N('lib');
$errors = array();
if (!file_exists($dataDirectory . '/.ocdata')) {
$errors[] = array(
diff --git a/lib/public/files/locknotacquiredexception.php b/lib/public/files/locknotacquiredexception.php
index 9fb70e7cbe2..647b07bf878 100644
--- a/lib/public/files/locknotacquiredexception.php
+++ b/lib/public/files/locknotacquiredexception.php
@@ -36,7 +36,7 @@ class LockNotAcquiredException extends \Exception {
public $lockType;
public function __construct($path, $lockType, $code = 0, \Exception $previous = null) {
- $message = \OC_L10N::get('core')->t('Could not obtain lock type %d on "%s".', array($lockType, $path));
+ $message = \OC::$server->getL10N('core')->t('Could not obtain lock type %d on "%s".', array($lockType, $path));
parent::__construct($message, $code, $previous);
}
@@ -44,4 +44,4 @@ class LockNotAcquiredException extends \Exception {
public function __toString() {
return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
}
-} \ No newline at end of file
+}
diff --git a/lib/public/util.php b/lib/public/util.php
index 87b7a4f19db..bc1b90a2c89 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -132,7 +132,7 @@ class Util {
* @return \OC_L10N
*/
public static function getL10N($application, $language = null) {
- return \OC_L10N::get($application, $language);
+ return \OC::$server->getL10N($application, $language);
}
/**