Skip to content

Commit 1ad09a7

Browse files
author
Sanjeev Papnoi
committed
Merge branch '1.0' into HEAD
2 parents 0a5219f + 5db9b17 commit 1ad09a7

File tree

8 files changed

+146
-43
lines changed

8 files changed

+146
-43
lines changed

CHANGELOG-1.0.md

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ CHANGELOG for 1.0.x
33

44
This changelog references any relevant changes introduced in 1.0 minor versions.
55

6+
* 1.0.6 (2020-03-17)
7+
* **Misc. Updates:**
8+
* Added Missing Translations.
9+
610
* 1.0.5 (2020-02-12)
711
* **Misc. Updates:**
812
* Included Github issue templates.

Controller/MailboxChannel.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function createMailboxConfiguration(Request $request)
5555

5656
file_put_contents($mailboxService->getPathToConfigurationFile(), (string) $mailboxConfiguration);
5757

58-
$this->addFlash('success', 'Mailbox successfully created.');
58+
$this->addFlash('success', $this->get('translator')->trans('Mailbox successfully created.'));
5959
return new RedirectResponse($this->generateUrl('helpdesk_member_mailbox_settings'));
6060
}
6161
}
@@ -129,7 +129,8 @@ public function updateMailboxConfiguration($id, Request $request)
129129

130130
file_put_contents($mailboxService->getPathToConfigurationFile(), (string) $mailboxConfiguration);
131131

132-
$this->addFlash('success', 'Mailbox successfully updated.');
132+
$this->addFlash('success', $this->get('translator')->trans('Mailbox successfully updated.'));
133+
133134
return new RedirectResponse($this->generateUrl('helpdesk_member_mailbox_settings'));
134135
}
135136
}

Controller/MailboxChannelXHR.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public function removeMailboxConfiguration($id, Request $request)
7070

7171
return new JsonResponse([
7272
'alertClass' => 'success',
73-
'alertMessage' => 'Mailbox configuration removed successfully.',
73+
'alertMessage' => $this->get('translator')->trans('Mailbox configuration removed successfully.'),
7474
]);
7575
}
7676
}

Resources/views/listConfigurations.html.twig

+2-2
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,11 @@
126126
<div class="uv-view {% if app.request.cookies and app.request.cookies.get('uv-asideView') %}uv-aside-view{% endif %}">
127127
<div class="uv-action-bar">
128128
<div class="uv-action-bar-col-lt" style="vertical-align: middle;">
129-
<h1>Mailbox Settings</h1>
129+
<h1>{{ 'Mailbox Settings'|trans }}</h1>
130130
</div>
131131

132132
<div class="uv-action-bar-col-rt" style="vertical-align: middle;">
133-
<a href="{{ path('helpdesk_member_mailbox_create_configuration') }}" type="button" class="uv-btn-action" style="margin: unset;">New Mailbox</a>
133+
<a href="{{ path('helpdesk_member_mailbox_create_configuration') }}" type="button" class="uv-btn-action" style="margin: unset;">{{ 'New Mailbox'|trans }}</a>
134134
</div>
135135
</div>
136136

Resources/views/manageConfigurations.html.twig

+35-35
Original file line numberDiff line numberDiff line change
@@ -34,36 +34,36 @@
3434

3535
<div class="uv-view {% if app.request.cookies and app.request.cookies.get('uv-asideView') %}uv-aside-view{% endif %}">
3636
{% if mailbox is defined and mailbox.id is not empty %}
37-
<h1>Update Mailbox</h1>
37+
<h1>{{ 'Update Mailbox'|trans }}</h1>
3838
{% else %}
39-
<h1>New Mailbox</h1>
39+
<h1>{{ 'Add Mailbox'|trans }}</h1>
4040
{% endif %}
4141

4242
<div class="uv-hr"></div>
4343

4444
<form method="post" action="" id="mailbox-settings-view">
4545
{# Mailer Id #}
4646
<div class="uv-element-block">
47-
<label class="uv-field-label">ID:</label>
47+
<label class="uv-field-label">{{ 'ID'|trans }}</label>
4848

4949
<div class="uv-field-block">
5050
{% if mailbox is defined and mailbox.id is not empty %}
51-
<input type="text" name="id" class="uv-field" value="{{ mailbox.id }}" placeholder="Mailbox ID - Leave blank to automatically create id" />
51+
<input type="text" name="id" class="uv-field" value="{{ mailbox.id }}" placeholder="{{ 'Mailbox ID - Leave blank to automatically create id'|trans }}" />
5252
{% else %}
53-
<input type="text" name="id" class="uv-field" value="" placeholder="Mailbox ID - Leave blank to automatically create id" />
53+
<input type="text" name="id" class="uv-field" value="" placeholder="{{ 'Mailbox ID - Leave blank to automatically create id'|trans }}" />
5454
{% endif %}
5555
</div>
5656
</div>
5757

5858
{# Mailer Name #}
5959
<div class="uv-element-block">
60-
<label class="uv-field-label">Name:</label>
60+
<label class="uv-field-label">{{ 'Name'|trans }}</label>
6161

6262
<div class="uv-field-block">
6363
{% if mailbox is defined and mailbox.name is not empty %}
64-
<input type="text" name="name" class="uv-field" value="{{ mailbox.name }}" placeholder="Mailbox Name" />
64+
<input type="text" name="name" class="uv-field" value="{{ mailbox.name }}" placeholder="{{ 'Mailbox Name'|trans }}" />
6565
{% else %}
66-
<input type="text" name="name" class="uv-field" value="" placeholder="Mailbox Name" />
66+
<input type="text" name="name" class="uv-field" value="" placeholder="{{ 'Mailbox Name'|trans }}" />
6767
{% endif %}
6868
</div>
6969
</div>
@@ -81,30 +81,30 @@
8181
<span class="uv-checkbox-view"></span>
8282
</div>
8383

84-
<span class="uv-checkbox-label">Enable Mailbox</span>
84+
<span class="uv-checkbox-label">{{ 'Enable Mailbox'|trans }}</span>
8585
</label>
8686
</div>
8787

8888
<div class="uv-hr"></div>
8989

9090
{# IMAP Settings #}
91-
<h3 class="section-heading">Incoming Mail (IMAP) Server</h3>
92-
<p class="section-description">Configure your imap settings which will be used to fetch emails from your mailbox.</p>
91+
<h3 class="section-heading">{{ 'Incoming Mail (IMAP) Server'|trans }}</h3>
92+
<p class="section-description">{{ 'Configure your imap settings which will be used to fetch emails from your mailbox.'|trans }}</p>
9393

9494
<div class="uv-element-block">
95-
<label class="uv-field-label">Transport:</label>
95+
<label class="uv-field-label">{{ 'Transport'|trans }}</label>
9696

9797
{% if mailbox is defined %}
9898
<select name="imap[transport]" id="cta-mailbox-imap-transport" class="uv-select">
99-
<option value="custom" {% if mailbox.imapConfiguration.code == 'custom' %}selected{% endif %}>IMAP</option>
100-
<option value="gmail" {% if mailbox.imapConfiguration.code == 'gmail' %}selected{% endif %}>Gmail</option>
101-
<option value="yahoo" {% if mailbox.imapConfiguration.code == 'yahoo' %}selected{% endif %}>Yahoo Mail</option>
99+
<option value="custom" {% if mailbox.imapConfiguration.code == 'custom' %}selected{% endif %}>{{ 'IMAP'|trans }}</option>
100+
<option value="gmail" {% if mailbox.imapConfiguration.code == 'gmail' %}selected{% endif %}>{{ 'Gmail'|trans }}</option>
101+
<option value="yahoo" {% if mailbox.imapConfiguration.code == 'yahoo' %}selected{% endif %}>{{ 'Yahoo'|trans }}</option>
102102
</select>
103103
{% else %}
104104
<select name="imap[transport]" id="cta-mailbox-imap-transport" class="uv-select">
105-
<option value="custom" selected>IMAP</option>
106-
<option value="gmail">Gmail</option>
107-
<option value="yahoo">Yahoo</option>
105+
<option value="custom" selected>{{ 'IMAP'|trans }}</option>
106+
<option value="gmail">{{ 'Gmail'|trans }}</option>
107+
<option value="yahoo">{{ 'Yahoo'|trans }}</option>
108108
</select>
109109
{% endif %}
110110
</div>
@@ -114,15 +114,15 @@
114114
<div class="uv-hr"></div>
115115

116116
{# SwiftMailer Settings #}
117-
<h3 class="section-heading">Outgoing Mail (SMTP) Server</h3>
118-
<p class="section-description">Select a valid Swift Mailer configuration which will be used to send emails through your mailbox.</p>
117+
<h3 class="section-heading">{{ 'Outgoing Mail (SMTP) Server'|trans }}</h3>
118+
<p class="section-description">{{ 'Select a valid Swift Mailer configuration which will be used to send emails through your mailbox.'|trans }}</p>
119119

120120
<div class="uv-element-block">
121-
<label class="uv-field-label">Swift Mailer ID:</label>
121+
<label class="uv-field-label">{{ 'Swift Mailer ID'|trans }}</label>
122122

123123
{% if swiftmailerConfigurations is defined and swiftmailerConfigurations is not empty %}
124124
<select name="swiftmailer_id" class="uv-select">
125-
<option value="none">None Selected</option>
125+
<option value="none">{{ 'None Selected'|trans }}</option>
126126
{% for configuration in swiftmailerConfigurations %}
127127
{% if mailbox is defined and mailbox.swiftmailerConfiguration and mailbox.swiftmailerConfiguration.id == configuration.id %}
128128
<option value="{{ configuration.id }}" selected>{{ configuration.id }}</option>
@@ -133,7 +133,7 @@
133133
</select>
134134
{% else %}
135135
<select name="swiftmailer_id" class="uv-select">
136-
<option value="none">None Selected</option>
136+
<option value="none">{{ 'None Selected'|trans }}</option>
137137
</select>
138138
{% endif %}
139139
</div>
@@ -155,56 +155,56 @@
155155

156156
<script id="imap_conf_template_predefined" type="text/template">
157157
<div class="uv-element-block">
158-
<label class="uv-field-label">Username:</label>
158+
<label class="uv-field-label">{{ 'Username' |trans }}</label>
159159
160160
<div class="uv-field-block">
161161
<% if (typeof(username) != 'undefined' && username != '') { %>
162-
<input class="uv-field" type="text" name="imap[username]" value="<%- username %>" placeholder="Email address">
162+
<input class="uv-field" type="text" name="imap[username]" value="<%- username %>" placeholder="{{ 'Email address'|trans }}">
163163
<% } else { %>
164-
<input class="uv-field" type="text" name="imap[username]" value="" placeholder="Email address">
164+
<input class="uv-field" type="text" name="imap[username]" value="" placeholder="{{ 'Email address'|trans }}">
165165
<% } %>
166166
</div>
167167
</div>
168168
169169
<div class="uv-element-block">
170-
<label class="uv-field-label">Password:</label>
170+
<label class="uv-field-label">{{ 'Password' |trans }}</label>
171171
172172
<div class="uv-field-block">
173-
<input class="uv-field" type="password" name="imap[password]" placeholder="Associated Password">
173+
<input class="uv-field" type="password" name="imap[password]" placeholder="{{ 'Associated Password'|trans }}">
174174
</div>
175175
</div>
176176
</script>
177177

178178
<script id="imap_conf_template_custom" type="text/template">
179179
<div class="uv-element-block">
180-
<label class="uv-field-label">Host:</label>
180+
<label class="uv-field-label">{{ 'Host'|trans }}</label>
181181
182182
<div class="uv-field-block">
183183
<% if (typeof(host) != 'undefined' && host != '') { %>
184184
<input class="uv-field" type="text" name="imap[host]" value="<%- host %>" placeholder="<%- host %>">
185185
<% } else { %>
186-
<input class="uv-field" type="text" name="imap[host]" value="" placeholder="IMAP Host">
186+
<input class="uv-field" type="text" name="imap[host]" value="" placeholder="{{'IMAP Host'|trans }}">
187187
<% } %>
188188
</div>
189189
</div>
190190
191191
<div class="uv-element-block">
192-
<label class="uv-field-label">Email:</label>
192+
<label class="uv-field-label">{{ 'Email'|trans }}</label>
193193
194194
<div class="uv-field-block">
195195
<% if (typeof(username) != 'undefined' && username != '') { %>
196-
<input class="uv-field" type="text" name="imap[username]" value="<%- username %>" placeholder="Email address">
196+
<input class="uv-field" type="text" name="imap[username]" value="<%- username %>" placeholder="{{'Email address'|trans }}">
197197
<% } else { %>
198-
<input class="uv-field" type="text" name="imap[username]" value="" placeholder="Email address">
198+
<input class="uv-field" type="text" name="imap[username]" value="" placeholder="{{'Email address'|trans }}">
199199
<% } %>
200200
</div>
201201
</div>
202202
203203
<div class="uv-element-block">
204-
<label class="uv-field-label">Password:</label>
204+
<label class="uv-field-label">{{'Password'|trans }}</label>
205205
206206
<div class="uv-field-block">
207-
<input class="uv-field" type="password" name="imap[password]" placeholder="Associated Password">
207+
<input class="uv-field" type="password" name="imap[password]" placeholder="{{'Associated Password'|trans }}">
208208
</div>
209209
</div>
210210
</script>

UIComponents/Dashboard/Homepage/Items/Mailbox.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public static function getIcon() : string
2020

2121
public static function getTitle() : string
2222
{
23-
return "Mailbox";
23+
return self::dynamicTranslation("Mailbox");
2424
}
2525

2626
public static function getRouteName() : string

UIComponents/Dashboard/Search/Mailbox.php

+50-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
namespace Webkul\UVDesk\MailboxBundle\UIComponents\Dashboard\Search;
44

55
use Webkul\UVDesk\CoreFrameworkBundle\Dashboard\Segments\SearchItemInterface;
6+
use Symfony\Component\Translation\Translator;
7+
use Symfony\Component\Translation\Loader\YamlFileLoader;
8+
use Symfony\Component\HttpFoundation\Request;
69

710
class Mailbox implements SearchItemInterface
811
{
@@ -19,7 +22,7 @@ public static function getIcon() : string
1922

2023
public static function getTitle() : string
2124
{
22-
return "Mailbox";
25+
return self::dynamicTranslation("Mailbox");
2326
}
2427

2528
public static function getRouteName() : string
@@ -31,4 +34,50 @@ public function getChildrenRoutes() : array
3134
{
3235
return [];
3336
}
37+
38+
public static function dynamicTranslation($data) : string
39+
{
40+
$request = Request::createFromGlobals();
41+
$path = $request->getPathInfo();
42+
$locale = explode("/", $path);
43+
$translator = new Translator($locale[1]);
44+
45+
switch($locale[1])
46+
{
47+
case 'en':
48+
$translator->addLoader('yaml', new YamlFileLoader());
49+
$translator->addResource('yaml',__DIR__."/../../../../../../translations/messages.en.yml", 'en');
50+
break;
51+
case 'es':
52+
$translator->addLoader('yaml', new YamlFileLoader());
53+
$translator->addResource('yaml',__DIR__."/../../../../../../translations/messages.es.yml", 'es');
54+
break;
55+
case 'fr':
56+
$translator->addLoader('yaml', new YamlFileLoader());
57+
$translator->addResource('yaml',__DIR__."/../../../../../../translations/messages.fr.yml", 'fr');
58+
break;
59+
case 'da':
60+
$translator->addLoader('yaml', new YamlFileLoader());
61+
$translator->addResource('yaml',__DIR__."/../../../../../../translations/messages.da.yml", 'da');
62+
break;
63+
case 'de':
64+
$translator->addLoader('yaml', new YamlFileLoader());
65+
$translator->addResource('yaml',__DIR__."/../../../../../../translations/messages.de.yml", 'de');
66+
break;
67+
case 'it':
68+
$translator->addLoader('yaml', new YamlFileLoader());
69+
$translator->addResource('yaml',__DIR__."/../../../../../../translations/messages.it.yml", 'it');
70+
break;
71+
case 'ar':
72+
$translator->addLoader('yaml', new YamlFileLoader());
73+
$translator->addResource('yaml',__DIR__."/../../../../../../translations/messages.ar.yml", 'ar');
74+
break;
75+
case 'tr':
76+
$translator->addLoader('yaml', new YamlFileLoader());
77+
$translator->addResource('yaml',__DIR__."/../../../../../../translations/messages.tr.yml", 'tr');
78+
break;
79+
}
80+
81+
return $translator->trans($data);
82+
}
3483
}

UIComponents/Dashboard/Search/SwiftMailer.php

+50-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
namespace Webkul\UVDesk\MailboxBundle\UIComponents\Dashboard\Search;
44

55
use Webkul\UVDesk\CoreFrameworkBundle\Dashboard\Segments\SearchItemInterface;
6+
use Symfony\Component\Translation\Translator;
7+
use Symfony\Component\Translation\Loader\YamlFileLoader;
8+
use Symfony\Component\HttpFoundation\Request;
69

710
class SwiftMailer implements SearchItemInterface
811
{
@@ -19,7 +22,7 @@ public static function getIcon() : string
1922

2023
public static function getTitle() : string
2124
{
22-
return "SwiftMailer";
25+
return self::dynamicTranslation("SwiftMailer");
2326
}
2427

2528
public static function getRouteName() : string
@@ -31,4 +34,50 @@ public function getChildrenRoutes() : array
3134
{
3235
return [];
3336
}
37+
38+
public static function dynamicTranslation($data) : string
39+
{
40+
$request = Request::createFromGlobals();
41+
$path = $request->getPathInfo();
42+
$locale = explode("/", $path);
43+
$translator = new Translator($locale[1]);
44+
45+
switch($locale[1])
46+
{
47+
case 'en':
48+
$translator->addLoader('yaml', new YamlFileLoader());
49+
$translator->addResource('yaml',__DIR__."/../../../../../../translations/messages.en.yml", 'en');
50+
break;
51+
case 'es':
52+
$translator->addLoader('yaml', new YamlFileLoader());
53+
$translator->addResource('yaml',__DIR__."/../../../../../../translations/messages.es.yml", 'es');
54+
break;
55+
case 'fr':
56+
$translator->addLoader('yaml', new YamlFileLoader());
57+
$translator->addResource('yaml',__DIR__."/../../../../../../translations/messages.fr.yml", 'fr');
58+
break;
59+
case 'da':
60+
$translator->addLoader('yaml', new YamlFileLoader());
61+
$translator->addResource('yaml',__DIR__."/../../../../../../translations/messages.da.yml", 'da');
62+
break;
63+
case 'de':
64+
$translator->addLoader('yaml', new YamlFileLoader());
65+
$translator->addResource('yaml',__DIR__."/../../../../../../translations/messages.de.yml", 'de');
66+
break;
67+
case 'it':
68+
$translator->addLoader('yaml', new YamlFileLoader());
69+
$translator->addResource('yaml',__DIR__."/../../../../../../translations/messages.it.yml", 'it');
70+
break;
71+
case 'ar':
72+
$translator->addLoader('yaml', new YamlFileLoader());
73+
$translator->addResource('yaml',__DIR__."/../../../../../../translations/messages.ar.yml", 'ar');
74+
break;
75+
case 'tr':
76+
$translator->addLoader('yaml', new YamlFileLoader());
77+
$translator->addResource('yaml',__DIR__."/../../../../../../translations/messages.tr.yml", 'tr');
78+
break;
79+
}
80+
81+
return $translator->trans($data);
82+
}
3483
}

0 commit comments

Comments
 (0)