? ? Pending

User tests: Successful: Unsuccessful:

avatar infograf768
infograf768
11 Sep 2017

Pull Request for Issue #17917

Thanks @imanickam for your findings

Issues

The sample data blog can't work with languages using non latin glyphs because aliases are set to the same time stamp for all aliases and menutype is empty in that case.
This is due to the use of JApplicationHelper::stringURLSafe()

The menutype can use non latin glyphs but can't work for some languages because it should be limited to 24 characters in the db and it is defined in the existing code using the title which may be longer in the ini file.

The catid is hard coded as ['9'] although it should use the correct catid depending on the sample data blog installed.
This is specially true when installing multiple sample data blogs in a multingual site (after switching admin language).

Changes in this PR

Truncating menutypes and not using JApplicationHelper::stringURLSafe() as it is not anyway necessary there. Adding numbering.

Hardcoding categories aliases to cope with the time stamp.

Hardcoding aliases for menu items to cope with the time stamp.

Adding numbering and default sample to articles aliases to make sure each alias is different including with non latin glyphs titles.

Testing instructions.

This should be tested on a monolanguage site as well as on a multilingual site.

Monolanguage site:
Install the Tamil language pack on a clean installation of staging with no sample data.
ta-IN_joomla_lang_full_3.8.0v1.zip
Switch to Tamil and in the Control panel, install the sample data blog

Reinstall a clean site in the same conditions and check all is OK too with this French pack
fr-FR_joomla_lang_full_3.8.0v1.zip

Multilingual site:
Install a clean staging as multilingual. At time of installation, install both 3.7.5 Tamil and French language packs. Set Multilang to yes with content.

In admin, install the 2 packs above to update Tamil and French to 3.8.0.1
Switch languages in back-end and each time, install sample data for these languages (English too if desired).

Verify that both Oldest Posts modules and Mostly Read Posts are correctly set to use the Blog category in their languages.

Load frontend and switch languages. Check that all is fine.
We will now have a correctly functionning sample data blog.

IMHO this should go into 3.8.0

@imanickam
@Bakual
@mbabker

avatar joomla-cms-bot joomla-cms-bot - change - 11 Sep 2017
Category Front End Plugins
avatar infograf768 infograf768 - open - 11 Sep 2017
avatar infograf768 infograf768 - change - 11 Sep 2017
Status New Pending
avatar infograf768 infograf768 - change - 11 Sep 2017
The description was changed
avatar infograf768 infograf768 - edited - 11 Sep 2017
avatar mbabker
mbabker - comment - 11 Sep 2017

The hardcoding of aliases really seems more like a hack than a practical fix...

avatar Bakual
Bakual - comment - 11 Sep 2017
  • The catid fix (obviously) is fine.
  • The menutype fix looks fine as well. Sanitising is done by the table as well and looks more strict than stringUrlSafe.
  • The alias fix for non-latin however needs something else. As Michael already wrote it is a hack. Imho it also counteracts the separation of text and code. Eg when you want to adjust a title, you would have to adjust the alias in code as well.
    What do you think when we just add the counter to the alias generation? Eg $article['alias'] = JApplicationHelper::stringURLSafe($article['title'] . '-' . $i);. This way in worst case you get the counter as alias but in the other cases you get a nice translated alias, just with a number following.
avatar infograf768 infograf768 - change - 11 Sep 2017
Labels Added: ?
avatar infograf768
infograf768 - comment - 11 Sep 2017

@mbabker @Bakual
concerning the aliases.
We can indeed do that for articles as we have alraedy a counter $i. After all I just placed it first and added sample for now.
Not a big difference with
$article['alias'] = $i . 'sample' . JApplicationHelper::stringURLSafe($article['title']);
I will do the change if it blocks the merge.

For categories, we have no counter and I do not know how to add one. We have only 2 categories.
What do you think?

avatar mbabker
mbabker - comment - 11 Sep 2017

My concern isn't so much the fact we need changes (nobody's perfect), rather at a glance it seems like the way some things are handled seems more like a low level hack to work around an issue than actually fixing an issue (and we have a bad history of taking the low level hacks and not coming back to fix the deeper issue).

avatar infograf768
infograf768 - comment - 11 Sep 2017

The problem is that we have many languages using non-latin glyphs.
Therefore we have to find a solution. Without using the global transliterator (we already discussed about that and found out it is not available for all versions of PHP), there is no other way in this feature to get acceptable aliases.

Will change the alias for articles to @Bakual proposal. Not a big deal.
For categories, I have no way and it is not imho as hacky as it seems.

avatar Bakual
Bakual - comment - 11 Sep 2017

For categories, I have no way and it is not imho as hacky as it seems.

For categories and menuitems we could hardcode a number instead of the counter. Eg take the number that is already in the title language constant.
Thinking about it, we could also move the number suffix outside the stringUrlSafe method (stringURLSafe($article['title']) . '-' . $i). This way worst case would become 2017-09-11-16-25-32-1 instead of just 1.

avatar Bakual
Bakual - comment - 11 Sep 2017

seems more like a low level hack to work around an issue than actually fixing an issue

If we wanted to fix this in the stringUrlSafe method, we could add miliseconds to its fallback string generation. That could work as I doubt we add multiple articles in the same milisecond ?

avatar Bakual
Bakual - comment - 11 Sep 2017

Forget those comments about the datetime stuff. I somehow wrongly assumed that is generated by the stringUrlSafe method. But it's done by the table. We could of course also add something like that.
(https://github.com/joomla/joomla-cms/blob/staging/libraries/src/Table/Content.php#L199-L204)

avatar infograf768
infograf768 - comment - 11 Sep 2017

would not hardcoding a number be similar to hardcoding the more informative text i used? i mean as 'hacky' ?

avatar AlexRed AlexRed - test_item - 11 Sep 2017 - Tested successfully
avatar AlexRed
AlexRed - comment - 11 Sep 2017

I have tested this item successfully on 88daa64

Patch ok for me


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/17930.

avatar Bakual
Bakual - comment - 11 Sep 2017

would not hardcoding a number be similar to hardcoding the more informative text i used? i mean as 'hacky' ?

It at least separates the text from code and still allows for translated alias. But yeah, it still is a bit of a hack. If we wanted to do a real fix, we would have to change the lines in the tables and return miliseconds instead of just seconds there. That would work. Not sure if it's worth it.

avatar infograf768
infograf768 - comment - 12 Sep 2017

In this last commit, I took off ALL hardcoded stuff and forced using unicodeslugs aliases temporarily when the language is not using latin glyphs (idea from @imanickam ).
This works in multilang as well as monolang with same testing instructions.

below examples in multilang

Results for menu items
screen shot 2017-09-12 at 12 44 31

Result for categories
screen shot 2017-09-12 at 12 46 06

Result for articles
screen shot 2017-09-12 at 12 47 49

Example of url obtained when clicking on an article title link from the blog category
/index.php/ta/வலைப்பதிவு/18-தங்கள்-வலைப்பதிவிற்கு-வரவேற்கிறோம்-ta-in

@mbabker
@Bakual
@imanickam
@AlexRed

Please test again.

avatar imanickam imanickam - test_item - 12 Sep 2017 - Tested successfully
avatar imanickam
imanickam - comment - 12 Sep 2017

I have tested this item successfully on cca4fef

I have tested this/these change/changes successfully in the following three scenarios:

(a) Install of Sample Data using the Sample Data Plugin in English (en-GB) - The back-end language was English - Mono lingual site
(b) Install of Sample Data using the Sample Data Plugin in Tamil (ta-IN) - The back-end language was Tamil - Mono lingual site
(c) Install of Sample Data using the Sample Data Plugin in Tamil (ta-IN) - The back-end language was Tamil - Multilingual site


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/17930.
avatar infograf768
infograf768 - comment - 14 Sep 2017

@Bakual @AlexRed
We need a second tester


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/17930.

avatar AlexRed AlexRed - test_item - 14 Sep 2017 - Tested successfully
avatar AlexRed
AlexRed - comment - 14 Sep 2017

I have tested this item successfully on cca4fef

Patch ok for me


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/17930.

avatar franz-wohlkoenig franz-wohlkoenig - change - 14 Sep 2017
Status Pending Ready to Commit
avatar franz-wohlkoenig
franz-wohlkoenig - comment - 14 Sep 2017

RTC after two successful tests.

avatar infograf768 infograf768 - change - 14 Sep 2017
Labels Added: ?
avatar infograf768
infograf768 - comment - 14 Sep 2017

OK now?

avatar mbabker mbabker - close - 16 Sep 2017
avatar mbabker mbabker - merge - 16 Sep 2017
avatar mbabker mbabker - change - 16 Sep 2017
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-09-16 02:45:31
Closed_By mbabker

Add a Comment

Login with GitHub to post a comment