joomlagerman / joomla

The J!German translation team provides German translation for Joomla!
https://www.jgerman.de
GNU General Public License v2.0
25 stars 46 forks source link

[5.1] Replace deprecated substr() with substring() #3106

Closed jgerman-bot closed 6 months ago

jgerman-bot commented 6 months ago

New language relevant PR in upstream repo: https://github.com/joomla/joomla-cms/pull/42726 Here are the upstream changes:

Click to expand the diff! ```diff diff --git a/build/media_source/plg_editors_tinymce/js/tinymce-builder.es6.js b/build/media_source/plg_editors_tinymce/js/tinymce-builder.es6.js index cdae08de84272..7345066947363 100644 --- a/build/media_source/plg_editors_tinymce/js/tinymce-builder.es6.js +++ b/build/media_source/plg_editors_tinymce/js/tinymce-builder.es6.js @@ -407,7 +407,7 @@ const TinyMCEBuilder = (container, options) => { [].forEach.call(target.attributes, (attrib) => { if (/^data-/.test(attrib.name)) { - const key = attrib.name.substr(5); + const key = attrib.name.substring(5); actionoptions[key] = attrib.value; } diff --git a/build/media_source/system/js/fields/calendar-locales/date/gregorian/date-helper.es5.js b/build/media_source/system/js/fields/calendar-locales/date/gregorian/date-helper.es5.js index 1f39e8f914e54..1ca3c7fd720c9 100644 --- a/build/media_source/system/js/fields/calendar-locales/date/gregorian/date-helper.es5.js +++ b/build/media_source/system/js/fields/calendar-locales/date/gregorian/date-helper.es5.js @@ -276,7 +276,7 @@ case "%b": case "%B": for (j = 0; j < 12; ++j) { - if (localStrings.months[j].substr(0, a[i].length).toLowerCase() === a[i].toLowerCase()) { + if (localStrings.months[j].substring(0, a[i].length).toLowerCase() === a[i].toLowerCase()) { m = j; break; } @@ -319,7 +319,7 @@ if (a[i].search(/[a-zA-Z]+/) != -1) { var t = -1; for (j = 0; j < 12; ++j) { - if (localStrings.months[j].substr(0, a[i].length).toLowerCase() === a[i].toLowerCase()) { + if (localStrings.months[j].substring(0, a[i].length).toLowerCase() === a[i].toLowerCase()) { t = j; break; } @@ -402,7 +402,7 @@ s["%w"] = w; // the day of the week (range 0 to 6, 0 = SUN) // FIXME: %x : preferred date representation for the current locale without the time // FIXME: %X : preferred time representation for the current locale without the date - s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99) + s["%y"] = ('' + y).substring(2); // year without the century (range 00 to 99) s["%Y"] = y; // year with the century s["%%"] = "%"; // a literal '%' character diff --git a/build/media_source/system/js/fields/calendar-locales/date/jalali/date-helper.es5.js b/build/media_source/system/js/fields/calendar-locales/date/jalali/date-helper.es5.js index 8909fb1f2afb6..55f0cdfdbe413 100644 --- a/build/media_source/system/js/fields/calendar-locales/date/jalali/date-helper.es5.js +++ b/build/media_source/system/js/fields/calendar-locales/date/jalali/date-helper.es5.js @@ -356,7 +356,7 @@ Date.prototype.print = function (str, dateType, translate, localStrings) { s["%w"] = w; // the day of the week (range 0 to 6, 0 = SUN) // FIXME: %x : preferred date representation for the current locale without the time // FIXME: %X : preferred time representation for the current locale without the date - s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99) + s["%y"] = ('' + y).substring(2); // year without the century (range 00 to 99) s["%Y"] = y; // year with the century s["%%"] = "%"; // a literal '%' character @@ -405,7 +405,7 @@ Date.parseFieldDate = function(str, fmt, dateType, localStrings) { case "%b": case "%B": for (j = 0; j < 12; ++j) { - if (localStrings.months[j].substr(0, a[i].length).toLowerCase() === a[i].toLowerCase()) { m = j; break; } + if (localStrings.months[j].substring(0, a[i].length).toLowerCase() === a[i].toLowerCase()) { m = j; break; } } break; @@ -444,7 +444,7 @@ Date.parseFieldDate = function(str, fmt, dateType, localStrings) { if (a[i].search(/[a-zA-Z]+/) != -1) { var t = -1; for (j = 0; j < 12; ++j) { - if (localStrings.months[j].substr(0, a[i].length).toLowerCase() === a[i].toLowerCase()) { t = j; break; } + if (localStrings.months[j].substring(0, a[i].length).toLowerCase() === a[i].toLowerCase()) { t = j; break; } } if (t != -1) { if (m != -1) { diff --git a/build/media_source/system/js/fields/joomla-field-simple-color.w-c.es6.js b/build/media_source/system/js/fields/joomla-field-simple-color.w-c.es6.js index dea9a903b953c..ddf06fa06a643 100644 --- a/build/media_source/system/js/fields/joomla-field-simple-color.w-c.es6.js +++ b/build/media_source/system/js/fields/joomla-field-simple-color.w-c.es6.js @@ -264,7 +264,7 @@ this.icon.setAttribute('class', clss); } - const uniqueId = `simple-color-${Math.random().toString(36).substr(2, 10)}`; + const uniqueId = `simple-color-${Math.random().toString(36).substring(2, 12)}`; this.icon.setAttribute('type', 'button'); this.icon.setAttribute('tabindex', '0'); this.icon.style.backgroundColor = color; diff --git a/build/media_source/system/js/inlinehelp.es6.js b/build/media_source/system/js/inlinehelp.es6.js index 6236b9581f02c..e9387b36fae65 100644 --- a/build/media_source/system/js/inlinehelp.es6.js +++ b/build/media_source/system/js/inlinehelp.es6.js @@ -16,7 +16,7 @@ Joomla.toggleInlineHelp = (toggleClass) => { // The ID of the description whose visibility is toggled. const myId = elDiv.id; // The ID of the control described by this node (same ID, minus the '-desc' suffix). - const controlId = myId ? myId.substr(0, myId.length - 5) : null; + const controlId = myId ? myId.substring(0, myId.length - 5) : null; // Get the control described by this node. const elControl = controlId ? document.getElementById(controlId) : null; // Is this node hidden? ```
tecpromotion commented 6 months ago

nothing to translate