string in templates

string in templates, a forum discussion on Jojo CMS. Join us for more discussions on string in templates on our Plugin Support forum.

Back to Forum Index : Back to Plugin Support   RSS
Rick Rick

9 Feb 2014
Posts: 336

I've never paid attention to it before but now I need to change a few strings. I've always assumed the double hashes around text in the templates was for translation, but I can't find where it's done. Can someone help me out?

I'm talking about this
based on current delivery address


Edit: I had hashes in the topic title, but they were removed. Added an example.
Rick Rick

9 Feb 2014
Posts: 336

I think I found it... I had been looking on the Jojo class, but it's in includes/jojo.php

Just before the content is output to the browser, the following two lines are run
$html = Jojo::applyFilter('output', $html);
$html = str_replace('#'.'#', '', $html);

So I'm assuming that I use the "output" contentFilter to replace any text before the remaining hashes are stripped. That's simple enough, or did I miss somewhere where this functionality is already built in?

Edit: There's supposed to be two hashes in the first quotes in the str_replace. But they get removed by that very filter so I updated it so the code works the same and is readable but is not what is actually used.
tom

Developer

tom

10 Mar 2014
Posts: 379

The output filter removes any double hashing that hasn't been dealt with, which generally it hasn't, because the actual swapping out of hashed content for translation is done by the jojo_translate plugin.

As well as providing a straightforward way of changing out terms like 'Search site' and so on that would otherwise require a template override (and a tedious one at that if you have multiple languages to deal with), it provides a way to override any number of bits of text lurking in templates, even in the default language.

It generates a table of every double-hashed bit of text it finds in any template and allows you to assign alternates for any of the currently active languages on the site.

It's not a core plugin because.. I always hoped we'd come up with a proper translation engine. But we haven't.
Back to Forum Index : Back to Plugin Support   RSS
You must be logged in to post a reply



You need to Register or Log In before posting on these forums.