Completed
Pull Request — master (#135)
by Sander
09:39 queued 06:20
created

TranslationController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 329
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
wmc 2
c 3
b 0
f 0
lcom 1
cbo 0
dl 0
loc 329
ccs 0
cts 232
cp 0
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
B getLanguageStrings() 0 311 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($AppName, $request);
27
		$this->trans = $trans;
28
	}
29
30
31
	/**
32
	 * @NoAdminRequired
33
	 * @NoCSRFRequired
34
	 * @PublicPage
35
	 */
36
	public function getLanguageStrings($lang) {
37
		$translations = array(
38
			// js/app/controllers/bookmarklet.js
39
			'generating.sharing.keys' =>  $this->trans->t('Generating sharing keys ( %step / 2)'),
40
			'invalid.vault.key' => $this->trans->t('Incorrect vault password!'),
41
			'password.do.not.match' => $this->trans->t('Passwords do not match'),
42
			'general' => $this->trans->t('General'),
43
			'custom.fields' => $this->trans->t('Custom Fields'),
44
			'error.no.label' => $this->trans->t('Please fill in a label!'),
45
			'error.no.value' => $this->trans->t('Please fill in a value!'),
46
			'error.loading.file' => $this->trans->t('Error loading file'),
47
48
			// js/app/controllers/credential.js
49
			'error.decrypt' => $this->trans->t('An error happend during decryption'),
50
			'credential.created' => $this->trans->t('Credential created!'),
51
			'credential.deleted' => $this->trans->t('Credential deleted'),
52
			'credential.updated' => $this->trans->t('Credential updated'),
53
			'credential.recovered' => $this->trans->t('Credential recovered'),
54
			'credential.destroyed' => $this->trans->t('Credential recovered'),
55
			'error.loading.file.perm' => $this->trans->t('Error downloading file, you probably don\'t have enough permissions'),
56
57
			// js/app/controllers/edit_credential.js
58
59
60
			// js/app/controllers/export.js
61
			'export.starting' => $this->trans->t('Starting export'),
62
			'export.decrypt' => $this->trans->t('Decrypting credentials'),
63
			'done' => $this->trans->t('Done'),
64
65
			// js/app/controllers/import.js
66
			'import.file.read' => $this->trans->t('File read successfully!'),
67
68
			'import.no.label' => $this->trans->t('Credential has no label, skipping'),
69
			'import.adding' => $this->trans->t('Adding {{credential}}'),
70
			'import.added' => $this->trans->t('Added {{credential}}'),
71
			'import.loaded' => $this->trans->t('Parsed {{num}} credentials, starting to import'),
72
73
			// js/app/controllers/revision.js
74
			'revision.deleted' => $this->trans->t('Revision deleted'),
75
			'revision.restored' => $this->trans->t('Revision restored'),
76
77
			// js/app/controllers/settings.js
78
			'bookmarklet.text' => $this->trans->t('Save in passman'),
79
			'settings.saved' => $this->trans->t('Settings saved'),
80
			'settings.general' => $this->trans->t('General settings'),
81
			'settings.audit' => $this->trans->t('Password Audit'),
82
			'settings.password' => $this->trans->t('Password settings'),
83
			'settings.import' => $this->trans->t('Import credentials'),
84
			'settings.export' => $this->trans->t('Export credentials'),
85
			'settings.sharing' => $this->trans->t('Sharing'),
86
			'changepw.navigate.away.warning' => $this->trans->t('Are you sure you want to leave? This WILL corrupt all your credentials'),
87
			'incorrect.password' => $this->trans->t('Your old password is incorrect!'),
88
			'password.no.match' => $this->trans->t('New passwords do not match!'),
89
			'login.new.pass' => $this->trans->t('Please login with your new vault password'),
90
91
			// js/app/controllers/share.js
92
			'share.u.g' => $this->trans->t('Share with users and groups'),
93
			'share.link' => $this->trans->t('Share link'),
94
			'share.navigate.away.warning' => $this->trans->t('Are you sure you want to leave? This will corrupt this credential'),
95
			'credential.unshared' => $this->trans->t('Credential unshared'),
96
			'credential.shared' => $this->trans->t('Credential shared'),
97
			'saved' => $this->trans->t('Saved!'),
98
99
			// js/app/directives/credentialfield.js
100
			'toggle.visibility' => $this->trans->t('Toggle visibility'),
101
			'copy.field' => $this->trans->t('Copy to clipboard'),
102
			'copied' => $this->trans->t('Copied to clipboard!'),
103
104
			// js/app/directives/passwordgen.js
105
			'password.gen' => $this->trans->t('Generate password'),
106
			'password.copy' => $this->trans->t('Copy password to clipboard'),
107
			'password.copied' => $this->trans->t('Password copied to clipboard!'),
108
109
			// js/app/directives/progressbar.js
110
			'complete' => $this->trans->t('Complete'),
111
112
113
			// templates/views/partials/edit_credential/basics.html
114
			'username' => $this->trans->t('Username'),
115
			'password.r' => $this->trans->t('Repeat password'),
116
			'add.tag' => $this->trans->t('Add Tag'),
117
118
			// templates/views/partials/edit_credential/custom_fields.html
119
			'field.label' => $this->trans->t('Field label'),
120
			'field.value' => $this->trans->t('Field value'),
121
			'select.file' => $this->trans->t('Choose a file'),
122
			'text' => $this->trans->t('Text'),
123
			'file' => $this->trans->t('File'),
124
			'add' => $this->trans->t('Add'),
125
			'value' => $this->trans->t('Value'),
126
			'type' => $this->trans->t('Type'),
127
			'actions' => $this->trans->t('Actions'),
128
			'empty' => $this->trans->t('Empty'),
129
130
			// templates/views/partials/edit_credential/files.html
131
			'file.name' => $this->trans->t('Filename'),
132
			'upload.date' => $this->trans->t('Upload date'),
133
			'size' => $this->trans->t('Size'),
134
135
136
			// templates/views/partials/edit_credential/otp.html
137
			'upload.qr' => $this->trans->t('Upload your OTP qr code'),
138
			'current.qr' => $this->trans->t('Current OTP settings'),
139
			'issuer' => $this->trans->t('Issuer'),
140
			'secret' => $this->trans->t('Secret'),
141
142
143
			// templates/views/partials/edit_credential/password.html
144
			'expire.date' => $this->trans->t('Expire date'),
145
			'no.expire.date' => $this->trans->t('No expire date set'),
146
			'renew.interval' => $this->trans->t('Renew interval'),
147
			'disabled' => $this->trans->t('Disabled'),
148
			'days' => $this->trans->t('Day(s)'),
149
			'weeks' => $this->trans->t('Week(s)'),
150
			'months' => $this->trans->t('Month(s)'),
151
			'years' => $this->trans->t('Year(s)'),
152
			'generation.settings' => $this->trans->t('Password generation settings'),
153
			'password.generation.length' => $this->trans->t('Password length'),
154
			'password.generation.min_digits' => $this->trans->t('Minimum amount of digits'),
155
			'password.generation.uppercase' => $this->trans->t('Use uppercase letters'),
156
			'password.generation.lowercase' => $this->trans->t('Use lowercase letters'),
157
			'password.generation.digits' => $this->trans->t('Use numbers'),
158
			'password.generation.special' => $this->trans->t('Use special characters'),
159
			'password.generation.ambiguous' => $this->trans->t('Avoid ambiguous characters'),
160
			'password.generation.require_same' => $this->trans->t('Require every character type'),
161
162
163
			// templates/views/partials/forms/settings/export.html
164
			'export.type' => $this->trans->t('Export type'),
165
			'export' => $this->trans->t('Export'),
166
167
			// templates/views/partials/forms/settings/general_settings.html
168
			'rename.vault' => $this->trans->t('Rename vault'),
169
			'rename.vault.name' => $this->trans->t('New vault name'),
170
			'change' => $this->trans->t('Change'),
171
			'change.vault.key' => $this->trans->t('Change vault key'),
172
			'old.vault.password' => $this->trans->t('Old vault password'),
173
			'new.vault.password' => $this->trans->t('New vault password'),
174
			'new.vault.pw.r' => $this->trans->t('New vault password repeat'),
175
			'warning.leave' => $this->trans->t('Please wait your vault is being updated, do not leave this page.'),
176
			'processing' => $this->trans->t('Processing'),
177
			'total.progress' => $this->trans->t('Total progress'),
178
			'about.passman' => $this->trans->t('About Passman'),
179
			'version' => $this->trans->t('Version'),
180
			'donate.support' => $this->trans->t('Donate to support development'),
181
			'bookmarklet' => $this->trans->t('Bookmarklet'),
182
			'bookmarklet.info1' => $this->trans->t('Save your passwords with 1 click!'),
183
			'bookmarklet.info2' => $this->trans->t('Drag below button to your bookmark toolbar.'),
184
185
186
			// templates/views/partials/forms/settings/import.html
187
			'import.type' => $this->trans->t('Import type'),
188
			'import' => $this->trans->t('Import'),
189
			'read.progress' => $this->trans->t('Read progress'),
190
			'upload.progress' => $this->trans->t('Upload progress'),
191
192
			// templates/views/partials/forms/settings/password_settings.html
193
			// inherent from other pages
194
195
			// templates/views/partials/forms/settings/sharing.html
196
			'priv.key' => $this->trans->t('Private Key'),
197
			'pub.key' => $this->trans->t('Public key'),
198
			'key.size' => $this->trans->t('Key size'),
199
			'save.keys' => $this->trans->t('Save keys'),
200
			'gen.keys' => $this->trans->t('Generate sharing keys'),
201
			'generating.keys' => $this->trans->t('Generating sharing keys'),
202
203
			// templates/views/partials/forms/settings/tool.html
204
			'tool.intro' => $this->trans->t('The password tool will scan your password, calculate the avarage crack time and, if below the threshold, show them'),
205
			'min.strength' => $this->trans->t('Minimum password stength'),
206
			'scan.result.msg' => $this->trans->t('Passman scanned your passwords, and here is the result.'),
207
			'scan.result' => $this->trans->t('A total of {{scan_result}} weak credentials.'),
208
			'score' => $this->trans->t('Score'),
209
			'action' => $this->trans->t('Action'),
210
211
			// templates/vieuws/partials/forms/share_credential/basics.html
212
			'search.u.g' => $this->trans->t('Search users or groups...'),
213
			'cyphering' => $this->trans->t('Cyphering'),
214
			'uploading' => $this->trans->t('Uploading'),
215
			'user' => $this->trans->t('User'),
216
			'crypto.time' => $this->trans->t('Crypto time'),
217
			'crypto.total.time' => $this->trans->t('Total time spent cyphering'),
218
			'perm.read' => $this->trans->t('Read'),
219
			'perm.write' => $this->trans->t('Write'),
220
			'perm.files' => $this->trans->t('Files'),
221
			'perm.revisions' => $this->trans->t('Revisions'),
222
			'pending' => $this->trans->t('Pending'),
223
224
225
			// templates/vieuws/partials/forms/share_credential/link_sharing.html
226
			'enable.link.sharing' => $this->trans->t('Enable link sharing'),
227
			'share.until.date' => $this->trans->t('Share until date'),
228
			'expire.views' => $this->trans->t('Expire after views'),
229
			'click.share' => $this->trans->t('Click share first'),
230
			'show.files' => $this->trans->t('Show files'),
231
232
233
			// templates/views/partials/password-meter.html
234
			'details' => $this->trans->t('Details'),
235
			'hide.details' => $this->trans->t('Hide details'),
236
			'password.score' => $this->trans->t('Password score'),
237
			'cracking.times' => $this->trans->t('Cracking times'),
238
			'cracking.time.100h' => $this->trans->t('100 / hour'),
239
			'cracking.time.100h.desc' => $this->trans->t('Throttled online attack'),
240
			'cracking.time.10s' => $this->trans->t('10 / second'),
241
			'cracking.time.10s.desc' => $this->trans->t('Unthrottled online attack'),
242
			'cracking.time.10ks' => $this->trans->t('10k / second'),
243
			'cracking.time.10ks.desc' => $this->trans->t('Offline attack, slow hash, many cores'),
244
			'cracking.time.10Bs' => $this->trans->t('10B / second'),
245
			'cracking.time.10Bs.desc' => $this->trans->t('Offline attack, fast hash, many cores'),
246
			'match.sequence' => $this->trans->t('Match sequence'),
247
			'match.sequence.link' => $this->trans->t('See match sequence'),
248
			'pattern' => $this->trans->t('Pattern'),
249
			'matched.word' => $this->trans->t('Matched word'),
250
			'dictionary.name' => $this->trans->t('Dictionary name'),
251
			'rank' => $this->trans->t('Rank'),
252
			'reversed' => $this->trans->t('Reversed'),
253
			'guesses' => $this->trans->t('Guesses'),
254
			'base.guesses' => $this->trans->t('Base guesses'),
255
			'uppercase.variations' => $this->trans->t('Uppercase variations'),
256
			'leet.variations' => $this->trans->t('l33t-variations'),
257
258
			// templates/views/credential_revisions.html
259
			'showing.revisions' => $this->trans->t('Showing revisions of'),
260
			'revision.of' => $this->trans->t('Revision of'),
261
			'revision.edited.by' => $this->trans->t('by'),
262
			'no.revisions' => $this->trans->t('No revisions found.'),
263
			'label' => $this->trans->t('Label'),
264
			'restore.revision' => $this->trans->t('Restore revision'),
265
			'delete.revision' => $this->trans->t('Delete revision'),
266
267
			// templates/views/edit_credential.html
268
			'edit.credential' => $this->trans->t('Edit credential'),
269
			'create.credential' => $this->trans->t('Create new credential'),
270
			'save' => $this->trans->t('Save'),
271
			'cancel' => $this->trans->t('Cancel'),
272
273
			// templates/views/settings.html
274
			'settings' => $this->trans->t('Settings'),
275
276
			// templates/views/share_credential.html
277
			'share.credential' => $this->trans->t('Share credential {{credential}}'),
278
			'unshare' => $this->trans->t('Unshare'),
279
280
281
			// templates/views/show_vault.html
282
			'deleted.since' => $this->trans->t('Showing deleted since'),
283
			'alltime' => $this->trans->t('All time'),
284
			'number.filtered' => $this->trans->t('Showing {{number_filtered}} of {{credential_number}} credentials'),
285
			'search.credential' => $this->trans->t('Search credential...'),
286
			'account' => $this->trans->t('Account'),
287
			'password' => $this->trans->t('Password'),
288
			'otp' => $this->trans->t('OTP'),
289
			'email' => $this->trans->t('E-mail'),
290
			'url' => $this->trans->t('URL'),
291
			'notes' => $this->trans->t('Notes'),
292
			'files' => $this->trans->t('Files'),
293
			'expire.time' => $this->trans->t('Expire time'),
294
			'changed' => $this->trans->t('Changed'),
295
			'created' => $this->trans->t('Created'),
296
			'edit' => $this->trans->t('Edit'),
297
			'delete' => $this->trans->t('Delete'),
298
			'share' => $this->trans->t('Share'),
299
			'revisions' => $this->trans->t('Revisions'),
300
			'recover' => $this->trans->t('Recover'),
301
			'destroy' => $this->trans->t('Destroy'),
302
303
			'sharereq.title' => $this->trans->t('You have incoming share requests.'),
304
			'sharereq.line1' => $this->trans->t('If you want to the credential in a other vault,'),
305
			'sharereq.line2' => $this->trans->t('logout of this vault and login to the vault you want the shared credential in.'),
306
			'permissions' => $this->trans->t('Permissions'),
307
			'received.from' => $this->trans->t('Received from'),
308
			'date' => $this->trans->t('Date'),
309
			'accept' => $this->trans->t('Accept'),
310
			'decline' => $this->trans->t('Decline'),
311
312
			// templates/views/vaults.html
313
			'last.access' => $this->trans->t('Last accessed'),
314
			'never' => $this->trans->t('Never'),
315
			'no.vaults' => $this->trans->t('No vaults found, why not create one?'),
316
317
			'new.vault.name' => $this->trans->t('Please give your new vault a name.'),
318
			'new.vault.pass' => $this->trans->t('Vault password'),
319
			'new.vault.passr' => $this->trans->t('Repeat vault password'),
320
			'new.vault.sharing_key_notice' => $this->trans->t('Your sharing key\'s will have a strength of 1024 bit, which you can change later in settings.'),
321
			'new.vault.create' => $this->trans->t('Create vault'),
322
			'go.back.vaults' => $this->trans->t('Go back to vaults'),
323
			'input.vault.password' => $this->trans->t('Please input the password for'),
324
			'vault.default' => $this->trans->t('Set this vault as default.'),
325
			'vault.auto.login' => $this->trans->t('Login automatically to this vault.'),
326
			'vault.decrypt' => $this->trans->t('Decrypt vault'),
327
328
			// templates/bookmarklet.php
329
			'http.warning' => $this->trans->t('Warning! Adding credentials over http can be insecure!'),
330
			'bm.active.vault' => $this->trans->t('Logged in to {{vault_name}}'),
331
			'change.vault' => $this->trans->t('Change vault'),
332
333
			// templates/main.php
334
			'deleted.credentials' => $this->trans->t('Deleted credentials'),
335
			'logout' => $this->trans->t('Logout'),
336
			'donate' => $this->trans->t('Donate'),
337
338
			// templates/public_share.php
339
			'share.page.text' => $this->trans->t('Someone has shared a credential with you.'),
340
			'share.page.link' => $this->trans->t('Click here to request it'),
341
			'share.page.link_loading' => $this->trans->t('Loading...'),
342
			'expired.share' => $this->trans->t('Awwhh.... credential not found. Maybe it expired'),
343
344
		);
345
		return new JSONResponse($translations);
346
	}
347
}