Completed
Push — master ( 5c52af...d1103e )
by Sander
16s
created

TranslationController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 383
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 96.79%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 383
ccs 271
cts 280
cp 0.9679
rs 10
wmc 2
lcom 1
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 12 1
B getLanguageStrings() 0 360 1
1
<?php
2
/**
3
 * Nextcloud - passman
4
 *
5
 * This file is licensed under the Affero General Public License version 3 or
6
 * later. See the COPYING file.
7
 *
8
 * @author Sander Brand <[email protected]>
9
 * @copyright Sander Brand 2016
10
 */
11
12
namespace OCA\Passman\Controller;
13
14
use OCP\IRequest;
15
use OCP\AppFramework\Http\JSONResponse;
16
use OCP\AppFramework\ApiController;
17
use OCP\IL10N;
18
19
class TranslationController extends ApiController {
20
	private $trans;
21
22
	public function __construct($AppName,
23
								IRequest $request,
24
								IL10N $trans
25
	) {
26
		parent::__construct(
27
			$AppName,
28
			$request,
29
			'GET, POST, DELETE, PUT, PATCH, OPTIONS',
30
			'Authorization, Content-Type, Accept',
31
			86400);
32
		$this->trans = $trans;
33
	}
34
35
36
	/**
37
	 * @NoAdminRequired
38
	 * @NoCSRFRequired
39
	 * @PublicPage
40
	 */
41 1
	public function getLanguageStrings() {
42
		$translations = array(
43
			// js/app/controllers/bookmarklet.js
44 1
			'generating.sharing.keys' =>  $this->trans->t('Generating sharing keys ( %s / 2)','%step'),
45 1
			'invalid.vault.key' => $this->trans->t('Incorrect vault password!'),
46 1
			'password.do.not.match' => $this->trans->t('Passwords do not match'),
47 1
			'general' => $this->trans->t('General'),
48 1
			'custom.fields' => $this->trans->t('Custom Fields'),
49 1
			'error.no.label' => $this->trans->t('Please fill in a label.'),
50 1
			'error.no.value' => $this->trans->t('Please fill in a value.'),
51 1
			'error.loading.file' => $this->trans->t('Error loading file'),
52
53
			// js/app/controllers/credential.js
54 1
			'error.decrypt' => $this->trans->t('An error occurred during decryption'),
55 1
			'credential.created' => $this->trans->t('Credential created!'),
56 1
			'credential.deleted' => $this->trans->t('Credential deleted'),
57 1
			'credential.updated' => $this->trans->t('Credential updated'),
58 1
			'credential.recovered' => $this->trans->t('Credential recovered'),
59 1
			'credential.destroyed' => $this->trans->t('Credential destroyed'),
60 1
			'error.loading.file.perm' => $this->trans->t('Error downloading file, you probably don\'t have sufficient permissions'),
61
62
			// js/app/controllers/edit_credential.js
63 1
			'invalid.qr' => $this->trans->t('Invalid QR code'),
64
65
			// js/app/controllers/export.js
66 1
			'export.starting' => $this->trans->t('Starting export'),
67 1
			'export.decrypt' => $this->trans->t('Decrypting credentials'),
68 1
			'done' => $this->trans->t('Done'),
69
70
			// js/app/controllers/import.js
71 1
			'import.file.read' => $this->trans->t('File read successfully.'),
72 1
			'import.steps' => $this->trans->t('Proceed with the following steps to import your file'),
73
74 1
			'import.no.label' => $this->trans->t('Credential has no label, skipping'),
75 1
			'import.adding' => $this->trans->t('Adding {{credential}}'),
76 1
			'import.added' => $this->trans->t('Added {{credential}}'),
77 1
			'import.skipping' => $this->trans->t('Skipping credential, missing label on line {{line}}'),
78 1
			'import.loaded' => $this->trans->t('Parsed {{num}} credentials, starting to import'),
79 1
			'import.importing' => $this->trans->t('Importing'),
80 1
			'import.start' => $this->trans->t('Start import'),
81
82 1
			'select.csv' => $this->trans->t('Select CSV file'),
83 1
			'parsed.csv.rows' => $this->trans->t('Parsed {{rows}} lines from CSV file'),
84 1
			'skip.first.row' => $this->trans->t('Skip first row'),
85 1
			'import.csv.label.req' => $this->trans->t('You need to assign the label field before you can start the import.'),
86 1
			'first.five.lines' => $this->trans->t('The first 5 lines of the CSV are shown.'),
87 1
			'assign.column' => $this->trans->t('Assign the proper fields to each column.'),
88 1
			'example.credential' => $this->trans->t('Example of imported credential'),
89 1
			'missing.importer' => $this->trans->t('Missing an importer? Try it with the generic CSV importer.'),
90 1
			'missing.importer.back' => $this->trans->t('Go back to importers.'),
91
92
93
			// js/app/controllers/revision.js
94 1
			'revision.deleted' => $this->trans->t('Revision deleted'),
95 1
			'revision.restored' => $this->trans->t('Revision restored'),
96
97
			// js/app/controllers/settings.js
98 1
			'bookmarklet.text' => $this->trans->t('Save in Passman'),
99 1
			'settings.saved' => $this->trans->t('Settings saved'),
100 1
			'settings.general' => $this->trans->t('General settings'),
101 1
			'settings.audit' => $this->trans->t('Password audit'),
102 1
			'settings.password' => $this->trans->t('Password settings'),
103 1
			'settings.import' => $this->trans->t('Import credentials'),
104 1
			'settings.export' => $this->trans->t('Export credentials'),
105 1
			'settings.sharing' => $this->trans->t('Sharing'),
106 1
			'changepw.navigate.away.warning' => $this->trans->t('Are you sure you want to leave? This will destroy all your credentials'),
107 1
			'incorrect.password' => $this->trans->t('Your old password is incorrect!'),
108 1
			'password.no.match' => $this->trans->t('New password does not match!'),
109 1
			'login.new.pass' => $this->trans->t('Please log in with your new vault password'),
110
111
			// js/app/controllers/share.js
112 1
			'share.u.g' => $this->trans->t('Share with users and groups'),
113 1
			'share.link' => $this->trans->t('Share link'),
114 1
			'share.navigate.away.warning' => $this->trans->t('Are you sure you want to leave? This will corrupt this credential'),
115 1
			'credential.unshared' => $this->trans->t('Credential unshared'),
116 1
			'credential.shared' => $this->trans->t('Credential shared'),
117 1
			'saved' => $this->trans->t('Saved!'),
118
119
			// js/app/controllers/vault.js
120 1
			'password.poor' => $this->trans->t('Poor'),
121 1
			'password.weak' => $this->trans->t('Weak'),
122 1
			'password.good' => $this->trans->t('Good'),
123 1
			'password.strong' => $this->trans->t('Strong'),
124
			// js/app/directives/credentialfield.js
125 1
			'toggle.visibility' => $this->trans->t('Toggle visibility'),
126 1
			'copy.field' => $this->trans->t('Copy to clipboard'),
127 1
			'copied' => $this->trans->t('Copied to clipboard!'),
128
129
			// js/app/directives/passwordgen.js
130 1
			'password.gen' => $this->trans->t('Generate password'),
131 1
			'password.copy' => $this->trans->t('Copy password to clipboard'),
132 1
			'password.copied' => $this->trans->t('Password copied to clipboard!'),
133
134
			// js/app/directives/progressbar.js
135 1
			'complete' => $this->trans->t('Complete'),
136
137
138
			// templates/views/partials/edit_credential/basics.html
139 1
			'username' => $this->trans->t('Username'),
140 1
			'password.r' => $this->trans->t('Repeat password'),
141 1
			'add.tag' => $this->trans->t('Add tag'),
142
143
			// templates/views/partials/edit_credential/custom_fields.html
144 1
			'field.label' => $this->trans->t('Field label'),
145 1
			'field.value' => $this->trans->t('Field value'),
146 1
			'select.file' => $this->trans->t('Choose a file'),
147 1
			'text' => $this->trans->t('Text'),
148 1
			'file' => $this->trans->t('File'),
149 1
			'add' => $this->trans->t('Add'),
150 1
			'value' => $this->trans->t('Value'),
151 1
			'type' => $this->trans->t('Type'),
152 1
			'actions' => $this->trans->t('Actions'),
153 1
			'empty' => $this->trans->t('Empty'),
154
155
			// templates/views/partials/edit_credential/files.html
156 1
			'file.name' => $this->trans->t('Filename'),
157 1
			'upload.date' => $this->trans->t('Upload date'),
158 1
			'size' => $this->trans->t('Size'),
159
160
161
			// templates/views/partials/edit_credential/otp.html
162 1
			'upload.qr' => $this->trans->t('Upload or enter your OTP secret'),
163 1
			'current.qr' => $this->trans->t('Current OTP settings'),
164 1
			'issuer' => $this->trans->t('Issuer'),
165 1
			'secret' => $this->trans->t('Secret'),
166
167
168
			// templates/views/partials/edit_credential/password.html
169 1
			'expire.date' => $this->trans->t('Expiration date'),
170 1
			'no.expire.date' => $this->trans->t('No expiration date set'),
171 1
			'renew.interval' => $this->trans->t('Renew interval'),
172 1
			'disabled' => $this->trans->t('Disabled'),
173 1
			'days' => $this->trans->t('Day(s)'),
174 1
			'weeks' => $this->trans->t('Week(s)'),
175 1
			'months' => $this->trans->t('Month(s)'),
176 1
			'years' => $this->trans->t('Year(s)'),
177 1
			'generation.settings' => $this->trans->t('Password generation settings'),
178 1
			'password.generation.length' => $this->trans->t('Password length'),
179 1
			'password.generation.min_digits' => $this->trans->t('Minimum amount of digits'),
180 1
			'password.generation.uppercase' => $this->trans->t('Use uppercase letters'),
181 1
			'password.generation.lowercase' => $this->trans->t('Use lowercase letters'),
182 1
			'password.generation.digits' => $this->trans->t('Use numbers'),
183 1
			'password.generation.special' => $this->trans->t('Use special characters'),
184 1
			'password.generation.ambiguous' => $this->trans->t('Avoid ambiguous characters'),
185 1
			'password.generation.require_same' => $this->trans->t('Require every character type'),
186
187
188
			// templates/views/partials/forms/settings/export.html
189 1
			'export.type' => $this->trans->t('Export type'),
190 1
			'export' => $this->trans->t('Export'),
191 1
			'export.confirm.text' => $this->trans->t('Enter vault password to confirm export.'),
192
193
			// templates/views/partials/forms/settings/general_settings.html
194 1
			'rename.vault' => $this->trans->t('Rename vault'),
195 1
			'rename.vault.name' => $this->trans->t('New vault name'),
196 1
			'change' => $this->trans->t('Change'),
197 1
			'change.vault.key' => $this->trans->t('Change vault key'),
198 1
			'old.vault.password' => $this->trans->t('Old vault password'),
199 1
			'new.vault.password' => $this->trans->t('New vault password'),
200 1
			'new.vault.pw.r' => $this->trans->t('Repeat new vault password'),
201 1
			'warning.leave' => $this->trans->t('Please wait your vault is being updated, do not leave this page.'),
202 1
			'processing' => $this->trans->t('Processing'),
203 1
			'total.progress' => $this->trans->t('Total progress'),
204 1
			'about.passman' => $this->trans->t('About Passman'),
205 1
			'version' => $this->trans->t('Version'),
206 1
			'donate.support' => $this->trans->t('Donate to support development'),
207 1
			'bookmarklet' => $this->trans->t('Bookmarklet'),
208 1
			'bookmarklet.info1' => $this->trans->t('Save your passwords with 1 click!'),
209 1
			'bookmarklet.info2' => $this->trans->t('Drag below button to your bookmark toolbar.'),
210 1
			'delete.vault' => $this->trans->t('Delete vault'),
211 1
			'vault.password' => $this->trans->t('Vault password'),
212 1
			'vault.remove.notice' => $this->trans->t('This process is irreversible'),
213 1
			'delete.vault.checkbox' => $this->trans->t('Delete my precious passwords'),
214 1
			'deleting.pw' => $this->trans->t('Deleting {{password}}…'),
215 1
			'delete.vault.confirm' => $this->trans->t('Yes, delete my precious passwords'),
216
217
218
			// templates/views/partials/forms/settings/import.html
219 1
			'import.type' => $this->trans->t('Import type'),
220 1
			'import' => $this->trans->t('Import'),
221 1
			'read.progress' => $this->trans->t('Read progress'),
222 1
			'upload.progress' => $this->trans->t('Upload progress'),
223
224
			// templates/views/partials/forms/settings/password_settings.html
225
			// inherent from other pages
226
227
			// templates/views/partials/forms/settings/sharing.html
228 1
			'priv.key' => $this->trans->t('Private Key'),
229 1
			'pub.key' => $this->trans->t('Public key'),
230 1
			'key.size' => $this->trans->t('Key size'),
231 1
			'save.keys' => $this->trans->t('Save keys'),
232 1
			'gen.keys' => $this->trans->t('Generate sharing keys'),
233 1
			'generating.keys' => $this->trans->t('Generating sharing keys'),
234
235
			// templates/views/partials/forms/settings/tool.html
236 1
			'tool.intro' => $this->trans->t('The password tool will scan your password, calculate the average crack time and list those which are below the threshold'),
237 1
			'min.strength' => $this->trans->t('Minimum password stength'),
238 1
			'scan.start' => $this->trans->t('Start scan'),
239 1
			'scan.result.msg' => $this->trans->t('Result'),
240 1
			'scan.result' => $this->trans->t('A total of {{scan_result}} weak credentials were found.'),
241 1
			'score' => $this->trans->t('Score'),
242 1
			'action' => $this->trans->t('Action'),
243
244
			// templates/vieuws/partials/forms/share_credential/basics.html
245 1
			'search.u.g' => $this->trans->t('Search users or groups…'),
246 1
			'search.result.missing' => $this->trans->t('Missing users? Only users that have vaults are shown.'),
247 1
			'cyphering' => $this->trans->t('Cyphering'),
248 1
			'uploading' => $this->trans->t('Uploading'),
249 1
			'user' => $this->trans->t('User'),
250 1
			'crypto.time' => $this->trans->t('Crypto time'),
251 1
			'crypto.total.time' => $this->trans->t('Total time spent cyphering'),
252 1
			'perm.read' => $this->trans->t('Read'),
253 1
			'perm.write' => $this->trans->t('Write'),
254 1
			'perm.files' => $this->trans->t('Files'),
255 1
			'perm.revisions' => $this->trans->t('Revisions'),
256 1
			'pending' => $this->trans->t('Pending'),
257
258
259
			// templates/vieuws/partials/forms/share_credential/link_sharing.html
260 1
			'enable.link.sharing' => $this->trans->t('Enable link sharing'),
261 1
			'share.until.date' => $this->trans->t('Share until date'),
262 1
			'expire.views' => $this->trans->t('Expire after views'),
263 1
			'click.share' => $this->trans->t('Click Share first'),
264 1
			'show.files' => $this->trans->t('Show files'),
265
266
267
			// templates/views/partials/password-meter.html
268 1
			'details' => $this->trans->t('Details'),
269 1
			'hide.details' => $this->trans->t('Hide details'),
270 1
			'password.score' => $this->trans->t('Password score'),
271 1
			'cracking.times' => $this->trans->t('Cracking times'),
272 1
			'cracking.time.100h' => $this->trans->t('100 / hour'),
273 1
			'cracking.time.100h.desc' => $this->trans->t('Throttled online attack'),
274 1
			'cracking.time.10s' => $this->trans->t('10 / second'),
275 1
			'cracking.time.10s.desc' => $this->trans->t('Unthrottled online attack'),
276 1
			'cracking.time.10ks' => $this->trans->t('10k / second'),
277 1
			'cracking.time.10ks.desc' => $this->trans->t('Offline attack, slow hash, many cores'),
278 1
			'cracking.time.10Bs' => $this->trans->t('10B / second'),
279 1
			'cracking.time.10Bs.desc' => $this->trans->t('Offline attack, fast hash, many cores'),
280 1
			'match.sequence' => $this->trans->t('Match sequence'),
281 1
			'match.sequence.link' => $this->trans->t('See match sequence'),
282 1
			'pattern' => $this->trans->t('Pattern'),
283 1
			'matched.word' => $this->trans->t('Matched word'),
284 1
			'dictionary.name' => $this->trans->t('Dictionary name'),
285 1
			'rank' => $this->trans->t('Rank'),
286 1
			'reversed' => $this->trans->t('Reversed'),
287 1
			'guesses' => $this->trans->t('Guesses'),
288 1
			'base.guesses' => $this->trans->t('Base guesses'),
289 1
			'uppercase.variations' => $this->trans->t('Uppercase variations'),
290 1
			'leet.variations' => $this->trans->t('l33t-variations'),
291
292
			// templates/views/credential_revisions.html
293 1
			'showing.revisions' => $this->trans->t('Showing revisions of'),
294 1
			'revision.of' => $this->trans->t('Revision of'),
295 1
			'revision.edited.by' => $this->trans->t('by'),
296 1
			'no.revisions' => $this->trans->t('No revisions found.'),
297 1
			'label' => $this->trans->t('Label'),
298 1
			'restore.revision' => $this->trans->t('Restore revision'),
299 1
			'delete.revision' => $this->trans->t('Delete revision'),
300
301
			// templates/views/edit_credential.html
302 1
			'edit.credential' => $this->trans->t('Edit credential'),
303 1
			'create.credential' => $this->trans->t('Create new credential'),
304 1
			'save' => $this->trans->t('Save'),
305 1
			'cancel' => $this->trans->t('Cancel'),
306
307
			// templates/views/settings.html
308 1
			'settings' => $this->trans->t('Settings'),
309
310
			// templates/views/share_credential.html
311 1
			'share.credential' => $this->trans->t('Share credential {{credential}}'),
312 1
			'unshare' => $this->trans->t('Unshare'),
313
314
315
			// templates/views/show_vault.html
316 1
			'deleted.since' => $this->trans->t('Showing deleted since'),
317 1
			'alltime' => $this->trans->t('Beginning'),
318 1
			'number.filtered' => $this->trans->t('Showing {{number_filtered}} of {{credential_number}} credentials'),
319 1
			'search.credential' => $this->trans->t('Search for credential…'),
320 1
			'account' => $this->trans->t('Account'),
321 1
			'password' => $this->trans->t('Password'),
322 1
			'otp' => $this->trans->t('OTP'),
323 1
			'email' => $this->trans->t('E-mail'),
324 1
			'url' => $this->trans->t('URL'),
325 1
			'notes' => $this->trans->t('Notes'),
326 1
			'files' => $this->trans->t('Files'),
327 1
			'expire.time' => $this->trans->t('Expiry time'),
328 1
			'changed' => $this->trans->t('Changed'),
329 1
			'created' => $this->trans->t('Created'),
330 1
			'edit' => $this->trans->t('Edit'),
331 1
			'delete' => $this->trans->t('Delete'),
332 1
			'share' => $this->trans->t('Share'),
333 1
			'revisions' => $this->trans->t('Revisions'),
334 1
			'recover' => $this->trans->t('Recover'),
335 1
			'destroy' => $this->trans->t('Destroy'),
336 1
			'use.regex' => $this->trans->t('Use regex'),
337 1
			'sharereq.title' => $this->trans->t('You have incoming share requests.'),
338 1
			'sharereq.line1' => $this->trans->t('If you want to put the credential in another vault,'),
339 1
			'sharereq.line2' => $this->trans->t('log out of this vault and log in to the vault you want the shared credential in.'),
340 1
			'permissions' => $this->trans->t('Permissions'),
341 1
			'received.from' => $this->trans->t('Received from'),
342 1
			'date' => $this->trans->t('Date'),
343 1
			'accept' => $this->trans->t('Accept'),
344 1
			'decline' => $this->trans->t('Decline'),
345 1
			'session.time.left' => $this->trans->t('You have {{session_time}} left before logout.'),
346 1
			'vault.locked' => $this->trans->t('Your vault has been locked for {{time}} because of {{tries}} failed attempts!'),
347
348
			// templates/views/vaults.html
349 1
			'last.access' => $this->trans->t('Last accessed'),
350 1
			'never' => $this->trans->t('Never'),
351
352
353 1
			'no.vaults' => $this->trans->t('No vaults found, why not create one?'),
354 1
			'min.vault.key.strength' => $this->trans->t('Password strength must be at least: {{strength}}'),
355
356 1
			'new.vault.name' => $this->trans->t('Please give your new vault a name.'),
357 1
			'new.vault.pass' => $this->trans->t('Vault password'),
358 1
			'new.vault.passr' => $this->trans->t('Repeat vault password'),
359 1
			'new.vault.sharing_key_notice' => $this->trans->t('Your sharing key\'s will have a strength of 1024 bit, which you can change in Settings later .'),
360 1
			'new.vault.create' => $this->trans->t('Create vault'),
361 1
			'go.back.vaults' => $this->trans->t('Go back to vaults'),
362 1
			'input.vault.password' => $this->trans->t('Please input the password for'),
363 1
			'vault.default' => $this->trans->t('Set this vault as the default.'),
364 1
			'vault.auto.login' => $this->trans->t('Log into this vault automatically.'),
365 1
			'auto.logout' => $this->trans->t('Log out of this vault automatically after: '),
366 1
			'vault.decrypt' => $this->trans->t('Decrypt vault'),
367
368 1
			'req.intro1' => $this->trans->t('Seems you lost the vault password and you\'re unable to log in.'),
369 1
			'req.intro2' => $this->trans->t('If you want this vault to be removed you can request that here.'),
370 1
			'req.intro3' => $this->trans->t('An admin then accepts or declines the request'),
371
372 1
			'request.deletion.warning' => $this->trans->t('After an admin destroys this vault, all credentials in it will be lost'),
373 1
			'request.deletion.reason' => $this->trans->t('Reason for requesting deletion (optional):'),
374 1
			'request.deletion' => $this->trans->t('Request vault destruction'),
375 1
			'request.deletion.accept' => $this->trans->t('Yes, request an admin to destroy this vault'),
376 1
			'cancel.request.deletion' => $this->trans->t('Cancel destruction request'),
377 1
			'deletion.requested' => $this->trans->t('Vault destruction requested'),
378 1
			'deletion.removed' => $this->trans->t('Request removed'),
379 1
			'delete.request.pending' => $this->trans->t('Destruction request pending'),
380
381
382
			// templates/bookmarklet.php
383 1
			'http.warning' => $this->trans->t('Warning! Adding credentials over HTTP is insecure!'),
384 1
			'bm.active.vault' => $this->trans->t('Logged in to {{vault_name}}'),
385 1
			'change.vault' => $this->trans->t('Change vault'),
386
387
			// templates/main.php
388 1
			'deleted.credentials' => $this->trans->t('Deleted credentials'),
389 1
			'logout' => $this->trans->t('Logout'),
390 1
			'donate' => $this->trans->t('Donate'),
391
392
			// templates/public_share.php
393 1
			'share.page.text' => $this->trans->t('Someone has shared a credential with you.'),
394 1
			'share.page.link' => $this->trans->t('Click here to request it'),
395 1
			'share.page.link_loading' => $this->trans->t('Loading…'),
396 1
			'expired.share' => $this->trans->t('Awwhh… credential not found. Maybe it expired'),
397
398 1
		);
399 1
		return new JSONResponse($translations);
400
	}
401
}
402