• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
View code that hurts your brain

#9
[eluser]Randy Casburn[/eluser]
[quote author="xwero" date="1219462931"]Randy creating language dependent views that contains a certain amount of text are easier to maintain and modify than placing language dependent strings everywhere in the views. [/quote]

So I think you're saying you do a view per language.

[quote author="xwero" date="1219462931"]From experience i learned people who want multilanguage sites are quicker to translate words/phrases in context than out of context even if they have to write the same things more than once because of it. [/quote]

Yes, this makes sense, although it isn't the convention...

Here are several examples of other locationalization implementations (both PHP and JavaScript) that store strings in arrays or JS objects and either use them directly as in my silly example above, or use a more fomalized OOP approach to use a function call of some sort in a template replacement scheme. It's actually quite a common method. I didn't include the Zend Framework's i18n implementation because it is so very, very formal, but it does the "strings in an object/array" replaced in a template thing. I couldn't imagine creating a new, duplicated view for every language my site would have to support. I know that can't be what you mean.

http://book.cakephp.org/view/161/localiz...nalization
http://trac.seagullproject.org/wiki/Howt...nalisation
http://extjs.com/learn/Tutorial:Localizing_Ext
http://www.etomite.com/forums/index.php?...showcat=15
http://plugins.jquery.com/project/gettext
http://recurser.com/articles/2008/02/21/...on-plugin/

I'm still with you on the whole string thing. But I put my translations in strings, in arrays, in objects, and filter, and gettext() my way with the replacements. And hope the translators can see the context in the original template. Knowing that what you say above makes sense...of course.
=========
Quote://This calls echo ONE time, but with many arguments...
echo $firstname, ' ', $lastname;
Um, OK, but...

Just for fun I looked up the PHP source. ECHO is a C macro (ZEND_ECHO_SPEC_CV_HANDLER) declared in zend_vm_execute.h in the Zend directory of the PHP source.

The echo C MACRO is iterated for each comma separated value provided to it and sends that to zend_print_variable(). So this function is executed n times with 'n' being the number of strings passed in the comma separated list...So I guess it depends on what the definition of what ONE is.
========
Sorry for the divergence xwero here...

Randy


Messages In This Thread
View code that hurts your brain - by El Forum - 08-22-2008, 03:32 AM
View code that hurts your brain - by El Forum - 08-22-2008, 08:22 AM
View code that hurts your brain - by El Forum - 08-22-2008, 09:42 AM
View code that hurts your brain - by El Forum - 08-22-2008, 10:45 AM
View code that hurts your brain - by El Forum - 08-22-2008, 12:37 PM
View code that hurts your brain - by El Forum - 08-22-2008, 02:28 PM
View code that hurts your brain - by El Forum - 08-22-2008, 04:10 PM
View code that hurts your brain - by El Forum - 08-22-2008, 04:42 PM
View code that hurts your brain - by El Forum - 08-22-2008, 06:42 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.