Blog ≫ 2009 ≫ Trying to avoid thinking about work for a whole hour

FAIL

I can't seem to do it, have et 1 my tin of spaghetti bolognese (nice one Sainsbury's for stocking a vegan friendly version of this convenient lunch again, it's been a while) and have things going round in my mind. BUT trying to take a proper break so as to keep me fresh for the afternoon. If I blog about what I'm thinking about at work do you think that will keep me fresh enough? Here's what's troubling me anyway, I want a smarty plugin that is REALLY REALLY REALLY simple so it can be called like

{translate 'hello'}

I've already got the back end actually doing the translation so that's fine, and I know I can do

{translate word='hello'}

but I want something even simpler. For a while I tried a modifier instead of a function like

{'hello'|translate}

But I want something more. A modifier like that doesn't have access to the $smarty object for one thing, so I can't see (for example) if other things have been assigned on the page without a whole lot of globalising...

Maybe @theHuzz 2 has solved this 3 while I've been writing this, as I twittered it too hoping someone would:

@pauly what about a block function then you could use {translate}hello{/translate} ?

It's a bit longer, and is slightly more complex for my target audience to use but it might do the job. In fact the example here 4 5 is, um, a translation function.

I will carry on thinking about this after lunch.

Should have spent that time working on making my venue urls look like this as an seo experiment...

  1. Ha, reading this back in 2026 and it annoys the boy that I say "et" instead of "ate" or "have eaten" good to know I was always doing it.
  2. Removed old twitter.com/ theHuzz link here.
  3. Removed old twitter.com/ theHuzz/ status/ 5649223087 link here.
  4. Removed old smarty.net/ manual/ en/ plugins.block.functions.php link here.
  5. smarty block function

⬅️ :: ➡️

Paulʼs blog - I live some place you've not heard of in the far South. Wednesday + father to two, I'm a full stack web developr, + I do js / node, some ruby, other languages ect ect. I like pubs, running, restaurants, home-automation and other diy jiggery-pokery, history, family tree stuff, television, squirrels, pirates ☠️, lego, and TIME TRAVEL.