? ? ? Pending

User tests: Successful: Unsuccessful:

avatar infograf768
infograf768
27 Aug 2020

Summary of Changes

This PR prevents saving a Content Language when its Url Language Code is empty.

Testing Instructions

2 cases when editing or creating a Content Language

  1. If only symbols like % or & are entered in the URL Language Code field

  2. If multibytes characters are entered when Unicode Alias is not set to Yes in Global Configuration.
    Example while admin language is en-GB, the Greek characters αω

Actual result BEFORE applying this Pull Request

The Content Language is saved with an empty Url Language Code

Screen Shot 2020-08-27 at 14 54 51

Expected result AFTER applying this Pull Request

We now get an error message.

Screen Shot 2020-08-27 at 14 57 51

`

Screen Shot 2020-08-27 at 14 58 25

Documentation Changes Required

avatar infograf768 infograf768 - open - 27 Aug 2020
avatar infograf768 infograf768 - change - 27 Aug 2020
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 27 Aug 2020
Category Administration com_languages Language & Strings
avatar infograf768 infograf768 - change - 27 Aug 2020
The description was changed
avatar infograf768 infograf768 - edited - 27 Aug 2020
avatar infograf768 infograf768 - change - 27 Aug 2020
The description was changed
avatar infograf768 infograf768 - edited - 27 Aug 2020
0f53eca 27 Aug 2020 avatar infograf768 typo
avatar infograf768 infograf768 - change - 27 Aug 2020
Labels Added: ? ?
avatar sandewt sandewt - test_item - 27 Aug 2020 - Tested successfully
avatar sandewt
sandewt - comment - 27 Aug 2020

I have tested this item successfully on 0f53eca

Joomla! 3.9.22-dev Development [ Amani ] 26-August-2020 08:12 GMT

For the sake of completeness:
A horizontal dash (-) is accepted too. For example en-gb. The - is not an alphanumeric character.


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

avatar viocassel viocassel - test_item - 27 Aug 2020 - Tested successfully
avatar viocassel
viocassel - comment - 27 Aug 2020

I have tested this item successfully on 0f53eca


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

avatar brianteeman
brianteeman - comment - 27 Aug 2020

Shouldn't this be done as a validation rule in the xml ?

avatar brianteeman
brianteeman - comment - 27 Aug 2020

@sandewt that means that at least part of this pr is incorrect

avatar infograf768
infograf768 - comment - 28 Aug 2020

A horizontal dash (-) is accepted too. For example en-gb. The - is not an alphanumeric character.

Yep. The hyphen is a accepted, but only if used between alphanumeric characters. Any idea for the value of the string to reflect this?

avatar SharkyKZ
SharkyKZ - comment - 28 Aug 2020

Maybe use the same text as for aliases?

avatar infograf768
infograf768 - comment - 28 Aug 2020

As for #30497, I explained there that we can use multibytes characters when Unicode Alias is set to YES in Global Configuration. It does not break anything, this is why this is specifid in the test instructions.

@SharkyKZ Looking now what we have for alias.

avatar infograf768
infograf768 - comment - 28 Aug 2020

Is'nt the alias hint a bit too long and overly complex here?

JFIELD_ALIAS_DESC="The Alias will be used in the SEF URL. Leave this blank and Joomla will fill in a default value from the title. This value will depend on the SEO settings (Global Configuration->Site). <br />Using Unicode will produce UTF-8 aliases. You may also enter manually any UTF-8 character. Spaces and some forbidden characters will be changed to hyphens.<br />When using default transliteration it will produce an alias in lower case and with dashes instead of spaces. You may enter the Alias manually. Use lowercase letters and hyphens (-). No spaces or underscores are allowed. Default value will be a date and time if the title is typed in non-latin letters."

In our case, as we throw the error only when the field remains empty when saved — and Unicode Alias is set to NO —, maybe we could simply use

COM_LANGUAGES_ERROR_SEF="The \"Url Language Code\" can't be saved. Please use only alphanumeric characters and hyphens (-)."

Shall we add that entering an hyphen alone will still trigger the error?

avatar SharkyKZ
SharkyKZ - comment - 28 Aug 2020

I think the part about unicode aliases should be added.

avatar infograf768
infograf768 - comment - 28 Aug 2020

Something like ?
COM_LANGUAGES_ERROR_SEF="The \"Url Language Code\" can't be saved.<br>Please use only alphanumeric characters and hyphens (-). Or, if you want to use UTF8 characters, make sure that \"Unicode Alias\" is set to \"Yes\" in Global Configuration."

Screen Shot 2020-08-28 at 07 51 01

avatar brianteeman
brianteeman - comment - 28 Aug 2020

COM_LANGUAGES_ERROR_SEF="The \"Url Language Code\" can't be saved.<br>Please use only alphanumeric characters and hyphens (-). \"Unicode Alias\" should be set to \"Yes\" in Global Configuration to use UTF8 characters"

avatar sandewt
sandewt - comment - 28 Aug 2020

Quite difficult to understand all of this. I found the following explanation:
https://docs.joomla.org/International_Enhancements_for_Version_1.6#Unicode_URLs

avatar infograf768
infograf768 - comment - 28 Aug 2020

@brianteeman
Good proposal. Modifying now.

78d28e0 28 Aug 2020 avatar infograf768 typos
avatar infograf768
infograf768 - comment - 28 Aug 2020

<br> should be <br />

Not necessary and these are also globally modified in J4 strings.

avatar sandewt
sandewt - comment - 28 Aug 2020

Not necessary and these are also globally modified in J4 strings.

The text in the manual should then be adjusted, see:

https://github.com/joomla/coding-standards/blob/master/manual/html.md#adding-line-breaks

avatar infograf768
infograf768 - comment - 28 Aug 2020

It is confusing indeed.
https://www.tutorialspoint.com/What-is-the-correct-way-of-using-br-br-or-br-in-HTML

In J4 we have
9 occurences of <br />
216 occurences of <br>

avatar sandewt
sandewt - comment - 28 Aug 2020

It is confusing indeed.

Who is authorized to change the manual for J4?

avatar infograf768
infograf768 - comment - 28 Aug 2020

I posted an issue and informed maintainers.

As the string value has changed, this needs new tests.

avatar brianteeman
brianteeman - comment - 28 Aug 2020

In Joomla 3 it should be

In Joomla 4 is should be

This is because joomla 4 is set to be html5 and joomla 3 is not - its an option

avatar infograf768
infograf768 - comment - 28 Aug 2020

Changed again string value (last time).
It is now
COM_LANGUAGES_ERROR_SEF="<br />The \"URL Language Code\" should have only alphanumeric characters and dashes (-).<br />To use UTF-8 characters, \"Unicode Alias\" should be set to \"Yes\" in Global Configuration."

Which gives

Screen Shot 2020-08-28 at 21 21 26

avatar Quy
Quy - comment - 29 Aug 2020

Simplify further?

To use UTF-8 characters, set "Unicode Alias" to "Yes" in Global Configuration.

avatar jiweigert
jiweigert - comment - 29 Aug 2020

Just to be devil's advokate here:
Based on the hint, "de-" / "-de" is a valid language code here?

I know it's not, so there should be in the hint included at least one example of the correct use of the dash like "de-DE".
Just for the "least unexperienced user / editor"...


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

avatar infograf768
infograf768 - comment - 29 Aug 2020

Folks, I really start to be fed up with this PR...

avatar jiweigert
jiweigert - comment - 29 Aug 2020

Sorry that you start to fed up.

In my case, I'm simply not able to access the online help at all on my hosters installation.
That may a configuration error or the hoster simply removed the online help...
Anyway.. having at least one (or two) working examples of what should be filled in there,
is just good behaviour in case of an error... but thats just my opinion.


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

avatar infograf768
infograf768 - comment - 30 Aug 2020

@jiweigert
if you enter -de or de- it will automatically be saved as de and will not trigger an error.

avatar infograf768 infograf768 - change - 30 Aug 2020
Status Pending Ready to Commit
avatar infograf768
infograf768 - comment - 30 Aug 2020

RTC as we can debate many months about a slightly different value.

Thanks for testing


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

avatar HLeithner HLeithner - change - 30 Aug 2020
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2020-08-30 16:39:11
Closed_By HLeithner
Labels Added: ?
avatar HLeithner HLeithner - close - 30 Aug 2020
avatar HLeithner HLeithner - merge - 30 Aug 2020
avatar HLeithner
HLeithner - comment - 30 Aug 2020

I'm happy with it, thanks. But another PR is of course welcome.

Add a Comment

Login with GitHub to post a comment