News for hackers. Stuff that matters.
Re:Hey PHP guys... OOP question by noonespecial on Thursday June 25, 2009 @09:05AM (#673571)
Its about maintainability. Is "learn about our website" the only thing you ever want to echo? Will it always be only in english? Might you want to echo it other places, or use it in different circumstances?

Try to think of instances where you might want to make a change that causes you to have to go and search through the code for a million different echoes spread all over the place. The 'extra code' is insurance against this eventuality.

If its a short little one shot deal, then don't sweat it.

Re:Hey PHP guys... OOP question by sivers on Thursday June 25, 2009 @10:06AM (#673644)
Yes yes yes! I can't emphasize this enough. My biggest regret in 10 years of building cdbaby.com was that when I wanted to make it multi-lingual, 7 years into it, I was screwed! All of the language was spread around so many little print/echo statements in 10,000 different places.

With each one I had thought, "Oh it's just a little one shot deal." But after a few years, guess what you have thousands of?

Do it their way. Get used to it. It may take you a mere 2 seconds longer to type, but will save you minutes/hours/days later on.

It's really wonderful knowing that every single word that appears on your site is all coming from one source file. So if you do want to have it translated to Spanish or Chinese some day, you can just hand that file to a translator and voilá!

Re:Hey PHP guys... OOP question by walesmd on Thursday June 25, 2009 @09:50PM (#674794)
I imagined your biggest regret would be wasting all of that time trying to force the site to work on RoR and then finally relenting and switching back to PHP.

Not a flame, just a serious thought: from what I remember the RoR was worked on for a year or more - did it take longer than that to implement internationalization?

Re:Hey PHP guys... OOP question by berntb on Thursday June 25, 2009 @11:12AM (#673773)
Hmmm... would it really be that hard to automatically do (most of) the extraction of text constants?
Re:Hey PHP guys... OOP question by noodle on Thursday June 25, 2009 @10:29AM (#673683)
this.

another common usage is to standardize error/success/etc messages. you always want one type of error to say the same thing, and a language file is a better place to put things than using a define.

having said that, its all about maximizing efficiency. if you don't think you'll actually save that much time in the future by putting things in the language file, maybe because you'll "never" internationalize, then its probably a process worth skipping for you. you can always just go back and make the changes later. it'll just be harder and take longer to do it later, as opposed to doing it now.