? ? Success

User tests: Successful: Unsuccessful:

avatar Fedik
Fedik
20 Aug 2016

It same as #11671 but for Joomla.JText, with 'lazy' loading for the strings.

Testing Instructions

place in template.js of Isis template next test JavaScript:

alert(Joomla.JText._('JTOGGLE_HIDE_SIDEBAR', 'string not found!!!'));

Open the Articles page and you should get alert with translation for 'JTOGGLE_HIDE_SIDEBAR'.

UPD: the pull request depends from #11671,
It still can be tested stand alone, but #11671 should be merged first

avatar Fedik Fedik - open - 20 Aug 2016
avatar yvesh
yvesh - comment - 20 Aug 2016

@Fedik when you extend / edit core.js etc. it would be great, if you could also adjust the JavaScript tests we have for it (and add new ones). Thank you! :-)

See the documentation for more details

avatar Fedik
Fedik - comment - 20 Aug 2016

@yvesh thanks for the link, I need to try

avatar andrepereiradasilva
andrepereiradasilva - comment - 20 Aug 2016

@Fedik an idea, not sure if i'm thinking this right: can't JText::script() proxy to JDocument::addScriptOptions?

adding for instance:

$doc->addScriptOptions('joomla.text', $textVarsArray);

The Joomla.JText would get the text strings from the script options.

It seans like we have some duplicated code betwen JText and ScriptOptions as it is.

avatar brianteeman brianteeman - change - 20 Aug 2016
Category JavaScript Libraries
avatar brianteeman brianteeman - change - 20 Aug 2016
Status New Pending
avatar Fedik
Fedik - comment - 21 Aug 2016

@andrepereiradasilva I think it is a good idea, I will try to make it in this way,
maybe use joomla.language? but joomla.text also sounds good

I not sure about proxy, but we can add it before scriptOptions rendering

avatar andrepereiradasilva
andrepereiradasilva - comment - 21 Aug 2016

what i mean by proxying is replacing this line (https://github.com/joomla/joomla-cms/blob/staging/libraries/joomla/language/text.php#L386) by

$string= array(strtoupper($string) => JFactory::getLanguage()->_($string, $jsSafe, $interpretBackSlashes));
JFactory::getDocument()->addScriptOptions('joomla.text', $string);

(but, not sure if it's B/C)

avatar Fedik
Fedik - comment - 21 Aug 2016

@andrepereiradasilva it seems good, thanks for idea, I have updated the pull request

avatar Fedik
Fedik - comment - 21 Aug 2016

And now the pull request depends from #11671,
It still can be tested stand alone, but #11671 should be merged first

avatar andrepereiradasilva andrepereiradasilva - test_item - 21 Aug 2016 - Tested successfully
avatar andrepereiradasilva
andrepereiradasilva - comment - 21 Aug 2016

I have tested this item successfully on b83b6bd

Works as described. Also tested js error messages in SendTestMail.
Teste in Chrome, IE11, and IE10 Emulation Mode, IE9 Emulation Mode, IE8 Emulation Mode


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

avatar brianteeman
brianteeman - comment - 26 Aug 2016

Not sure I understand the test instructions as both before and after the PR I get the same

ttrp 1

avatar Fedik
Fedik - comment - 26 Aug 2016

@brianteeman it means all works as expected 😉

only question, you have placed alert() inside jQuery().ready() or on top of the file?

avatar brianteeman
brianteeman - comment - 26 Aug 2016

not sure where I put it now - i think it was before line 224 - but there is no Query().ready() in that file

avatar Fedik
Fedik - comment - 26 Aug 2016

if you try to place it on top of the file, then before the patch you should get: JavaScript error or string not found!!!

It not a bug, just to spot the difference

avatar Fedik Fedik - change - 26 Aug 2016
The description was changed
avatar Fedik Fedik - edited - 26 Aug 2016
avatar joomla-cms-bot joomla-cms-bot - change - 26 Aug 2016
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - change - 26 Aug 2016
Category JavaScript Libraries Libraries JavaScript Unit Tests
avatar brianteeman brianteeman - test_item - 26 Aug 2016 - Tested successfully
avatar brianteeman
brianteeman - comment - 26 Aug 2016

I have tested this item successfully on d305e26


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

avatar ggppdk ggppdk - test_item - 26 Aug 2016 - Tested successfully
avatar ggppdk
ggppdk - comment - 26 Aug 2016

I have tested this item successfully on d305e26


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

avatar zero-24 zero-24 - change - 26 Aug 2016
Status Pending Ready to Commit
avatar zero-24
zero-24 - comment - 26 Aug 2016

RTC. Thanks


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

avatar joomla-cms-bot joomla-cms-bot - change - 26 Aug 2016
Labels Added: ?
avatar zero-24
zero-24 - comment - 26 Aug 2016

@committer please double check that #11671 is merged before

avatar brianteeman
brianteeman - comment - 26 Aug 2016

@zero-24 you'd better go and test #11671 then ;)

avatar Fedik
Fedik - comment - 26 Aug 2016

if current pull is success then that pull is success also, because all important commits from that pull also is here :neckbeard:

avatar zero-24
zero-24 - comment - 26 Aug 2016

I just want to make sure that this one don't get missed:

the pull request depends from #11671,
It still can be tested stand alone, but #11671 should be merged first

avatar wilsonge wilsonge - change - 3 Sep 2016
Milestone Added:
Removed:
Labels
avatar andrepereiradasilva
andrepereiradasilva - comment - 3 Sep 2016

@Fedik you should look if 45164a4 recent merge on 3.7.x branch does not have impact here.

avatar Fedik
Fedik - comment - 3 Sep 2016

@andrepereiradasilva because it was merged to 3.7 and the pull against staging 😉

avatar Fedik
Fedik - comment - 3 Sep 2016

@andrepereiradasilva sorry I wrong understood you,
no it do not have imact here, only thing I added there is https://github.com/Fedik/joomla-cms/blob/d305e2682e96c0f9f5a4c303980e54472efd3fd8/libraries/joomla/language/text.php#L392
JFactory::getDocument()->addScriptOptions('joomla.jtext', self::$strings, false);

avatar Fedik
Fedik - comment - 3 Sep 2016

oh, wait, seems need to change self:: to static::
I will update it soon

avatar wilsonge
wilsonge - comment - 4 Sep 2016

Merged with 5e54494 :) Thanks and also thanks for the docs!

avatar wilsonge wilsonge - change - 4 Sep 2016
Status Ready to Commit Closed
Closed_Date 0000-00-00 00:00:00 2016-09-04 12:44:59
Closed_By wilsonge
avatar wilsonge wilsonge - change - 4 Sep 2016
Labels Removed: ?

Add a Comment

Login with GitHub to post a comment