Completed
Branch master (8ca3ab)
by Sander
03:07
created

TranslationController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 335
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

2 Methods

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