I guess it depends if you have any shared images that might be generic and used with all languages.
If you want to override the helper, you can do it by creating an AppHelper class in app/app_helper.php Although this does change your functionality and you would have to duplicate any shared images between all languages. I would probably go the more explicit route, and just append the language to the image path ($lang = 'en/'). $html->image($lang.'btn_action.gif'); Cheers, Adam ----- Original Message ----- From: "daedalus" <[email protected]> To: "CakePHP" <[email protected]> Sent: Monday, June 15, 2009 6:24 AM Subject: Modifying Html Helper Image method for localization support > > Hello, > > I'm fairly new to CakePHP and have a question about the best way to > accomplish a task. Here is my situation: I'm building a little > localized app that incorporates a dozen or so images that will need to > be localized - for example navigation buttons. The most logical way > to organize these images, it seems to me, is to put the images for > each language into a folder bearing the language abbreviation in the > "img" directory. So, for instance, English images would be in "img/ > eng/". > > The app is working nicely now with Html helper image calls such as > $html->image('btn_action.gif'). The language variable is written to > the Config class in a beforeFilter of the (only) controller. Ideally, > I guess, I need to modify or extend the Html helper to automatically > add the correct language directory into the image path, but as much as > I've looked around for examples I'm still a bit hazy on how to best > accomplish this. Can I overwrite the "image" method of the Html > helper by including an appropriate class in /app/helpers? Am I going > about this in the right way to begin with? I'm not so much interested > in what merely works, but with what is most elegant, logical, and > maintainable. > > Thanks a lot, > > AH > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
