? Success

User tests: Successful: Unsuccessful:

avatar andrepereiradasilva
andrepereiradasilva
30 Dec 2016

Summary of Changes

As discussed in #13421
This PR changes language overrides save to ini method so we use escaped double quotes (\") instead of "_QQ_".
Also adds a new method to save the language strings to a ini file so it can be easily used when needed.

Testing Instructions

  • Apply patch
  • Create a new language override from Extensions -> Languages -> Overrides for the en-GB admin language with some double quotes on it ("). Save it, load it again and confirm if ok.
  • Confirm it's saved as escaped double quote in /administrator/language/overrides/en-GB.override.ini. Example: A test with <a href=\"https://joomla.org\" target=\"_blank\">Joomla</a>
  • Manually add an override in /administrator/language/overrides/en-GB.override.ini with _QQ_ and escaped quotes. Example:
JLIB_DATABASE_ERROR_DATABASE_UPGRADE_FAILED="A second test with <a href="_QQ_"https://joomla.org"_QQ_" target=\"_blank\">Joomla</a>"
  • Confirm language override works
    Ex: add to template index.php
// Server side message system
$app->enqueueMessage(JText::_('JLIB_DATABASE_ERROR_DATABASE_UPGRADE_FAILED'), 'warning');

// Client side message system (click on the page to show the javascript message)
JText::script('JLIB_DATABASE_ERROR_DATABASE_UPGRADE_FAILED');
$this->addScriptDeclaration("document.addEventListener('click', function () { Joomla.renderMessages({'error': [Joomla.JText._('JLIB_DATABASE_ERROR_DATABASE_UPGRADE_FAILED')]}) });");

Documentation Changes Required

None.

avatar andrepereiradasilva andrepereiradasilva - open - 30 Dec 2016
avatar andrepereiradasilva andrepereiradasilva - change - 30 Dec 2016
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 30 Dec 2016
Category Administration com_languages Libraries
avatar andrepereiradasilva andrepereiradasilva - change - 30 Dec 2016
The description was changed
avatar andrepereiradasilva andrepereiradasilva - edited - 30 Dec 2016
avatar ralain
ralain - comment - 30 Dec 2016

I have tested this item successfully on 56d1bc0

Both "_QQ_" and \" are being translated as expected and quotes in overrides save as \".


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

avatar ralain ralain - test_item - 30 Dec 2016 - Tested successfully
avatar andrepereiradasilva andrepereiradasilva - change - 30 Dec 2016
The description was changed
avatar andrepereiradasilva andrepereiradasilva - edited - 30 Dec 2016
avatar frankmayer
frankmayer - comment - 31 Dec 2016

I have tested this item successfully on 56d1bc0

Code review OK


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

avatar frankmayer frankmayer - test_item - 31 Dec 2016 - Tested successfully
avatar jeckodevelopment jeckodevelopment - change - 31 Dec 2016
Status Pending Ready to Commit
avatar jeckodevelopment
jeckodevelopment - comment - 31 Dec 2016

RTC


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

avatar infograf768
infograf768 - comment - 31 Dec 2016

warning concerning strings that would be used through js. see my comment in the specific pr.
let's make sure that one is fully solved all over core before merging this
#13425

avatar infograf768
infograf768 - comment - 31 Dec 2016

In any case, can you explain the reason for using addcslashes instead of addslashes ?

avatar andrepereiradasilva
andrepereiradasilva - comment - 2 Jan 2017

warning concerning strings that would be used through js. see my comment in the specific pr.

Is not related to this PR.

In any case, can you explain the reason for using addcslashes instead of addslashes ?

because the only thing to escape are the double quotes ("), ie, the ini string delimiters, the rest AFAIK is allowed in the ini file.

avatar infograf768
infograf768 - comment - 4 Jan 2017

@rdeutz
Please merge.
Indeed we have to solve the js strings issue in the 2 existing PRs.

avatar rdeutz rdeutz - change - 4 Jan 2017
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2017-01-04 07:19:38
Closed_By rdeutz
avatar rdeutz rdeutz - close - 4 Jan 2017
avatar rdeutz rdeutz - merge - 4 Jan 2017

Add a Comment

Login with GitHub to post a comment