Skip to content

Commit 91ce2e0

Browse files
committed
Add missing translatable strings.
fr and en translations included.
1 parent 25f7730 commit 91ce2e0

File tree

7 files changed

+63
-45
lines changed

7 files changed

+63
-45
lines changed

app/Http/Controllers/PasteController.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -135,25 +135,25 @@ public function view($link, Request $request){
135135
// On s'occupe des options de vie privée de la paste (TODO password)
136136
// https://stackoverflow.com/questions/30212390/laravel-middleware-return-variable-to-controller
137137
if ($paste->privacy == "private") {
138-
if($isSameUser) $privacy = "Private";
138+
if($isSameUser) $privacy = __('edpaste.paste.option.privacy.private');
139139
else abort('404');
140140
}
141141
elseif ($paste->privacy == "internal"){
142142
if (cas()->isAuthenticated()) {
143-
$privacy = "Internal access";
143+
$privacy = __('edpaste.paste.option.privacy.internal');
144144
} else {
145145
return abort('404');
146146
}
147147
}
148148
elseif ($paste->privacy == "password"){
149-
$privacy = "Password-protected";
149+
$privacy = __('edpaste.paste.option.privacy.password');
150150
if ($request->isMethod('post')) {
151151
if(!Hash::check(Input::get('pastePassword'), $paste->password)) return view('paste/password', ['link' => $paste->link, 'wrongPassword' => true]);
152152
}
153153
// Si l'user n'est pas le même et que la paste a été créée il y a plus de trois secondes :
154154
elseif(!$isSameUser && time() - $paste->created_at->timestamp > 3) return view('paste/password', ['link' => $paste->link]);
155155
}
156-
elseif ($paste->privacy == "link") $privacy = "Public";
156+
elseif ($paste->privacy == "link") $privacy = __('edpaste.paste.option.privacy.link');
157157
else die("Error.");
158158

159159
// Ici on vérifie si le burn de la paste doit être supprimé (besoin de le faire après le check password)

resources/lang/en/edpaste.php

+8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
'menu.home' => 'Home',
66
'menu.dashboard' => 'Dashboard',
7+
'button.yes' => 'Yes',
8+
'button.no' => 'No',
79

810
'paste.title' => 'Title',
911
'paste.title.placeholder' => 'Title (optional)',
@@ -12,6 +14,7 @@
1214
'paste.expiration' => 'Paste expiration',
1315
'paste.privacy' => 'Privacy',
1416
'paste.option.disable.syntax' => 'Disable syntax highlighting',
17+
'paste.submit.tooltip' => 'Registered users have access to other privacy tools',
1518
'paste.submit' => 'Submit',
1619

1720

@@ -30,6 +33,7 @@
3033
/* Dashboard */
3134
'paste.views' => 'Views',
3235
'paste.creation' => 'Creation',
36+
'paste.confirm.delete.title' => 'Delete "<i>{{ :pastename }}</i>"?',
3337
'paste.confirm.delete' => 'Are you sure? You <strong>cannot</strong> undo this',
3438
'paste.option.expired' => 'Expired',
3539

@@ -41,6 +45,10 @@
4145
'paste.plain-text' => 'Plain-text',
4246
'paste.raw' => 'Raw paste',
4347
'paste.edit' => 'Edit paste',
48+
'paste.view_count' => 'Times viewed',
49+
'paste.views' => '{1} :count view|[2,*] :count views',
50+
'paste.username' => 'Username',
51+
'password.title' => 'Password',
4452

4553
/* Password prompt page */
4654
'page.title.password.prompt' => 'Password prompt - EdPaste',

resources/lang/fr/edpaste.php

+10-2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
'menu.home' => 'Accueil',
66
'menu.dashboard' => 'Tableau de bord',
7+
'button.yes' => 'Oui',
8+
'button.no' => 'Non',
79

810
'paste.title' => 'Titre',
911
'paste.title.placeholder' => 'Nom du post-it (facultatif)',
@@ -12,6 +14,7 @@
1214
'paste.expiration' => 'Expiration du post-it',
1315
'paste.privacy' => 'Type d\'accès',
1416
'paste.option.disable.syntax' => 'Désactiver le surlignage syntaxique',
17+
'paste.submit.tooltip' => 'Plus d\'options de visibilité sont disponibles pour les utilisateurs authentifés',
1518
'paste.submit' => 'Soumettre',
1619

1720

@@ -30,6 +33,7 @@
3033
/* Dashboard */
3134
'paste.views' => 'Vues',
3235
'paste.creation' => 'Création',
36+
'paste.confirm.delete.title' => 'Supprimer "<i>:pastename</i>" ?',
3337
'paste.confirm.delete' => 'Êtes vous sûr ? Il est <strong>impossible</strong> de revenir en arrière !',
3438
'paste.option.expired' => 'Expiré',
3539

@@ -39,8 +43,12 @@
3943
'paste.msg.burnafter.last.view' => '<strong>Attention !</strong> Ce post-it va s\'autodétruire après lecture et vous ne pourrez plus le voir.',
4044
'paste.syntax-highlighted' => 'Surlignage syntaxique',
4145
'paste.plain-text' => 'Texte brut',
42-
'paste.raw' => 'Afficher',
43-
'paste.edit' => 'Modifier le post-it',
46+
'paste.raw' => 'Afficher',
47+
'paste.edit' => 'Modifier le post-it',
48+
'paste.view_count' => 'Nombre de vues',
49+
'paste.views' => '{1} :count vue|[2,*] :count vues',
50+
'paste.username' => 'Auteur',
51+
'password.title' => 'Mot de passe',
4452

4553
/* Password prompt page */
4654
'page.title.password.prompt' => 'Demande de mot de passe - Post-it',

resources/views/paste/dashboard.blade.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
<th class="hidden-xs">{{ __('edpaste.paste.content') }}</th>
3838
<th class="hidden-xs"></th>
3939
<th class="hidden-xs"></th>
40-
<th>{{ __('edpaste.paste.views') }}</th>
40+
<th>{{ __('edpaste.paste.view_count') }}</th>
4141
<th>{{ __('edpaste.paste.creation') }}</th>
4242
<th></th>
4343
</tr>
@@ -62,7 +62,7 @@
6262
</td>
6363
<td> {{ $userPaste->views }}</td>
6464
{{-- Là on repasse à la date --}}
65-
<td>{{ $userPaste->created_at->format('M j, Y') }}</td>
65+
<td>{{ $userPaste->created_at->format('Y-m-d') }}</td>
6666
<td><button class="btn btn-danger btn-sm pull-right" type="button" data-toggle="modal" data-target="#delete{{ $loop->iteration }}" aria-expanded="false" aria-controls="collapseExample{{ $loop->iteration }}"><i class="fa fa-trash-o"></i></button></td>
6767
</tr>
6868
<div class="modal fade" id="delete{{ $loop->iteration }}" tabindex="-1" role="dialog" aria-labelledby="preview" aria-hidden="true">
@@ -72,12 +72,12 @@
7272
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
7373
<span aria-hidden="true">&times;</span>
7474
</button>
75-
<h4 class="modal-title" id="preview" style="word-wrap: break-word;">Delete "<i>{{ $userPaste->title }}</i>" ?</h4>
75+
<h4 class="modal-title" id="preview" style="word-wrap: break-word;">@lang('edpaste.paste.confirm.delete.title', ['pastename' => $userPaste->title])</h4>
7676
</div>
7777
<div class="modal-body">@lang('edpaste.paste.confirm.delete')</div>
7878
<div class="modal-footer">
79-
<a class="btn btn-danger btn-sm" href="/users/delete/{{ $userPaste->link }}" role="button">Yes</a>
80-
<button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">No</button>
79+
<a class="btn btn-danger btn-sm" href="/users/delete/{{ $userPaste->link }}" role="button">{{ __('edpaste.button.yes') }}</a>
80+
<button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">{{ __('edpaste.button.no') }}</button>
8181
</div>
8282
</div>
8383
</div>

resources/views/paste/edit.blade.php

+24-22
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ function checkvalue(value)
3939

4040
<div class="row">
4141
<div class="form-group col-xs-12 @if ($errors->has('pasteTitle')) has-error @endif">
42-
<label for="pasteTitle">Title</label>
43-
<input type="text" class="form-control" name="pasteTitle" id="pasteTitle" placeholder="Title (optional)" maxlength="70" value="{{ old('pasteTitle') ? old('pasteTitle') : $title }}">
42+
<label for="pasteTitle">{{ __('edpaste.paste.title') }}</label>
43+
<input type="text" class="form-control" name="pasteTitle" id="pasteTitle" placeholder="{{ __('edpaste.paste.title.placeholder') }}" maxlength="70" value="{{ old('pasteTitle') ? old('pasteTitle') : $title }}">
4444
@if ($errors->has('pasteTitle'))
4545
<span class="help-block">
4646
<strong>{{ $errors->first('pasteTitle') }}</strong>
@@ -50,13 +50,13 @@ function checkvalue(value)
5050
</div>
5151
<div class="row">
5252
<div class="form-group col-xs-12 @if ($errors->has('pasteContent')) has-error @endif">
53-
<label for="pasteContent">Content</label>
53+
<label for="pasteContent">{{ __('edpaste.paste.content') }}</label>
5454
<script type="text/javascript">
5555
$(document).ready(function(){
5656
$("#pasteContent").autoGrow();
5757
});
5858
</script>
59-
<textarea class="form-control input-sm" name="pasteContent" id="pasteContent" rows="15" placeholder="Paste your text here..." style="font-family: monospace;">{{ old('pasteContent') ? old('pasteContent') : $content }}</textarea>
59+
<textarea class="form-control input-sm" name="pasteContent" id="pasteContent" rows="15" placeholder="{{ __('edpaste.paste.content.placeholder') }}" style="font-family: monospace;">{{ old('pasteContent') ? old('pasteContent') : $content }}</textarea>
6060
@if ($errors->has('pasteContent'))
6161
<span class="help-block">
6262
<strong>{{ $errors->first('pasteContent') }}</strong>
@@ -66,15 +66,15 @@ function checkvalue(value)
6666
</div>
6767
<div class="row">
6868
<div class="form-group col-sm-3 @if ($errors->has('expire')) has-error @endif">
69-
<label for="expire">Paste expiration</label>
69+
<label for="expire">{{ __('edpaste.paste.expiration') }}</label>
7070
<select class="form-control" name="expire" id="expire">
7171
<option disabled selected></option>
72-
<option value="never">Never</option>
73-
<option value="burn">Burn after reading</option>
74-
<option value="10m">10 minutes</option>
75-
<option value="1h">1 hour</option>
76-
<option value="1d">1 day</option>
77-
<option value="1w">1 week</option>
72+
<option value="never" selected="selected">{{ __('edpaste.paste.option.expiration.never') }}</option>
73+
<option value="burn">{{ __('edpaste.paste.option.expiration.burn_after_reading') }}</option>
74+
<option value="10m">{{ __('edpaste.paste.option.expiration.10min') }}</option>
75+
<option value="1h">{{ __('edpaste.paste.option.expiration.1h') }}</option>
76+
<option value="1d">{{ __('edpaste.paste.option.expiration.1d') }}</option>
77+
<option value="1w">{{ __('edpaste.paste.option.expiration.1w') }}</option>
7878
</select>
7979
@if ($errors->has('expire'))
8080
<span class="help-block">
@@ -83,18 +83,20 @@ function checkvalue(value)
8383
@endif
8484
</div>
8585
<div class="form-group col-sm-3 @if ($errors->has('pastePassword')) has-error @endif">
86-
<label for="privacy">Privacy</label>
87-
<select class="form-control" name="privacy" id="privacy" onchange='checkvalue(this.value)'>
88-
<option value="link" {{ $privacy == "link" ? 'selected' : '' }}>Unlisted, access with link</option>
89-
<option value="internal" {{ $privacy == "internal" ? 'selected' : '' }}>Internal</option>
90-
<option value="password" {{ $privacy == "password" || $errors->has('pastePassword') ? 'selected' : '' }}>Password-protected</option>
91-
<option value="private" {{ $privacy == "private" ? 'selected' : '' }}>Private, only me</option>
92-
</select>
86+
<label for="privacy">{{ __('edpaste.paste.privacy') }}</label>
87+
<select class="form-control" name="privacy" id="privacy" onchange='checkvalue(this.value)'>
88+
<option value="link">{{ __('edpaste.paste.option.privacy.link') }}</option>
89+
<option value="internal">{{ __('edpaste.paste.option.privacy.internal') }}</option>
90+
<option value="password" @if ($errors->has('pastePassword')) selected="selected" @endif>{{ __('edpaste.paste.option.privacy.password') }}</option>
91+
@if (cas()->isAuthenticated())
92+
<option value="private">{{ __('edpaste.paste.option.privacy.private') }}</option>
93+
@endif
94+
</select>
9395
</div>
9496
{{-- Ce truc n'apparait que si "Password-protected" est séléctionné plus haut --}}
9597
<div class="form-group col-sm-2 @if ($errors->has('pastePassword')) has-error @endif" id="passwordInput" @if (!$errors->has('pastePassword')) style="display:none;" @endif>
96-
<label for="pastePassword">Password</label>
97-
<input type="password" class="form-control" name="pastePassword" id="pastePassword" placeholder="Enter a password..." maxlength="40">
98+
<label for="pastePassword">{{ __('edpaste.password.title') }}</label>
99+
<input type="password" class="form-control" name="pastePassword" id="pastePassword" placeholder="{{ __('edpaste.password.field.placeholder') }}" maxlength="40">
98100
@if ($errors->has('pastePassword'))
99101
<span class="help-block">
100102
<strong>{{ $errors->first('pastePassword') }}</strong>
@@ -111,9 +113,9 @@ function checkvalue(value)
111113
</script>
112114
{{-- La tooltip n'apparaît que pour les users non-id et le btn devient danger si y'a des erreurs --}}
113115
<div class="checkbox">
114-
<label><input type="checkbox" name="noSyntax" @if ($noSyntax) checked @endif>Disable syntax highlighting</label>
116+
<label><input type="checkbox" name="noSyntax" @if ($noSyntax) checked @endif>{{ __('edpaste.paste.option.disable.syntax') }}</label>
115117
</div>
116-
<button type="submit" id="submit" class="btn @if (count($errors) > 0) btn-danger @else btn-outline-success @endif btn-lg" @if (!cas()->isAuthenticated()) data-toggle="tooltip" data-placement="top" title="Registered users have access to other privacy tools" @endif>Submit</button>
118+
<button type="submit" id="submit" class="btn @if (count($errors) > 0) btn-danger @else btn-outline-success @endif btn-lg" @if (!cas()->isAuthenticated()) data-toggle="tooltip" data-placement="top" title="Registered users have access to other privacy tools" @endif>{{ __('edpaste.paste.submit') }}</button>
117119
</div>
118120
</div>
119121

resources/views/paste/index.blade.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function checkvalue(value)
5252
$("#pasteContent").autoGrow();
5353
});
5454
</script>
55-
<textarea class="form-control input-sm" name="pasteContent" id="pasteContent" rows="15" placeholder="Paste your text here..." style="font-family: monospace;">{{ old('pasteContent') }}</textarea>
55+
<textarea class="form-control input-sm" name="pasteContent" id="pasteContent" rows="15" placeholder="{{ __('edpaste.paste.content.placeholder') }}" style="font-family: monospace;">{{ old('pasteContent') }}</textarea>
5656
@if ($errors->has('pasteContent'))
5757
<span class="help-block">
5858
<strong>{{ $errors->first('pasteContent') }}</strong>
@@ -85,8 +85,8 @@ function checkvalue(value)
8585
</div>
8686
{{-- Ce truc n'apparait que si "Password-protected" est séléctionné plus haut --}}
8787
<div class="form-group col-sm-2 @if ($errors->has('pastePassword')) has-error @endif" id="passwordInput" @if (!$errors->has('pastePassword')) style="display:none;" @endif>
88-
<label for="pastePassword">Password</label>
89-
<input type="password" class="form-control" name="pastePassword" id="pastePassword" placeholder="Enter a password..." maxlength="40">
88+
<label for="pastePassword">{{ __('edpaste.password.title') }}</label>
89+
<input type="password" class="form-control" name="pastePassword" id="pastePassword" placeholder="{{ __('edpaste.password.field.placeholder') }}" maxlength="40">
9090
@if ($errors->has('pastePassword'))
9191
<span class="help-block">
9292
<strong>{{ $errors->first('pastePassword') }}</strong>
@@ -105,7 +105,7 @@ function checkvalue(value)
105105
<div class="checkbox">
106106
<label><input type="checkbox" name="noSyntax">{{ __('edpaste.paste.option.disable.syntax') }}</label>
107107
</div>
108-
<button type="submit" id="submit" class="btn @if (count($errors) > 0) btn-danger @else btn-outline-success @endif btn-lg" @if (!cas()->isAuthenticated()) data-toggle="tooltip" data-placement="top" title="Registered users have access to other privacy tools" @endif>{{ __('edpaste.paste.submit') }}</button>
108+
<button type="submit" id="submit" class="btn @if (count($errors) > 0) btn-danger @else btn-outline-success @endif btn-lg" @if (!cas()->isAuthenticated()) data-toggle="tooltip" data-placement="top" title="{{ __('edpaste.paste.submit.tooltip') }}" @endif>{{ __('edpaste.paste.submit') }}</button>
109109
</div>
110110
</div>
111111

resources/views/paste/view.blade.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -99,12 +99,12 @@
9999
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
100100
<span aria-hidden="true">&times;</span>
101101
</button>
102-
<h4 class="modal-title" id="preview" style="word-wrap: break-word;">Delete "<i>{{ $title }}</i>" ?</h4>
102+
<h4 class="modal-title" id="preview" style="word-wrap: break-word;">@lang('edpaste.paste.confirm.delete.title', ['pastename' => $title])</h4>
103103
</div>
104104
<div class="modal-body">@lang('edpaste.paste.confirm.delete')</div>
105105
<div class="modal-footer">
106-
<a class="btn btn-danger btn-sm" href="/users/delete/{{ $link }}" role="button">Yes</a>
107-
<button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">No</button>
106+
<a class="btn btn-danger btn-sm" href="/users/delete/{{ $link }}" role="button">{{ __('edpaste.button.yes') }}</a>
107+
<button type="button" class="btn btn-secondary btn-sm" data-dismiss="modal">{{ __('edpaste.button.no') }}</button>
108108
</div>
109109
</div>
110110
</div>
@@ -119,14 +119,14 @@
119119
$('[data-toggle="tooltip"]').tooltip()
120120
})
121121
</script>
122-
<li><i class="fa fa-user" data-toggle="tooltip" data-placement="bottom" title="Username"></i> <i class="username">{{ $username }}</i></li>
123-
<li><i class="fa fa-calendar" data-toggle="tooltip" data-placement="bottom" title="Date of creation"></i> <i class="date" data-toggle="tooltip" data-placement="bottom" title="{{ $fulldate }}">{{ $date }}</i></li>
124-
<li><i class="fa fa-eye" data-toggle="tooltip" data-placement="bottom" title="Times viewed"></i> <i>{{ $views }} view{{ $views == 1 ? '' : 's' }}</i></li>
122+
<li><i class="fa fa-user" data-toggle="tooltip" data-placement="bottom" title="{{ __('edpaste.paste.username') }}"></i> <i class="username">{{ $username }}</i></li>
123+
<li><i class="fa fa-calendar" data-toggle="tooltip" data-placement="bottom" title="{{ __('edpaste.paste.creation') }}"></i> <i class="date" data-toggle="tooltip" data-placement="bottom" title="{{ $fulldate }}">{{ $date }}</i></li>
124+
<li><i class="fa fa-eye" data-toggle="tooltip" data-placement="bottom" title="{{ __('edpaste.paste.view_count') }}"></i> <i>{{ trans_choice('edpaste.paste.views', $views, ['count' => $views]) }}</i></li>
125125
{{-- Expiration cachée si xs --}}
126-
<li @if ($expiration == "Never") class="hidden-xs" @endif><i class="fa fa-clock-o" data-toggle="tooltip" data-placement="bottom" title="Expiration"></i> <i>{{ $expiration }}</i></li>
126+
<li @if ($expiration == "Never") class="hidden-xs" @endif><i class="fa fa-clock-o" data-toggle="tooltip" data-placement="bottom" title="{{ __('edpaste.paste.expiration') }}"></i> <i>@if ($expiration == "Never") {{ __('edpaste.paste.option.expiration.never') }} @else {{ $expiration }} @endif</i></li>
127127

128128
{{-- Privacy cachée si xs --}}
129-
<li @if ($privacy == "Public") class="hidden-xs" @endif><i class="fa fa-lock" data-toggle="tooltip" data-placement="bottom" title="Privacy"></i> <i>{{ $privacy }}</i></li>
129+
<li @if ($privacy == "Public") class="hidden-xs" @endif><i class="fa fa-lock" data-toggle="tooltip" data-placement="bottom" title="{{ __('edpaste.paste.privacy') }}"></i> <i>{{ $privacy }}</i></li>
130130
</ul>
131131
</div>
132132
</div>

0 commit comments

Comments
 (0)