User tests: Successful: Unsuccessful:
Pull Request for Issue # .
Replaces PR #35838 and #35847 .
This pull request (PR) fixes wrong display of strings which should be shown with direction LTR, like alphanumeric version numbers or table names, when the current language has direction RTL.
It fixes wrong display of versions which contain characters (e.g. development, alpha, beta or RC versions, or versions like "1.2.3.v4" like they are used by some Joomla 4 language pack) when the current language is an RTL language in diverse list views in the backend as well as in the pre-update checker's extension details and the database checkers information and error messages.
The implementation follows the recommendations by w3c which can be found here: https://www.w3.org/International/articles/inline-bidi-markup/#whattodo :
dir="ltr"
attribute to HTML elements (spans only up to now) where we know the direction in advance and where it applies to the complete element.dir="ltr"
and optionally a lang
attribute.'‎'
.A new file with a new class and a method "inlineBidirectional" is added to the HTMLHelper (JHtml) which wraps inline text or markup only if its direction is different to the document's direction. The class can later be extended by other methods useful for internationalization.
In the "Live Update" tab of the Joomla Update component, this PR replaces the usage of the RTL mark '‎'
for the installed Joomla version and the latest Joomla version by using the above approach. There might be more places where this could and should be done, but that might also be done with a future PR.
Hint for maintainers: Due to changes in J4 it will not just an easy upmerge of this PR into 4.0-dev, so I'm preparing a separate PR for 4.0-dev. The 2 language strings which are added by this PR here will not be needed in J4 because the database checker has been changed in J4.
@bembelimen @wilsonge @zero-24 Questions:
Can this considered to be a progressive enhancement so it can go into 3.10? Or is that a new feature which has to go into 4.1? Or something in the middle, 4.0.x?
I'll rebase or make a replacement PR if necessary.
Create a new, empty file "3.10.3-2021-10-26.sql" in the folder for update SQL scripts for your database type, i.e. folder "administrator/components/com_admin/sql/updates/mysql" or "administrator/components/com_admin/sql/updates/postgresql".
This makes sure that in the database checker we get a database error shown about not matching schema versions.
Modify the CMS version in the database so it doesn't match the version given by the "libraries/src/Version.php" file.
This makes sure that in the database checker we get a database error shown about not matching update versions.
Example SQL statement for a current 3.10-dev branch and MySQL or MariaDB:
UPDATE `#__extensions` SET `manifest_cache` = REPLACE(`manifest_cache`, '"version":"3.10.4-dev"', '"version":"3.10.3-dev"')
WHERE `name` = 'files_joomla' AND `type` = 'file' AND `element` = 'joomla' AND `client_id` = 0;
Result: See section "Actual result BEFORE applying this Pull Request" below.
In the options, set the update channel to "Custom URL", the minimum stability to "Development" and the custom URL to https://test5.richard-fath.de/next_patch_list_pr-35902.xml . This makes sure that an update for the core will be found for later tests and that this update's version contains some characters. I made this custom update site to point to a 4.0.5-dev version (different to the screenshots used later), but in fact it points to the current nightly build for J4.
Check in the following views all version numbers which contain strings for both kinds of backend languages LTR and RTL. For RTL you can use the previously installed "Persian (Test)".
Result: See section "Actual result BEFORE applying this Pull Request" below.
Result: See section "Actual result BEFORE applying this Pull Request" below.
Result: See section "Actual result BEFORE applying this Pull Request" below.
DELETE FROM `#__extensions` WHERE `type` = 'language' AND `element` = 'de-DE' AND `client_id` = 0;
DELETE FROM `#__extensions` WHERE `type` = 'language' AND `element` = 'fa-XX' AND `client_id` = 0;
DELETE FROM `#__extensions` WHERE `type` = 'plugin' AND `element` = 'weblink' AND `folder` = 'editors-xtd';
Result: See section "Actual result BEFORE applying this Pull Request" below.
Select the discovered extensions and install them using the "Install" button.
In the options of the Joomla Update Component, switch back the update channel so that no update is found.
Apply the patch of this PR.
Repeat steps 4 to 7. In addition, inspect the markup of versions with developer tools of your browser. Check with both LTR and RTL language.
Result: See section "Expected result AFTER applying this Pull Request" below.
Result: Because the modified Persian language pack doesn't contain the new language string added by this PR you see the English texts, see the orange mark in the following image:
Update the modified Persian language pack to the available update. This will update it to a newer modified version which contains the new language string.
Repeat again step 8 and then steps 7 to 10. In addition, inspect the markup of versions and in case of the "Other Information" tab of the database checker also the 2 table names in the version information.
Result: See section "Expected result AFTER applying this Pull Request" below.
Result: See section "Expected result AFTER applying this Pull Request" below.
RTL - The messed position of the "More Detail" toggle is another issue to be solved in another PR
RTL - here the version numbers are already correct
For LTR there should be no changes compared to before applying this PR.
For RTL the versions should look the same as for LTR. See the images below.
When the language has RTL direction, versions are wrapped into a span element with dir="ltr" attribute.
The messed position of the "More Detail" toggle is another issue to be solved in another PR.
There should be no change, both LTR and RTL should work as well as without this PR for this view.
None.
Status | New | ⇒ | Pending |
Category | ⇒ | Administration com_installer com_joomlaupdate com_languages Language & Strings Libraries JavaScript |
Labels |
Added:
?
Language Change
?
|
Fix the overrides of the Hathor template, too.
No need to do that as we made a statement a long time ago regarding no hathor updates
@brianteeman Should I keep the old language sting for Hathor at least so we don't get an untranslated string?
Is it ok that I remove the old language key from the "administrator/language/en-GB/en-GB.com_installer.ini" file?
I don't see any need to keep it as these strings are only used by the database checker.
This is J3 where the custom was not to remove strings
Is it ok that I remove the old language key from the "administrator/language/en-GB/en-GB.com_installer.ini" file?
I don't see any need to keep it as these strings are only used by the database checker.This is J3 where the custom was not to remove strings
@brianteeman Shall I add some deprecated comment then? Or just leave it as it is?
@brianteeman Does it need to add some deprecation comment to the 2 unused, old language strings so we can remove them in J4? If so: Above the line like we did in past in J3, or at line end like we meanwhile do it do for J4?
technically yes.
@richard67 one more suggestion. To prevent placing all inside HTMLHelper
, maybe better make HTMLlanguage helper.
Look for example one of existing helpers in /libraries/cms/html
Create libraries/cms/html/language.php
with class JHtmlLanguage
and with inlineBidirectional()
method.
Then call it like JHtml::_('language.inlineBidirectional', ....)
.
Title |
|
This I do not know
Category | Administration com_installer com_joomlaupdate com_languages Language & Strings Libraries JavaScript | ⇒ | Administration com_installer com_joomlaupdate com_languages Language & Strings Libraries JavaScript Unit Tests |
Found it out myself. Unit tests added. Now I only have to complete a few things in testing instructions, then it will be ready.
זה מבחן
Labels |
Added:
?
|
I think you should be using an actual rtl string when testing rtl
@brianteeman Done.
Title |
|
Title |
|
Title |
|
Ready for testing.
I've noticed there were a few things missing which I've added with the last commits. I have to update screenshots and testing instructions.
Done. Ready for testing again.
I have tested this item
Meanwhile I'm working on a J4 version of this PR because due to changes in J4 it will not be just an easy upmerge of this PR which will do the thing for J4.
I just notice that in Joomla 4 the 2 new language strings added by this PR will not be needed (as well as the 2 old ones for which I've added the deprecation message here), because in J4 the database checker has been changed to work for 3rd party extensions too and not just for the CMS core.
I'll update the deprecation comments in this PR accordingly so it shows that right.
This doesn't invalidate the previous test result so I'll restore that in the tracker.
The last commit has only changed the function calls in unit tests from JHtml::_('language.inlineBidirectional', ...)
to JHtmlLanguage::inlineBidirectional(...)
to be consistent with the other unit tests for JHtml, so the previous human test result is still valid. I'll restore it in the issue tracker.
I have tested this item
@richard67 I have tested this PR. Also, I tested the same yesterday. But I was trying to edit the tested successfully comment but by mistake, It got deleted.
Status | Pending | ⇒ | Ready to Commit |
RTC
To be honest I am not sure anymore if this PR implements the new thing in the right way. Maybe it's a bad idea to have a html helper method having a dependency on the document? Hoping for reviews and feedback.
Maybe I should remote RTC or change this PR back to draft or both so it's not merged by accident?
Status | Ready to Commit | ⇒ | Pending |
Back to pending for now because I think I have to change the way how it's implemented. Sorry to the testers for having wasted your time.
Will also move to draft status.
I strongly recommend that you abandon working on this for J3 and concentrate on j4 only.
For example I noticed today that some existing rtl mitigations in the j4 codebase are no longer required as they were only for old browsers
Thats also what I have said. Focus on a 4.1 patch and when thats finally accepted we can check whether it makes sense to port it back to 3.10 and 4.0
Yes, I only leave this open for documentation of the issues until I have time to make a PR for 4.1. Feel free to close it if it is disturbing.
Closing as it won't be fixed in 3.10 anymore. I'll check sooner or later which of the issues are still there on 4.1-dev and then make PR's if necessary.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-01-28 19:33:10 |
Closed_By | ⇒ | richard67 |
@richard67 ping me before you start on it. Lets do it right and not the previous mish-mash
Oh, that can take a while because it has a very low priority on my list. Highest priority have the updating issues. But I'll let you know when I have something, either an issue or a PR.
In my next attempt I will not create a new helper function but do the wrap into a span with dir=ltr depending on the document's direction directly locally where it's needed and the right display of LTR version with numbers and letters cannot be achieved with other means.
No need to do that as we made a statement a long time ago regarding no hathor updates