Add context to 'Select' translation strings

This commit is contained in:
Tautvidas Sipavičius
2017-01-30 20:44:40 +02:00
parent af2a6b2559
commit bedfc4f80c
8 changed files with 24 additions and 16 deletions

View File

@@ -24,6 +24,7 @@ class I18n extends \Twig_Extension {
'localize' => 'localize',
'__' => 'translate',
'_n' => 'pluralize',
'_x' => 'translateWithContext',
'date' => 'date'
);
@@ -63,6 +64,12 @@ class I18n extends \Twig_Extension {
return call_user_func_array('_n', $this->setTextDomain($args));
}
function translateWithContext() {
$args = func_get_args();
return call_user_func_array('_x', $this->setTextDomain($args));
}
function date() {
$args = func_get_args();
$date = (isset($args[0])) ? $args[0] : null;

View File

@@ -260,6 +260,7 @@ class StringExtractor {
$function_patterns = array(
'/(__)\((([\'"]).+?\3)\)/',
'/(_x)\(([\'"].+?[\'"],\s*[\'"].+?[\'"])\)/',
'/(_n)\(([\'"].+?[\'"],\s*[\'"].+?[\'"],\s*.+?)\)/'
);

View File

@@ -34,7 +34,7 @@
</option>
<option
{{#ifCond type '==' 'select'}}selected="selected"{{/ifCond}}
value="select"><%= __('Select') %>
value="select"><%= _x('Select', 'Form input type') %>
</option>
<option
{{#ifCond type '==' 'date'}}selected="selected"{{/ifCond}}

View File

@@ -97,7 +97,7 @@
'mailpoetGuideTemplateDescription': __("This is the standard template that comes with MailPoet."),
'confirmTemplateDeletion': __('You are about to delete the template named "%$1s".'),
'delete': __('Delete'),
'select': __('Select'),
'select': _x('Select', 'Verb'),
'preview': __('Preview'),
'selectTemplateTitle': __('Select a responsive template'),
@@ -203,13 +203,13 @@
'thursdayShort': __('Thu'),
'fridayShort': __('Fri'),
'saturdayShort': __('Sat'),
'sundayMin': __('S'),
'mondayMin': __('M'),
'tuesdayMin': __('T'),
'wednesdayMin': __('W'),
'thursdayMin': __('T'),
'fridayMin': __('F'),
'saturdayMin': __('S'),
'sundayMin': _x('S', 'Sunday - one letter abbreviation'),
'mondayMin': _x('M', 'Monday - one letter abbreviation'),
'tuesdayMin': _x('T', 'Tuesday - one letter abbreviation'),
'wednesdayMin': _x('W', 'Wednesday - one letter abbreviation'),
'thursdayMin': _x('T', 'Thursday - one letter abbreviation'),
'fridayMin': _x('F', 'Friday - one letter abbreviation'),
'saturdayMin': _x('S', 'Saturday - one letter abbreviation'),
'next': __('Next'),
'previous': __('Previous'),
'newsletterBeingSent': __('The newsletter is being sent...'),

View File

@@ -49,7 +49,7 @@
</label>
</th>
<td>
<select id="export_lists" data-placeholder="<%= __('Select') %>" multiple="multiple"></select>
<select id="export_lists" data-placeholder="<%= _x('Select', 'Verb') %>" multiple="multiple"></select>
</td>
</tr>
{{/if}}
@@ -60,7 +60,7 @@
</label>
</th>
<td>
<select id="export_columns" data-placeholder="<%= __('Select') %>" multiple="multiple"></select>
<select id="export_columns" data-placeholder="<%= _x('Select', 'Verb') %>" multiple="multiple"></select>
</td>
</tr>
{{#if groupBySegmentOption}}

View File

@@ -34,7 +34,7 @@
<%= localize({
'noMailChimpLists': __('No active lists found'),
'serverError': __('Server error:'),
'select': __('Select'),
'select': __('Selecto', 'Form input type'),
'csvKBLink': csvKBLink,
'wrongFileFormat': __('Only comma-separated (CSV) file formats are supported.'),
'maxPostSizeNotice': __('Your CSV is over %s and is too big to process. Please split the file into two or more sections.')|replace({'%s': maxPostSize}),

View File

@@ -92,7 +92,7 @@
</label>
</th>
<td>
<select class="mailchimp_lists_select" data-placeholder="<%= __('Select') %>" multiple="multiple"></select>
<select class="mailchimp_lists_select" data-placeholder="<%= _x('Select', 'Verb') %>" multiple="multiple"></select>
</td>
</tr>
</tbody>

View File

@@ -38,7 +38,7 @@
</label>
</th>
<td>
<select id="mailpoet_segments_select" data-placeholder="<%= __('Select') %>" multiple="multiple"></select>
<select id="mailpoet_segments_select" data-placeholder="<%= _x('Select', 'Verb') %>" multiple="multiple"></select>
<a href="javascript:;" class="mailpoet_create_segment"><%= __('Create a new list') %></a>
</td>
</tr>