User tests: Successful: Unsuccessful:
It same as #11671 but for Joomla.JText
, with 'lazy' loading for the strings.
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
@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.
Category | ⇒ | JavaScript Libraries |
Status | New | ⇒ | Pending |
@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
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)
@andrepereiradasilva it seems good, thanks for idea, I have updated the pull request
I have tested this item
Works as described. Also tested js error messages in SendTestMail.
Teste in Chrome, IE11, and IE10 Emulation Mode, IE9 Emulation Mode, IE8 Emulation Mode
@brianteeman it means all works as expected
only question, you have placed alert()
inside jQuery().ready()
or on top of the file?
not sure where I put it now - i think it was before line 224 - but there is no Query().ready() in that file
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
Labels |
Added:
?
|
Category | JavaScript Libraries | ⇒ | Libraries JavaScript Unit Tests |
I have tested this item
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
RTC. Thanks
Labels |
Added:
?
|
@committer please double check that #11671 is merged before
if current pull is success then that pull is success also, because all important commits from that pull also is here
Milestone |
Added: Removed: |
||
Labels |
@andrepereiradasilva because it was merged to 3.7
and the pull against staging
@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);
oh, wait, seems need to change self::
to static::
I will update it soon
Status | Ready to Commit | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-09-04 12:44:59 |
Closed_By | ⇒ | wilsonge |
Labels |
Removed:
?
|
@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