upgrades core to 8.4.2

This commit is contained in:
Bachir Soussi Chiadmi
2017-11-14 16:09:54 +01:00
parent bd60eff9b3
commit c2b4e25be4
3504 changed files with 140306 additions and 38684 deletions
+111
View File
@@ -0,0 +1,111 @@
/**
* @file
* Locale admin behavior.
*/
(function ($, Drupal) {
/**
* Marks changes of translations.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches behavior to show the user if translations has changed.
* @prop {Drupal~behaviorDetach} detach
* Detach behavior to show the user if translations has changed.
*/
Drupal.behaviors.localeTranslateDirty = {
attach() {
const $form = $('#locale-translate-edit-form').once('localetranslatedirty');
if ($form.length) {
// Display a notice if any row changed.
$form.one('formUpdated.localeTranslateDirty', 'table', function () {
const $marker = $(Drupal.theme('localeTranslateChangedWarning')).hide();
$(this).addClass('changed').before($marker);
$marker.fadeIn('slow');
});
// Highlight changed row.
$form.on('formUpdated.localeTranslateDirty', 'tr', function () {
const $row = $(this);
const $rowToMark = $row.once('localemark');
const marker = Drupal.theme('localeTranslateChangedMarker');
$row.addClass('changed');
// Add an asterisk only once if row changed.
if ($rowToMark.length) {
$rowToMark.find('td:first-child .js-form-item').append(marker);
}
});
}
},
detach(context, settings, trigger) {
if (trigger === 'unload') {
const $form = $('#locale-translate-edit-form').removeOnce('localetranslatedirty');
if ($form.length) {
$form.off('formUpdated.localeTranslateDirty');
}
}
},
};
/**
* Show/hide the description details on Available translation updates page.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches behavior for toggling details on the translation update page.
*/
Drupal.behaviors.hideUpdateInformation = {
attach(context, settings) {
const $table = $('#locale-translation-status-form').once('expand-updates');
if ($table.length) {
const $tbodies = $table.find('tbody');
// Open/close the description details by toggling a tr class.
$tbodies.on('click keydown', '.description', function (e) {
if (e.keyCode && (e.keyCode !== 13 && e.keyCode !== 32)) {
return;
}
e.preventDefault();
const $tr = $(this).closest('tr');
$tr.toggleClass('expanded');
// Change screen reader text.
$tr.find('.locale-translation-update__prefix').text(() => {
if ($tr.hasClass('expanded')) {
return Drupal.t('Hide description');
}
return Drupal.t('Show description');
});
});
$table.find('.requirements, .links').hide();
}
},
};
$.extend(Drupal.theme, /** @lends Drupal.theme */{
/**
* Creates markup for a changed translation marker.
*
* @return {string}
* Markup for the marker.
*/
localeTranslateChangedMarker() {
return `<abbr class="warning ajax-changed" title="${Drupal.t('Changed')}">*</abbr>`;
},
/**
* Creates markup for the translation changed warning.
*
* @return {string}
* Markup for the warning.
*/
localeTranslateChangedWarning() {
return `<div class="clearfix messages messages--warning">${Drupal.theme('localeTranslateChangedMarker')} ${Drupal.t('Changes made in this table will not be saved until the form is submitted.')}</div>`;
},
});
}(jQuery, Drupal));
+17 -55
View File
@@ -1,47 +1,35 @@
/**
* @file
* Locale admin behavior.
*/
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function ($, Drupal) {
'use strict';
/**
* Marks changes of translations.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches behavior to show the user if translations has changed.
* @prop {Drupal~behaviorDetach} detach
* Detach behavior to show the user if translations has changed.
*/
Drupal.behaviors.localeTranslateDirty = {
attach: function () {
attach: function attach() {
var $form = $('#locale-translate-edit-form').once('localetranslatedirty');
if ($form.length) {
// Display a notice if any row changed.
$form.one('formUpdated.localeTranslateDirty', 'table', function () {
var $marker = $(Drupal.theme('localeTranslateChangedWarning')).hide();
$(this).addClass('changed').before($marker);
$marker.fadeIn('slow');
});
// Highlight changed row.
$form.on('formUpdated.localeTranslateDirty', 'tr', function () {
var $row = $(this);
var $rowToMark = $row.once('localemark');
var marker = Drupal.theme('localeTranslateChangedMarker');
$row.addClass('changed');
// Add an asterisk only once if row changed.
if ($rowToMark.length) {
$rowToMark.find('td:first-child .js-form-item').append(marker);
}
});
}
},
detach: function (context, settings, trigger) {
detach: function detach(context, settings, trigger) {
if (trigger === 'unload') {
var $form = $('#locale-translate-edit-form').removeOnce('localetranslatedirty');
if ($form.length) {
@@ -51,23 +39,14 @@
}
};
/**
* Show/hide the description details on Available translation updates page.
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches behavior for toggling details on the translation update page.
*/
Drupal.behaviors.hideUpdateInformation = {
attach: function (context, settings) {
attach: function attach(context, settings) {
var $table = $('#locale-translation-status-form').once('expand-updates');
if ($table.length) {
var $tbodies = $table.find('tbody');
// Open/close the description details by toggling a tr class.
$tbodies.on('click keydown', '.description', function (e) {
if (e.keyCode && (e.keyCode !== 13 && e.keyCode !== 32)) {
if (e.keyCode && e.keyCode !== 13 && e.keyCode !== 32) {
return;
}
e.preventDefault();
@@ -75,14 +54,12 @@
$tr.toggleClass('expanded');
// Change screen reader text.
$tr.find('.locale-translation-update__prefix').text(function () {
if ($tr.hasClass('expanded')) {
return Drupal.t('Hide description');
}
else {
return Drupal.t('Show description');
}
return Drupal.t('Show description');
});
});
$table.find('.requirements, .links').hide();
@@ -90,27 +67,12 @@
}
};
$.extend(Drupal.theme, /** @lends Drupal.theme */{
/**
* Creates markup for a changed translation marker.
*
* @return {string}
* Markup for the marker.
*/
localeTranslateChangedMarker: function () {
$.extend(Drupal.theme, {
localeTranslateChangedMarker: function localeTranslateChangedMarker() {
return '<abbr class="warning ajax-changed" title="' + Drupal.t('Changed') + '">*</abbr>';
},
/**
* Creates markup for the translation changed warning.
*
* @return {string}
* Markup for the warning.
*/
localeTranslateChangedWarning: function () {
localeTranslateChangedWarning: function localeTranslateChangedWarning() {
return '<div class="clearfix messages messages--warning">' + Drupal.theme('localeTranslateChangedMarker') + ' ' + Drupal.t('Changes made in this table will not be saved until the form is submitted.') + '</div>';
}
});
})(jQuery, Drupal);
})(jQuery, Drupal);
+7 -5
View File
@@ -238,11 +238,13 @@ function locale_translation_http_check($uri) {
$logger = \Drupal::logger('locale');
try {
$actual_uri = NULL;
$response = \Drupal::service('http_client_factory')->fromOptions(['allow_redirects' => [
'on_redirect' => function(RequestInterface $request, ResponseInterface $response, UriInterface $request_uri) use (&$actual_uri) {
$actual_uri = (string) $request_uri;
}
]])->head($uri);
$response = \Drupal::service('http_client_factory')->fromOptions([
'allow_redirects' => [
'on_redirect' => function (RequestInterface $request, ResponseInterface $response, UriInterface $request_uri) use (&$actual_uri) {
$actual_uri = (string) $request_uri;
}
],
])->head($uri);
$result = [];
// Return the effective URL if it differs from the requested.
+34
View File
@@ -0,0 +1,34 @@
/**
* @file
* Locale behavior.
*/
(function ($, Drupal) {
/**
* Select the language code of an imported file based on its filename.
*
* This only works if the file name ends with "LANGCODE.po".
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches behavior for preselecting language code based on filename.
*/
Drupal.behaviors.importLanguageCodeSelector = {
attach(context, settings) {
const $form = $('#locale-translate-import-form').once('autodetect-lang');
if ($form.length) {
const $langcode = $form.find('.langcode-input');
$form.find('.file-import-input')
.on('change', function () {
// If the filename is fully the language code or the filename
// ends with a language code, pre-select that one.
const matches = $(this).val().match(/([^.][\.]*)([\w-]+)\.po$/);
if (matches && $langcode.find(`option[value="${matches[2]}"]`).length) {
$langcode.val(matches[2]);
}
});
}
},
};
}(jQuery, Drupal));
+13 -28
View File
@@ -1,38 +1,23 @@
/**
* @file
* Locale behavior.
*/
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function ($, Drupal) {
'use strict';
/**
* Select the language code of an imported file based on its filename.
*
* This only works if the file name ends with "LANGCODE.po".
*
* @type {Drupal~behavior}
*
* @prop {Drupal~behaviorAttach} attach
* Attaches behavior for preselecting language code based on filename.
*/
Drupal.behaviors.importLanguageCodeSelector = {
attach: function (context, settings) {
attach: function attach(context, settings) {
var $form = $('#locale-translate-import-form').once('autodetect-lang');
if ($form.length) {
var $langcode = $form.find('.langcode-input');
$form.find('.file-import-input')
.on('change', function () {
// If the filename is fully the language code or the filename
// ends with a language code, pre-select that one.
var matches = $(this).val().match(/([^.][\.]*)([\w-]+)\.po$/);
if (matches && $langcode.find('option[value="' + matches[2] + '"]').length) {
$langcode.val(matches[2]);
}
});
$form.find('.file-import-input').on('change', function () {
var matches = $(this).val().match(/([^.][\.]*)([\w-]+)\.po$/);
if (matches && $langcode.find('option[value="' + matches[2] + '"]').length) {
$langcode.val(matches[2]);
}
});
}
}
};
})(jQuery, Drupal);
})(jQuery, Drupal);
@@ -0,0 +1,84 @@
/**
* @file
* Datepicker JavaScript for the Locale module.
*/
(function ($, Drupal, drupalSettings) {
/**
* Attaches language support to the jQuery UI datepicker component.
*
* @type {Drupal~behavior}
*/
Drupal.behaviors.localeDatepicker = {
attach(context, settings) {
// This code accesses drupalSettings and localized strings via Drupal.t().
// So this code should run after these are initialized. By placing it in an
// attach behavior this is assured.
$.datepicker.regional['drupal-locale'] = $.extend({
closeText: Drupal.t('Done'),
prevText: Drupal.t('Prev'),
nextText: Drupal.t('Next'),
currentText: Drupal.t('Today'),
monthNames: [
Drupal.t('January', {}, { context: 'Long month name' }),
Drupal.t('February', {}, { context: 'Long month name' }),
Drupal.t('March', {}, { context: 'Long month name' }),
Drupal.t('April', {}, { context: 'Long month name' }),
Drupal.t('May', {}, { context: 'Long month name' }),
Drupal.t('June', {}, { context: 'Long month name' }),
Drupal.t('July', {}, { context: 'Long month name' }),
Drupal.t('August', {}, { context: 'Long month name' }),
Drupal.t('September', {}, { context: 'Long month name' }),
Drupal.t('October', {}, { context: 'Long month name' }),
Drupal.t('November', {}, { context: 'Long month name' }),
Drupal.t('December', {}, { context: 'Long month name' }),
],
monthNamesShort: [
Drupal.t('Jan'),
Drupal.t('Feb'),
Drupal.t('Mar'),
Drupal.t('Apr'),
Drupal.t('May'),
Drupal.t('Jun'),
Drupal.t('Jul'),
Drupal.t('Aug'),
Drupal.t('Sep'),
Drupal.t('Oct'),
Drupal.t('Nov'),
Drupal.t('Dec'),
],
dayNames: [
Drupal.t('Sunday'),
Drupal.t('Monday'),
Drupal.t('Tuesday'),
Drupal.t('Wednesday'),
Drupal.t('Thursday'),
Drupal.t('Friday'),
Drupal.t('Saturday'),
],
dayNamesShort: [
Drupal.t('Sun'),
Drupal.t('Mon'),
Drupal.t('Tue'),
Drupal.t('Wed'),
Drupal.t('Thu'),
Drupal.t('Fri'),
Drupal.t('Sat'),
],
dayNamesMin: [
Drupal.t('Su'),
Drupal.t('Mo'),
Drupal.t('Tu'),
Drupal.t('We'),
Drupal.t('Th'),
Drupal.t('Fr'),
Drupal.t('Sa'),
],
dateFormat: Drupal.t('mm/dd/yy'),
firstDay: 0,
isRTL: 0,
}, drupalSettings.jquery.ui.datepicker);
$.datepicker.setDefaults($.datepicker.regional['drupal-locale']);
},
};
}(jQuery, Drupal, drupalSettings));
+12 -72
View File
@@ -1,82 +1,23 @@
/**
* @file
* Datepicker JavaScript for the Locale module.
*/
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
(function ($, Drupal, drupalSettings) {
'use strict';
/**
* Attaches language support to the jQuery UI datepicker component.
*
* @type {Drupal~behavior}
*/
Drupal.behaviors.localeDatepicker = {
attach: function (context, settings) {
// This code accesses drupalSettings and localized strings via Drupal.t().
// So this code should run after these are initialized. By placing it in an
// attach behavior this is assured.
attach: function attach(context, settings) {
$.datepicker.regional['drupal-locale'] = $.extend({
closeText: Drupal.t('Done'),
prevText: Drupal.t('Prev'),
nextText: Drupal.t('Next'),
currentText: Drupal.t('Today'),
monthNames: [
Drupal.t('January', {}, {context: 'Long month name'}),
Drupal.t('February', {}, {context: 'Long month name'}),
Drupal.t('March', {}, {context: 'Long month name'}),
Drupal.t('April', {}, {context: 'Long month name'}),
Drupal.t('May', {}, {context: 'Long month name'}),
Drupal.t('June', {}, {context: 'Long month name'}),
Drupal.t('July', {}, {context: 'Long month name'}),
Drupal.t('August', {}, {context: 'Long month name'}),
Drupal.t('September', {}, {context: 'Long month name'}),
Drupal.t('October', {}, {context: 'Long month name'}),
Drupal.t('November', {}, {context: 'Long month name'}),
Drupal.t('December', {}, {context: 'Long month name'})
],
monthNamesShort: [
Drupal.t('Jan'),
Drupal.t('Feb'),
Drupal.t('Mar'),
Drupal.t('Apr'),
Drupal.t('May'),
Drupal.t('Jun'),
Drupal.t('Jul'),
Drupal.t('Aug'),
Drupal.t('Sep'),
Drupal.t('Oct'),
Drupal.t('Nov'),
Drupal.t('Dec')
],
dayNames: [
Drupal.t('Sunday'),
Drupal.t('Monday'),
Drupal.t('Tuesday'),
Drupal.t('Wednesday'),
Drupal.t('Thursday'),
Drupal.t('Friday'),
Drupal.t('Saturday')
],
dayNamesShort: [
Drupal.t('Sun'),
Drupal.t('Mon'),
Drupal.t('Tue'),
Drupal.t('Wed'),
Drupal.t('Thu'),
Drupal.t('Fri'),
Drupal.t('Sat')
],
dayNamesMin: [
Drupal.t('Su'),
Drupal.t('Mo'),
Drupal.t('Tu'),
Drupal.t('We'),
Drupal.t('Th'),
Drupal.t('Fr'),
Drupal.t('Sa')
],
monthNames: [Drupal.t('January', {}, { context: 'Long month name' }), Drupal.t('February', {}, { context: 'Long month name' }), Drupal.t('March', {}, { context: 'Long month name' }), Drupal.t('April', {}, { context: 'Long month name' }), Drupal.t('May', {}, { context: 'Long month name' }), Drupal.t('June', {}, { context: 'Long month name' }), Drupal.t('July', {}, { context: 'Long month name' }), Drupal.t('August', {}, { context: 'Long month name' }), Drupal.t('September', {}, { context: 'Long month name' }), Drupal.t('October', {}, { context: 'Long month name' }), Drupal.t('November', {}, { context: 'Long month name' }), Drupal.t('December', {}, { context: 'Long month name' })],
monthNamesShort: [Drupal.t('Jan'), Drupal.t('Feb'), Drupal.t('Mar'), Drupal.t('Apr'), Drupal.t('May'), Drupal.t('Jun'), Drupal.t('Jul'), Drupal.t('Aug'), Drupal.t('Sep'), Drupal.t('Oct'), Drupal.t('Nov'), Drupal.t('Dec')],
dayNames: [Drupal.t('Sunday'), Drupal.t('Monday'), Drupal.t('Tuesday'), Drupal.t('Wednesday'), Drupal.t('Thursday'), Drupal.t('Friday'), Drupal.t('Saturday')],
dayNamesShort: [Drupal.t('Sun'), Drupal.t('Mon'), Drupal.t('Tue'), Drupal.t('Wed'), Drupal.t('Thu'), Drupal.t('Fri'), Drupal.t('Sat')],
dayNamesMin: [Drupal.t('Su'), Drupal.t('Mo'), Drupal.t('Tu'), Drupal.t('We'), Drupal.t('Th'), Drupal.t('Fr'), Drupal.t('Sa')],
dateFormat: Drupal.t('mm/dd/yy'),
firstDay: 0,
isRTL: 0
@@ -84,5 +25,4 @@
$.datepicker.setDefaults($.datepicker.regional['drupal-locale']);
}
};
})(jQuery, Drupal, drupalSettings);
})(jQuery, Drupal, drupalSettings);
+3 -3
View File
@@ -9,8 +9,8 @@ dependencies:
- language
- file
# Information added by Drupal.org packaging script on 2017-08-16
version: '8.3.7'
# Information added by Drupal.org packaging script on 2017-11-03
version: '8.4.2'
core: '8.x'
project: 'drupal'
datestamp: 1502903957
datestamp: 1509719929
+2 -1
View File
@@ -111,7 +111,8 @@ function locale_schema() {
'customized' => [
'type' => 'int',
'not null' => TRUE,
'default' => 0, // LOCALE_NOT_CUSTOMIZED
// LOCALE_NOT_CUSTOMIZED
'default' => 0,
'description' => 'Boolean indicating whether the translation is custom to this site.',
],
],
+2 -2
View File
@@ -67,7 +67,7 @@ function locale_translation_get_projects(array $project_names = []) {
locale_translation_build_projects();
}
$projects = \Drupal::service('locale.project')->getAll();
array_walk($projects, function(&$project) {
array_walk($projects, function (&$project) {
$project = (object) $project;
});
}
@@ -329,7 +329,7 @@ function locale_cron_fill_queue() {
// Determine which project+language should be updated.
$last = REQUEST_TIME - $config->get('translation.update_interval_days') * 3600 * 24;
$projects = \Drupal::service('locale.project')->getAll();
$projects = array_filter($projects, function($project) {
$projects = array_filter($projects, function ($project) {
return $project['status'] == 1;
});
$files = db_select('locale_file', 'f')
@@ -8,6 +8,7 @@ source:
variables:
- locale_cache_strings
- locale_js_directory
source_module: locale
process:
cache_strings: locale_cache_strings
'javascript/directory': locale_js_directory
+1 -2
View File
@@ -166,7 +166,7 @@ class ImportForm extends FormBase {
* {@inheritdoc}
*/
public function submitForm(array &$form, FormStateInterface $form_state) {
\Drupal::moduleHandler()->loadInclude('locale', 'translation.inc');
$this->moduleHandler->loadInclude('locale', 'translation.inc');
// Add language, if not yet supported.
$language = $this->languageManager->getLanguage($form_state->getValue('langcode'));
if (empty($language)) {
@@ -185,7 +185,6 @@ class ImportForm extends FormBase {
batch_set($batch);
// Create or update all configuration translations for this language.
\Drupal::moduleHandler()->loadInclude('locale', 'bulk.inc');
if ($batch = locale_config_batch_update_components($options, [$form_state->getValue('langcode')])) {
batch_set($batch);
}
@@ -140,9 +140,7 @@ class LocaleConfigManager {
if ($this->isSupported($name)) {
// Create typed configuration wrapper based on install storage data.
$data = $this->defaultConfigStorage->read($name);
$type_definition = $this->typedConfigManager->getDefinition($name);
$data_definition = $this->typedConfigManager->buildDataDefinition($type_definition, $data);
$typed_config = $this->typedConfigManager->create($data_definition, $data);
$typed_config = $this->typedConfigManager->createFromNameAndData($name, $data);
if ($typed_config instanceof TraversableTypedDataInterface) {
return $this->getTranslatableData($typed_config);
}
@@ -99,7 +99,7 @@ class LocaleTranslation extends QueueWorkerBase implements ContainerFactoryPlugi
}
else {
$batch_context = $args[$last];
unset ($args[$last]);
unset($args[$last]);
}
$args = array_merge($args, [&$batch_context]);
@@ -3,6 +3,7 @@
namespace Drupal\locale;
use Drupal\Core\Database\Connection;
use Drupal\Core\Database\Query\Condition;
/**
* Defines a class to store localized strings in the database.
@@ -416,7 +417,7 @@ class StringDatabaseStorage implements StringStorageInterface {
elseif ($table_alias == 't' && $join === 'leftJoin') {
// Conditions for target fields when doing an outer join only make
// sense if we add also OR field IS NULL.
$query->condition(db_or()
$query->condition((new Condition('OR'))
->condition($field_alias, (array) $value, 'IN')
->isNull($field_alias)
);
@@ -429,7 +430,7 @@ class StringDatabaseStorage implements StringStorageInterface {
// Process other options, string filter, query limit, etc.
if (!empty($options['filters'])) {
if (count($options['filters']) > 1) {
$filter = db_or();
$filter = new Condition('OR');
$query->condition($filter);
}
else {
@@ -0,0 +1,52 @@
/**
* @file
* JavaScript for locale_test.module.
*
* @ignore
*/
Drupal.t("Standard Call t");
Drupal
.
t
(
"Whitespace Call t"
)
;
Drupal.t('Single Quote t');
Drupal.t('Single Quote \'Escaped\' t');
Drupal.t('Single Quote ' + 'Concat ' + 'strings ' + 't');
Drupal.t("Double Quote t");
Drupal.t("Double Quote \"Escaped\" t");
Drupal.t("Double Quote " + "Concat " + "strings " + "t");
Drupal.t("Context Unquoted t", {}, {context: "Context string unquoted"});
Drupal.t("Context Single Quoted t", {}, {'context': "Context string single quoted"});
Drupal.t("Context Double Quoted t", {}, {"context": "Context string double quoted"});
Drupal.t("Context !key Args t", {'!key': 'value'}, {context: "Context string"});
Drupal.formatPlural(1, "Standard Call plural", "Standard Call @count plural");
Drupal
.
formatPlural
(
1,
"Whitespace Call plural",
"Whitespace Call @count plural"
)
;
Drupal.formatPlural(1, 'Single Quote plural', 'Single Quote @count plural');
Drupal.formatPlural(1, 'Single Quote \'Escaped\' plural', 'Single Quote \'Escaped\' @count plural');
Drupal.formatPlural(1, "Double Quote plural", "Double Quote @count plural");
Drupal.formatPlural(1, "Double Quote \"Escaped\" plural", "Double Quote \"Escaped\" @count plural");
Drupal.formatPlural(1, "Context Unquoted plural", "Context Unquoted @count plural", {}, {context: "Context string unquoted"});
Drupal.formatPlural(1, "Context Single Quoted plural", "Context Single Quoted @count plural", {}, {'context': "Context string single quoted"});
Drupal.formatPlural(1, "Context Double Quoted plural", "Context Double Quoted @count plural", {}, {"context": "Context string double quoted"});
Drupal.formatPlural(1, "Context !key Args plural", "Context !key Args @count plural", {'!key': 'value'}, {context: "Context string"});
+15 -29
View File
@@ -1,18 +1,12 @@
/**
* @file
* JavaScript for locale_test.module.
*
* @ignore
*/
* DO NOT EDIT THIS FILE.
* See the following change record for more information,
* https://www.drupal.org/node/2815083
* @preserve
**/
Drupal.t("Standard Call t");
Drupal
.
t
(
"Whitespace Call t"
)
;
Drupal.t("Whitespace Call t");
Drupal.t('Single Quote t');
Drupal.t('Single Quote \'Escaped\' t');
@@ -22,22 +16,14 @@ Drupal.t("Double Quote t");
Drupal.t("Double Quote \"Escaped\" t");
Drupal.t("Double Quote " + "Concat " + "strings " + "t");
Drupal.t("Context Unquoted t", {}, {context: "Context string unquoted"});
Drupal.t("Context Single Quoted t", {}, {'context': "Context string single quoted"});
Drupal.t("Context Double Quoted t", {}, {"context": "Context string double quoted"});
Drupal.t("Context Unquoted t", {}, { context: "Context string unquoted" });
Drupal.t("Context Single Quoted t", {}, { 'context': "Context string single quoted" });
Drupal.t("Context Double Quoted t", {}, { "context": "Context string double quoted" });
Drupal.t("Context !key Args t", {'!key': 'value'}, {context: "Context string"});
Drupal.t("Context !key Args t", { '!key': 'value' }, { context: "Context string" });
Drupal.formatPlural(1, "Standard Call plural", "Standard Call @count plural");
Drupal
.
formatPlural
(
1,
"Whitespace Call plural",
"Whitespace Call @count plural"
)
;
Drupal.formatPlural(1, "Whitespace Call plural", "Whitespace Call @count plural");
Drupal.formatPlural(1, 'Single Quote plural', 'Single Quote @count plural');
Drupal.formatPlural(1, 'Single Quote \'Escaped\' plural', 'Single Quote \'Escaped\' @count plural');
@@ -45,8 +31,8 @@ Drupal.formatPlural(1, 'Single Quote \'Escaped\' plural', 'Single Quote \'Escape
Drupal.formatPlural(1, "Double Quote plural", "Double Quote @count plural");
Drupal.formatPlural(1, "Double Quote \"Escaped\" plural", "Double Quote \"Escaped\" @count plural");
Drupal.formatPlural(1, "Context Unquoted plural", "Context Unquoted @count plural", {}, {context: "Context string unquoted"});
Drupal.formatPlural(1, "Context Single Quoted plural", "Context Single Quoted @count plural", {}, {'context': "Context string single quoted"});
Drupal.formatPlural(1, "Context Double Quoted plural", "Context Double Quoted @count plural", {}, {"context": "Context string double quoted"});
Drupal.formatPlural(1, "Context Unquoted plural", "Context Unquoted @count plural", {}, { context: "Context string unquoted" });
Drupal.formatPlural(1, "Context Single Quoted plural", "Context Single Quoted @count plural", {}, { 'context': "Context string single quoted" });
Drupal.formatPlural(1, "Context Double Quoted plural", "Context Double Quoted @count plural", {}, { "context": "Context string double quoted" });
Drupal.formatPlural(1, "Context !key Args plural", "Context !key Args @count plural", {'!key': 'value'}, {context: "Context string"});
Drupal.formatPlural(1, "Context !key Args plural", "Context !key Args @count plural", { '!key': 'value' }, { context: "Context string" });
@@ -6,8 +6,8 @@ package: Testing
# version: VERSION
# Information added by Drupal.org packaging script on 2017-08-16
version: '8.3.7'
# Information added by Drupal.org packaging script on 2017-11-03
version: '8.4.2'
core: '8.x'
project: 'drupal'
datestamp: 1502903957
datestamp: 1509719929
@@ -8,8 +8,8 @@ hidden: true
'interface translation project': locale_test
'interface translation server pattern': core/modules/locale/test/test.%language.po
# Information added by Drupal.org packaging script on 2017-08-16
version: '8.3.7'
# Information added by Drupal.org packaging script on 2017-11-03
version: '8.4.2'
core: '8.x'
project: 'drupal'
datestamp: 1502903957
datestamp: 1509719929
@@ -6,8 +6,8 @@ package: Testing
# core: 8.x
hidden: true
# Information added by Drupal.org packaging script on 2017-08-16
version: '8.3.7'
# Information added by Drupal.org packaging script on 2017-11-03
version: '8.4.2'
core: '8.x'
project: 'drupal'
datestamp: 1502903957
datestamp: 1509719929
@@ -8,8 +8,8 @@ hidden: true
'interface translation project': locale_test_translate
'interface translation server pattern': core/modules/locale/tests/test.%language.po
# Information added by Drupal.org packaging script on 2017-08-16
version: '8.3.7'
# Information added by Drupal.org packaging script on 2017-11-03
version: '8.4.2'
core: '8.x'
project: 'drupal'
datestamp: 1502903957
datestamp: 1509719929
@@ -341,7 +341,8 @@ class LocaleImportFunctionalTest extends BrowserTestBase {
// Import a .po file to translate.
$this->importPoFile($this->getPoFileWithConfigDe(), [
'langcode' => $langcode]);
'langcode' => $langcode,
]);
// Check that the 'Anonymous' string is translated.
$config = \Drupal::languageManager()->getLanguageConfigOverride($langcode, 'user.settings');
@@ -21,73 +21,86 @@ class LocaleJavascriptTranslationTest extends BrowserTestBase {
public static $modules = ['locale', 'locale_test'];
public function testFileParsing() {
$filename = __DIR__ . '/../../locale_test.js';
// Parse the file to look for source strings.
_locale_parse_js_file($filename);
// This test is for ensuring that the regular expression in
// _locale_parse_js_file() finds translatable source strings in all valid
// JavaScript syntax regardless of the coding style used, especially with
// respect to optional whitespace, line breaks, etc.
// - We test locale_test.es6.js, because that is the one that contains a
// variety of whitespace styles.
// - We also test the transpiled locale_test.js as an extra double-check
// that JavaScript transpilation doesn't change what
// _locale_parse_js_file() finds.
$files[] = __DIR__ . '/../../locale_test.es6.js';
$files[] = __DIR__ . '/../../locale_test.js';
// Get all of the source strings that were found.
$strings = $this->container
->get('locale.storage')
->getStrings([
'type' => 'javascript',
'name' => $filename,
]);
foreach ($files as $filename) {
// Parse the file to look for source strings.
_locale_parse_js_file($filename);
$source_strings = [];
foreach ($strings as $string) {
$source_strings[$string->source] = $string->context;
// Get all of the source strings that were found.
$strings = $this->container
->get('locale.storage')
->getStrings([
'type' => 'javascript',
'name' => $filename,
]);
$source_strings = [];
foreach ($strings as $string) {
$source_strings[$string->source] = $string->context;
}
$etx = LOCALE_PLURAL_DELIMITER;
// List of all strings that should be in the file.
$test_strings = [
'Standard Call t' => '',
'Whitespace Call t' => '',
'Single Quote t' => '',
"Single Quote \\'Escaped\\' t" => '',
'Single Quote Concat strings t' => '',
'Double Quote t' => '',
"Double Quote \\\"Escaped\\\" t" => '',
'Double Quote Concat strings t' => '',
'Context !key Args t' => 'Context string',
'Context Unquoted t' => 'Context string unquoted',
'Context Single Quoted t' => 'Context string single quoted',
'Context Double Quoted t' => 'Context string double quoted',
"Standard Call plural{$etx}Standard Call @count plural" => '',
"Whitespace Call plural{$etx}Whitespace Call @count plural" => '',
"Single Quote plural{$etx}Single Quote @count plural" => '',
"Single Quote \\'Escaped\\' plural{$etx}Single Quote \\'Escaped\\' @count plural" => '',
"Double Quote plural{$etx}Double Quote @count plural" => '',
"Double Quote \\\"Escaped\\\" plural{$etx}Double Quote \\\"Escaped\\\" @count plural" => '',
"Context !key Args plural{$etx}Context !key Args @count plural" => 'Context string',
"Context Unquoted plural{$etx}Context Unquoted @count plural" => 'Context string unquoted',
"Context Single Quoted plural{$etx}Context Single Quoted @count plural" => 'Context string single quoted',
"Context Double Quoted plural{$etx}Context Double Quoted @count plural" => 'Context string double quoted',
];
// Assert that all strings were found properly.
foreach ($test_strings as $str => $context) {
$args = ['%source' => $str, '%context' => $context];
// Make sure that the string was found in the file.
$this->assertTrue(isset($source_strings[$str]), SafeMarkup::format('Found source string: %source', $args));
// Make sure that the proper context was matched.
$message = $context ? SafeMarkup::format('Context for %source is %context', $args) : SafeMarkup::format('Context for %source is blank', $args);
$this->assertTrue(isset($source_strings[$str]) && $source_strings[$str] === $context, $message);
}
$this->assertEqual(count($source_strings), count($test_strings), 'Found correct number of source strings.');
}
$etx = LOCALE_PLURAL_DELIMITER;
// List of all strings that should be in the file.
$test_strings = [
'Standard Call t' => '',
'Whitespace Call t' => '',
'Single Quote t' => '',
"Single Quote \\'Escaped\\' t" => '',
'Single Quote Concat strings t' => '',
'Double Quote t' => '',
"Double Quote \\\"Escaped\\\" t" => '',
'Double Quote Concat strings t' => '',
'Context !key Args t' => 'Context string',
'Context Unquoted t' => 'Context string unquoted',
'Context Single Quoted t' => 'Context string single quoted',
'Context Double Quoted t' => 'Context string double quoted',
"Standard Call plural{$etx}Standard Call @count plural" => '',
"Whitespace Call plural{$etx}Whitespace Call @count plural" => '',
"Single Quote plural{$etx}Single Quote @count plural" => '',
"Single Quote \\'Escaped\\' plural{$etx}Single Quote \\'Escaped\\' @count plural" => '',
"Double Quote plural{$etx}Double Quote @count plural" => '',
"Double Quote \\\"Escaped\\\" plural{$etx}Double Quote \\\"Escaped\\\" @count plural" => '',
"Context !key Args plural{$etx}Context !key Args @count plural" => 'Context string',
"Context Unquoted plural{$etx}Context Unquoted @count plural" => 'Context string unquoted',
"Context Single Quoted plural{$etx}Context Single Quoted @count plural" => 'Context string single quoted',
"Context Double Quoted plural{$etx}Context Double Quoted @count plural" => 'Context string double quoted',
];
// Assert that all strings were found properly.
foreach ($test_strings as $str => $context) {
$args = ['%source' => $str, '%context' => $context];
// Make sure that the string was found in the file.
$this->assertTrue(isset($source_strings[$str]), SafeMarkup::format('Found source string: %source', $args));
// Make sure that the proper context was matched.
$message = $context ? SafeMarkup::format('Context for %source is %context', $args) : SafeMarkup::format('Context for %source is blank', $args);
$this->assertTrue(isset($source_strings[$str]) && $source_strings[$str] === $context, $message);
}
$this->assertEqual(count($source_strings), count($test_strings), 'Found correct number of source strings.');
}
/**
@@ -2,7 +2,7 @@
namespace Drupal\Tests\locale\Functional;
use Drupal\tour\Tests\TourTestBase;
use Drupal\Tests\tour\Functional\TourTestBase;
/**
* Tests the Translate Interface tour.
@@ -6,7 +6,6 @@ use Drupal\Core\Language\LanguageInterface;
use Drupal\language\Entity\ConfigurableLanguage;
use Drupal\KernelTests\KernelTestBase;
/**
* Tests that the configurable language manager and locale operate correctly.
*