Skip to content

Commit

Permalink
No longer need to do anything in FText::_(), which used to guard agai…
Browse files Browse the repository at this point in the history
…nst JText::_() breaking strings with commas. JText has since been fixed, and in fact will now correctly interpret whether a given string is actually an sprintf() style. So calling JText::_("SOME_SPRINTF_TAG,foo,bar"} will work the same as JText::sprintf("SOME_SPRINT_TAG", 'foo', 'bar'). So wherever you can specify translatable strings in the Fabrik backend, you can specify them as sprintf style, like (say) "MY_WELCOME_MESSAGE,{table___salutation},{table___name}" as the "thanks message" in a redirect plugin. So FText::_() is basically now an unused wrapper for JText::(), in case we ever want to do any Funky Fabrik Stuff to translatable strings in the future.
  • Loading branch information
cheesegrits committed Oct 29, 2017
1 parent afd2a87 commit 15638dd
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions libraries/fabrik/fabrik/Helpers/Text.php
Expand Up @@ -44,25 +44,10 @@ class Text extends \JText
public static function _($string, $jsSafe = false, $interpretBackSlashes = true, $script = false)
{
/**
* In JText::_(), it does the following tests to see if everything following a comma is all upp
* case, and if it is, it does Funky Stuff to it. We ned to avoid that behavior. So us this
* logic, and if it's true, return the string untouched. We could just check for a comma and not
* process anything with commas (unlikely to be a translatable phrase), but unless this test adds
* too much overhead, might as well do the whole J! test sequence.
* This function is now kind of redundant, as it uses to guard against some behavior of JText_() which no
* longer happens (as of 3.7). But we'll keep it around as a wrapper in case we ever need to Do Fabrikm Stuff
* to translatable strings.
*/
if (!(strpos($string, ',') === false))
{
$test = substr($string, strpos($string, ','));
if (strtoupper($test) === $test)
{
/**
* This is where JText::_() would do Funky Stuff, chopping off everything after
* the first comma. So we'll just return the input string untouched.
*/
return $string;
}
}
// if we got this far, hand it to JText::_() as normal
return parent::_($string, $jsSafe, $interpretBackSlashes, $script);
}
}

0 comments on commit 15638dd

Please sign in to comment.