Re: Translation2 ...

From: Date: Wed, 25 Feb 2004 00:05:38 +0000
Subject: Re: Translation2 ...
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-25852@lists.php.net to get a copy of this message
Hi On Tue, 24 Feb 2004 18:50:39 +0100, Nicolas Hoizey wrote: > Hi Lorenzo and all Translation(2) users, > > I try to use Translation2 and I think there are some things that > could be done otherwise or added. some feedback, at last! :-) > I'm using MySQL with the DB container, with one table for each > language. > > 1. String retrival process > -------------------------- > When I set a pageId and try to get a value for a key that is not > defined with that pageId but is defined with a NULL pageId, I think > Translation2 should return that value instead of the general > fallback string. there's a subtle syntax difference here, as explained in the "HANDLE CONFLICTS" section of the example. ============================ //call #1 $tr->get('conflicting')); //pageID defaults to null => get current pageID //call #2 $tr->get('conflicting', '')); //pageID='' => get strings with no pageID (i.e. the one with a "NULL" in the pageID field //call #3 $tr->get('conflicting', 'in_page')); // => force pageID ============================ what you want is #2, I guess... > 2. Language parameters > ---------------------- > It should be possible to use as many fields as needed in the > language list table, not just the "name", "meta" and "error_text" > ones. > The getLang() method could maybe take a field name as its second > parameter so that it is possible to call $tr->getLang('en', > 'my_own_field'); without any configuration needed elsewhere. I've never been satisfied with the getLang() method, there's definitely room for improvements there. Right now, you can serialize your extra fields and put the serialized value in the meta field. A little cumbersome, I agree, but it's just a temporary measure if you really need it *now*... > 3. Fallback languages > --------------------- > It should be possible to use lists of fallback languages instead of > just one, with fallback mechanism in the order of the list. > It should also be possible to set this list in the languages list > table, with a new 'rank' column for example, which let you change > this for all pages without the need to change every call to the > setLangFallback() method. I think that having a fallback language is *really* useful, hence I implemented it. OTOH, having more than one could led to serious performance issues. Anyway, after looking at the beauty of WACT, I'm seriously considering the implementation of filters/decorators. This way you could add as many filters/decorators as you may need, and the decision on the tradeoff between performance and functionality is left to you. Still have to think on how to do it, though... > 4. Automagical prefered language detection nice idea. Will look at it. > Waiting for any comment on these topics, I will continue to dig > into Translation2 features... ;) thanks for your feedback Best regards, Lorenzo

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