Re: php, ajax and international application
| From: | Robert Cummings | Date: | Tue, 22 Apr 2008 07:28:41 +0000 |
| Subject: | Re: php, ajax and international application | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-273385@lists.php.net to get a copy of this message | ||
On Tue, 2008-04-22 at 07:55 +0200, Alain Roger wrote:
> Hi,
>
> Till now, i'm used to have a php file (for each language) to store all text
> labels for my international application.
> i tried with Ajax to improve it but it seems not so flexible at it promised.
> my purpose was to limit the transfer data and especially to not load too
> much the server with not important calculation as localization of
> application.
>
> therefore, i would like to know what do you do to have an international
> application ?
> 1. do you use JSON : 1 javascript file for each language and for each
> module. Code is not secured and everybody can read it.
Usually you use one "language" JavaScript file for each language. And
the JavaScript code itself is language neutral.
> 2. do you use PHP like i wrote above.
PHP would also use the language file. You could put all your language
stuff in a PHP file and have a script that can convert it to a
JavaScript loadable file. That way your maintenance occurs in one
location, but you can benefit from having the JS pre-created.
> 3. you use another method
>
> I would be glad to here from you the pros and cons of your experiences.
I've not done a lot with JavaScript and multilingualism. At least not in
a way that was overly important. With respect to content, I do use
separate content files. My InterJinn framework when it builds the pages
from the templates will grab template lang/X and fall back on template X
if the language specific version doesn't exist. This is automatic when
multilingual is enabled for a project. Then it's just a case of having
language strings defined for stuff like forms and error messages. here's
a site I recently launched:
http://www.expertpanel.ca
The mapping of links to language specific content is all done at compile
time. The only run-time feature of the site is the random banner image
at the top and any forms. If *I* was to have a need for JavaScript like
you mention, I would build the language files from a PHP master file
automatically when building the site.
Cheers,
Rob.
--
http://www.interjinn.com
Application and Templating Framework for PHP