Re: new spin on translation package

From: Date: Wed, 20 Oct 2004 15:36:33 +0000
Subject: Re: new spin on translation package
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-34005@lists.php.net to get a copy of this message
Andrew Nagy wrote:
Basically the premise is the package will generate a php include file for each language. Inside the include file is a large associative array with the key as the original language phrase and the value as the translated phrase value. You can load in a file or a bunch of files which will store the array of translated text into the global variable scope. I would assume that this is faster than parsing a gettext file since their is no parsing needed to be done.
Hi Andrew, I do see value in it as I use a pretty similar solution in my projects. What I do for the admin interface is this: I store the phrases for which no key can be found in the language array within the database. So for the admin interface I simply have to read all phrases from the DB where there's no translation yet, add the translation, and regenerate the array definition files. This has one gotcha though: In a large application, there can be a real lot of phrases - so the array can eat up quite a lot of memory. As my applications usually are built from several smaller "sub-applications" (or "modules", as I call them), I have divided the translation files as well - one file for each module. This can produce some duplicate entries across the files, but I can easily live with that. CU Markus

« previous php.pear.dev (#34005) next »