Use tt() to translate the node type token.

CommentFileSizeAuthor
#4 602668.patch1.05 KBaufumy
activity_transnodetype.patch1.03 KBaufumy

Comments

Scott Reynolds’s picture

Status: Needs review » Needs work

Don't need both of these

if (! module_exists('i18nstrings') && ! function_exists('tt'))

And im pretty sure module_exists() is faster. But that is trivial and not what needs work. Need to confirm that tt() will check_plain(), and

return t('@string', array('@string' => $string), $langcode);
aufumy’s picture

Thank you for the review. I'd like your opinion on a discussion with Kars-T regarding the use of module_exists/function_exists versus a wrapper tt function for each contrib module.

The reason for the redundant function_exists('tt') is for the case that multiple contrib modules need to use tt() and add the same degrade path, so the first contrib module that does not find i18nstrings enabled, will define function tt(). The second contrib module that does not find i18nstrings enabled, will then also try to define function tt() which will result in a fatal error without function_exists()

aufumy’s picture

I was also re-considering about how t() is not supposed to be used for variables, and wondering whether it would be better to just return $string (could be with check_plain() around).

aufumy’s picture

Status: Needs work » Needs review
StatusFileSize
new1.05 KB

Using a wrapper function for tt()

shenzhuxi’s picture

602668.patch confirmed

sirkitree’s picture

Status: Needs review » Closed (won't fix)

closing. 1.x no longer supported.