Escaped apostrophes in language constants

A place to discuss Joomla! translation matters.

Moderator: wendhausen

Post Reply
User avatar
dyfrig
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 128
Joined: Thu Nov 20, 2008 9:07 pm
Location: Cymru/Wales

Escaped apostrophes in language constants

Post by dyfrig » Fri Feb 11, 2022 5:17 pm

I have noticed recently that a lot of the newer source language strings in J4 have apostrophes represented by escaped characters to avoid confusion with single quotes. Welsh does not use this symbol for possession as in English but does make very extensive use of it to represent missing letters in contractions (cf "their's" for "there is" in English) so it would be laborious to enter the escape character for all such cases. It wasn't done until recently. I'm wondering whether it's really necessary?
Last edited by toivo on Fri Feb 11, 2022 10:15 pm, edited 1 time in total.
Reason: mod note: retitled on request

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19130
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Escaped Apostrophes

Post by infograf768 » Fri Feb 11, 2022 6:12 pm

Yes, double quotes have to be escaped. Otherwise the whole ini file will not load.
Jean-Marie Simonet / infograf · http://www.info-graf.fr
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

User avatar
dyfrig
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 128
Joined: Thu Nov 20, 2008 9:07 pm
Location: Cymru/Wales

Re: Escaped Apostrophes

Post by dyfrig » Fri Feb 11, 2022 6:59 pm

Thanks JM but I was asking about single quotes. They weren't usually escaped but now seem to be in the newest files for 4.1.

User avatar
sozzled
Joomla! Master
Joomla! Master
Posts: 12208
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: Escaped Apostrophes in language constants

Post by sozzled » Fri Feb 11, 2022 8:28 pm

dyfrig wrote:
Fri Feb 11, 2022 6:59 pm
Thanks JM but I was asking about single quotes. They weren't usually escaped but now seem to be in the newest files for 4.1.
Single quotes don't need to be escaped in J!.

example:

Code: Select all

COM_CONFIG_TEXT_FILTERS_NOTE="WARNING: You have configured a parent group with the setting 'No Filtering' - this setting can't be overridden in child groups and any other configured filter will not be applied."
This is straight out of the J! 4.0.6 language file ../administrator/language/en-GB/config.ini (at line 230).

I don't know anything about a change to the syntax for J! 4.1. You may want to ask the developers (at GitHub) if they've changed the syntax? I can't find any case reported to the developers that relates to your question, sorry.
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?”
Walking the talk: https://j4xdemo.enduring.com.au
:)

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 41701
Joined: Sat Apr 05, 2008 9:58 pm

Re: Escaped apostrophes in language constants

Post by Webdongle » Fri Feb 11, 2022 10:48 pm

dyfrig wrote:
Fri Feb 11, 2022 5:17 pm
... (cf "their's" for "there is" in English) ...
Theirs = belonging to them
There's = there is

https://docs.joomla.org/Creating_a_lang ... ition_file (last updated march last year)
The value should always be surrounded by double-quote characters ("), as in the example. The value itself cannot include double-quote characters, although single-quote characters (') are valid. Use \, including the double quotes, to place a double-quote character in your value. For example, to attach the value <span class="red">Warning!</span> to the key WARNING_TEXT, use following line
WARNING_TEXT="<span class=\"red\">Warning!</span>"
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

User avatar
sozzled
Joomla! Master
Joomla! Master
Posts: 12208
Joined: Sun Jul 05, 2009 3:30 am
Location: Canberra, Australia

Re: Escaped apostrophes in language constants

Post by sozzled » Sat Feb 12, 2022 3:30 am

Webdongle wrote:
Fri Feb 11, 2022 10:48 pm
https://docs.joomla.org/Creating_a_lang ... ition_file (last updated march last year)
The value should always be surrounded by double-quote characters ("), as in the example. The value itself cannot include double-quote characters, although single-quote characters (') are valid.
That is my understanding, too. Single-quotes (or apostrophes) do not need to be escaped. As I wrote before, if the rules have changed with J! 4.1 then I haven't read about this anywhere.
“If you think I’m wrong then say, ‘I think you’re wrong.’ If you say ‘You’re wrong!’, how do you know?”
Walking the talk: https://j4xdemo.enduring.com.au
:)

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19130
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Escaped apostrophes in language constants

Post by infograf768 » Sat Feb 12, 2022 9:03 am

Apostrophes (also called curly apostrophes i.e. &rsquo; or &#8217;) as well as single quotes ' don't need to be escaped, J4 or not.

And I do not understand why this string contains escaped single quotes: imho it is a mistake and should be corrected...

administrator/language/en-GB/plg_system_jooa11y.ini:83:
PLG_SYSTEM_JOOA11Y_LINK_URL="Longer, less intelligible URLs used as link text might be difficult to listen to with assistive technology. In most cases, it is better to use human-readable text instead of the URL. Short URLs (such as a site\'s homepage) are okay."
Jean-Marie Simonet / infograf · http://www.info-graf.fr
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

User avatar
dyfrig
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 128
Joined: Thu Nov 20, 2008 9:07 pm
Location: Cymru/Wales

Re: Escaped apostrophes in language constants

Post by dyfrig » Sat Feb 12, 2022 12:12 pm

Thanks everybody. You have confirmed what I thought i.e. that escaping the single quotes wasn't neccessary. I'll stick to the non-escaped characters in my translations.

For what it's worth I've done a search through the source files and found 3 examples - the one JM quoted (line 83)and also lines 63 and 91. It's fewer than I had thought.

Line 63: PLG_SYSTEM_JOOA11Y_PANEL_STATUS_12="The item you are trying to view is not visible; it may be hidden or inside of an accordion or tab component. Here\'s a preview="

Line 91: PLG_SYSTEM_JOOA11Y_NEW_TAB_WARNING="Link opens in a new tab or window without warning. Doing so can be disorienting, especially for people who have difficulty perceiving visual content. Secondly, it is not always a good practice to control someone\'s experience or make decisions for them. Indicate that the link opens in a new window within the link text."

User avatar
infograf768
Joomla! Master
Joomla! Master
Posts: 19130
Joined: Fri Aug 12, 2005 3:47 pm
Location: **Translation Matters**

Re: Escaped apostrophes in language constants

Post by infograf768 » Sat Feb 12, 2022 4:46 pm

I suggest you create an issue about these.
Jean-Marie Simonet / infograf · http://www.info-graf.fr
---------------------------------
ex-Joomla Translation Coordination Team • ex-Joomla! Production Working Group

User avatar
Webdongle
Joomla! Master
Joomla! Master
Posts: 41701
Joined: Sat Apr 05, 2008 9:58 pm

Re: Escaped apostrophes in language constants

Post by Webdongle » Sat Feb 12, 2022 6:34 pm

And post a link to the issue here please.
http://www.weblinksonline.co.uk/
https://www.weblinksonline.co.uk/updating-joomla.html
"When I'm right no one remembers but when I'm wrong no one forgets".

User avatar
dyfrig
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 128
Joined: Thu Nov 20, 2008 9:07 pm
Location: Cymru/Wales

Re: Escaped apostrophes in language constants

Post by dyfrig » Sun Feb 13, 2022 9:07 pm

I had never created an issue on GitHub before but I've had a go. Hope it's OK. https://issues.joomla.org/tracker/joomla-cms/37024


Post Reply

Return to “Translations”