Completed
Pull Request — master (#196)
by Sander
04:03
created

TranslationController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 343
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 98.37%

Importance

Changes 4
Bugs 0 Features 0
Metric Value
dl 0
loc 343
ccs 242
cts 246
cp 0.9837
rs 10
c 4
b 0
f 0
wmc 2
lcom 1
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
B getLanguageStrings() 0 325 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 destroyed'),
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 1
			'delete.vault' => $this->trans->t('Delete vault'),
190 1
			'vault.password' => $this->trans->t('Vault password'),
191 1
			'vault.remove.notice' => $this->trans->t('This process is irreversible'),
192 1
			'delete.vault.checkbox' => $this->trans->t('Delete my precious passwords'),
193 1
			'deleting.pw' => $this->trans->t('Deleting {{password}}...'),
194 1
			'delete.vault.confirm' => $this->trans->t('Yes, delete my precious passwords'),
195
196
197
			// templates/views/partials/forms/settings/import.html
198 1
			'import.type' => $this->trans->t('Import type'),
199 1
			'import' => $this->trans->t('Import'),
200 1
			'read.progress' => $this->trans->t('Read progress'),
201 1
			'upload.progress' => $this->trans->t('Upload progress'),
202
203
			// templates/views/partials/forms/settings/password_settings.html
204
			// inherent from other pages
205
206
			// templates/views/partials/forms/settings/sharing.html
207 1
			'priv.key' => $this->trans->t('Private Key'),
208 1
			'pub.key' => $this->trans->t('Public key'),
209 1
			'key.size' => $this->trans->t('Key size'),
210 1
			'save.keys' => $this->trans->t('Save keys'),
211 1
			'gen.keys' => $this->trans->t('Generate sharing keys'),
212 1
			'generating.keys' => $this->trans->t('Generating sharing keys'),
213
214
			// templates/views/partials/forms/settings/tool.html
215 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'),
216 1
			'min.strength' => $this->trans->t('Minimum password stength'),
217 1
			'scan.result.msg' => $this->trans->t('Passman scanned your passwords, and here is the result.'),
218 1
			'scan.result' => $this->trans->t('A total of {{scan_result}} weak credentials.'),
219 1
			'score' => $this->trans->t('Score'),
220 1
			'action' => $this->trans->t('Action'),
221
222
			// templates/vieuws/partials/forms/share_credential/basics.html
223 1
			'search.u.g' => $this->trans->t('Search users or groups...'),
224 1
			'cyphering' => $this->trans->t('Cyphering'),
225 1
			'uploading' => $this->trans->t('Uploading'),
226 1
			'user' => $this->trans->t('User'),
227 1
			'crypto.time' => $this->trans->t('Crypto time'),
228 1
			'crypto.total.time' => $this->trans->t('Total time spent cyphering'),
229 1
			'perm.read' => $this->trans->t('Read'),
230 1
			'perm.write' => $this->trans->t('Write'),
231 1
			'perm.files' => $this->trans->t('Files'),
232 1
			'perm.revisions' => $this->trans->t('Revisions'),
233 1
			'pending' => $this->trans->t('Pending'),
234
235
236
			// templates/vieuws/partials/forms/share_credential/link_sharing.html
237 1
			'enable.link.sharing' => $this->trans->t('Enable link sharing'),
238 1
			'share.until.date' => $this->trans->t('Share until date'),
239 1
			'expire.views' => $this->trans->t('Expire after views'),
240 1
			'click.share' => $this->trans->t('Click share first'),
241 1
			'show.files' => $this->trans->t('Show files'),
242
243
244
			// templates/views/partials/password-meter.html
245 1
			'details' => $this->trans->t('Details'),
246 1
			'hide.details' => $this->trans->t('Hide details'),
247 1
			'password.score' => $this->trans->t('Password score'),
248 1
			'cracking.times' => $this->trans->t('Cracking times'),
249 1
			'cracking.time.100h' => $this->trans->t('100 / hour'),
250 1
			'cracking.time.100h.desc' => $this->trans->t('Throttled online attack'),
251 1
			'cracking.time.10s' => $this->trans->t('10 / second'),
252 1
			'cracking.time.10s.desc' => $this->trans->t('Unthrottled online attack'),
253 1
			'cracking.time.10ks' => $this->trans->t('10k / second'),
254 1
			'cracking.time.10ks.desc' => $this->trans->t('Offline attack, slow hash, many cores'),
255 1
			'cracking.time.10Bs' => $this->trans->t('10B / second'),
256 1
			'cracking.time.10Bs.desc' => $this->trans->t('Offline attack, fast hash, many cores'),
257 1
			'match.sequence' => $this->trans->t('Match sequence'),
258 1
			'match.sequence.link' => $this->trans->t('See match sequence'),
259 1
			'pattern' => $this->trans->t('Pattern'),
260 1
			'matched.word' => $this->trans->t('Matched word'),
261 1
			'dictionary.name' => $this->trans->t('Dictionary name'),
262 1
			'rank' => $this->trans->t('Rank'),
263 1
			'reversed' => $this->trans->t('Reversed'),
264 1
			'guesses' => $this->trans->t('Guesses'),
265 1
			'base.guesses' => $this->trans->t('Base guesses'),
266 1
			'uppercase.variations' => $this->trans->t('Uppercase variations'),
267 1
			'leet.variations' => $this->trans->t('l33t-variations'),
268
269
			// templates/views/credential_revisions.html
270 1
			'showing.revisions' => $this->trans->t('Showing revisions of'),
271 1
			'revision.of' => $this->trans->t('Revision of'),
272 1
			'revision.edited.by' => $this->trans->t('by'),
273 1
			'no.revisions' => $this->trans->t('No revisions found.'),
274 1
			'label' => $this->trans->t('Label'),
275 1
			'restore.revision' => $this->trans->t('Restore revision'),
276 1
			'delete.revision' => $this->trans->t('Delete revision'),
277
278
			// templates/views/edit_credential.html
279 1
			'edit.credential' => $this->trans->t('Edit credential'),
280 1
			'create.credential' => $this->trans->t('Create new credential'),
281 1
			'save' => $this->trans->t('Save'),
282 1
			'cancel' => $this->trans->t('Cancel'),
283
284
			// templates/views/settings.html
285 1
			'settings' => $this->trans->t('Settings'),
286
287
			// templates/views/share_credential.html
288 1
			'share.credential' => $this->trans->t('Share credential {{credential}}'),
289 1
			'unshare' => $this->trans->t('Unshare'),
290
291
292
			// templates/views/show_vault.html
293 1
			'deleted.since' => $this->trans->t('Showing deleted since'),
294 1
			'alltime' => $this->trans->t('All time'),
295 1
			'number.filtered' => $this->trans->t('Showing {{number_filtered}} of {{credential_number}} credentials'),
296 1
			'search.credential' => $this->trans->t('Search credential...'),
297 1
			'account' => $this->trans->t('Account'),
298 1
			'password' => $this->trans->t('Password'),
299 1
			'otp' => $this->trans->t('OTP'),
300 1
			'email' => $this->trans->t('E-mail'),
301 1
			'url' => $this->trans->t('URL'),
302 1
			'notes' => $this->trans->t('Notes'),
303 1
			'files' => $this->trans->t('Files'),
304 1
			'expire.time' => $this->trans->t('Expire time'),
305 1
			'changed' => $this->trans->t('Changed'),
306 1
			'created' => $this->trans->t('Created'),
307 1
			'edit' => $this->trans->t('Edit'),
308 1
			'delete' => $this->trans->t('Delete'),
309 1
			'share' => $this->trans->t('Share'),
310 1
			'revisions' => $this->trans->t('Revisions'),
311 1
			'recover' => $this->trans->t('Recover'),
312 1
			'destroy' => $this->trans->t('Destroy'),
313 1
			'use.regex' => $this->trans->t('Use regex'),
314 1
			'sharereq.title' => $this->trans->t('You have incoming share requests.'),
315 1
			'sharereq.line1' => $this->trans->t('If you want to put the credential in a other vault,'),
316 1
			'sharereq.line2' => $this->trans->t('logout of this vault and login to the vault you want the shared credential in.'),
317 1
			'permissions' => $this->trans->t('Permissions'),
318 1
			'received.from' => $this->trans->t('Received from'),
319 1
			'date' => $this->trans->t('Date'),
320 1
			'accept' => $this->trans->t('Accept'),
321 1
			'decline' => $this->trans->t('Decline'),
322 1
			'session.time.left' => $this->trans->t('You have {{session_time}} left before logout.'),
323
324
			// templates/views/vaults.html
325 1
			'last.access' => $this->trans->t('Last accessed'),
326 1
			'never' => $this->trans->t('Never'),
327 1
			'no.vaults' => $this->trans->t('No vaults found, why not create one?'),
328 1
			'min.vault.key.strength' => $this->trans->t('Password strength must be at least: {{strength}}'),
329
330 1
			'new.vault.name' => $this->trans->t('Please give your new vault a name.'),
331 1
			'new.vault.pass' => $this->trans->t('Vault password'),
332 1
			'new.vault.passr' => $this->trans->t('Repeat vault password'),
333 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.'),
334 1
			'new.vault.create' => $this->trans->t('Create vault'),
335 1
			'go.back.vaults' => $this->trans->t('Go back to vaults'),
336 1
			'input.vault.password' => $this->trans->t('Please input the password for'),
337 1
			'vault.default' => $this->trans->t('Set this vault as default.'),
338 1
			'vault.auto.login' => $this->trans->t('Login automatically to this vault.'),
339 1
			'auto.logout' => $this->trans->t('Logout of this vault automatically after: '),
340 1
			'vault.decrypt' => $this->trans->t('Decrypt vault'),
341
342
			// templates/bookmarklet.php
343 1
			'http.warning' => $this->trans->t('Warning! Adding credentials over http can be insecure!'),
344 1
			'bm.active.vault' => $this->trans->t('Logged in to {{vault_name}}'),
345 1
			'change.vault' => $this->trans->t('Change vault'),
346
347
			// templates/main.php
348 1
			'deleted.credentials' => $this->trans->t('Deleted credentials'),
349 1
			'logout' => $this->trans->t('Logout'),
350 1
			'donate' => $this->trans->t('Donate'),
351
352
			// templates/public_share.php
353 1
			'share.page.text' => $this->trans->t('Someone has shared a credential with you.'),
354 1
			'share.page.link' => $this->trans->t('Click here to request it'),
355 1
			'share.page.link_loading' => $this->trans->t('Loading...'),
356 1
			'expired.share' => $this->trans->t('Awwhh.... credential not found. Maybe it expired'),
357
358 1
		);
359 1
		return new JSONResponse($translations);
360
	}
361
}
362