|
45 | 45 | use OCP\Files\Lock\ILock;
|
46 | 46 | use OCP\Files\Lock\LockContext;
|
47 | 47 | use OCP\Files\Lock\OwnerLockedException;
|
| 48 | +use OCP\IL10N; |
48 | 49 | use OCP\IRequest;
|
49 | 50 | use OCP\IUserSession;
|
50 | 51 |
|
|
55 | 56 | */
|
56 | 57 | class LockController extends OCSController {
|
57 | 58 | use TLogger;
|
58 |
| - |
59 | 59 | private IUserSession $userSession;
|
60 | 60 | private FileService $fileService;
|
61 | 61 | private LockService $lockService;
|
| 62 | + private IL10N $l10n; |
62 | 63 | private int $ocsVersion;
|
63 | 64 |
|
64 | 65 | public function __construct(
|
65 |
| - IRequest $request, IUserSession $userSession, FileService $fileService, LockService $lockService |
| 66 | + IRequest $request, |
| 67 | + IUserSession $userSession, |
| 68 | + FileService $fileService, |
| 69 | + LockService $lockService, |
| 70 | + IL10N $l10n |
66 | 71 | ) {
|
67 | 72 | parent::__construct(Application::APP_ID, $request);
|
68 | 73 | $this->userSession = $userSession;
|
69 | 74 | $this->fileService = $fileService;
|
70 | 75 | $this->lockService = $lockService;
|
| 76 | + $this->l10n = $l10n; |
71 | 77 |
|
72 | 78 | // We need to overload some implementation from the OCSController here
|
73 | 79 | // to be able to push a custom message and data when returning other
|
@@ -147,12 +153,12 @@ private function buildOCSResponse($format, DataResponse $data) {
|
147 | 153 | if ($data->getStatus() === Http::STATUS_LOCKED) {
|
148 | 154 | /** @var FileLock $lock */
|
149 | 155 | $lock = $data->getData();
|
150 |
| - $message = 'File is currently locked by ' . $lock->getOwner(); |
| 156 | + $message = $this->l10n->t('File is currently locked by %s', [$lock->getOwner()]); |
151 | 157 | }
|
152 | 158 | if ($data->getStatus() === Http::STATUS_PRECONDITION_FAILED) {
|
153 | 159 | /** @var FileLock $lock */
|
154 | 160 | $lock = $data->getData();
|
155 |
| - $message = 'File is not locked'; |
| 161 | + $message = $this->l10n->t('File is not locked'); |
156 | 162 | }
|
157 | 163 |
|
158 | 164 | $containedData = $data->getData();
|
|
0 commit comments