PEAR::Translation2 considered bad.

 |

flawed concepts

Suche

Archive

Februar 2012
Januar 2012
Dezember 2011
Das Neueste ...
Älteres ...

Kommentare

ixs zu Security Advice Is Wrong
Mo, 05.04.2010 11:17
Naja... Irgendwie bin ich n icht überrascht dass Microsoft Research rausbekommt dass IT- Sicherheit eigentlich to [...]


florian zu Die Interessantheit von Trackbacks
Mo, 29.03.2010 22:47
Eigentlich nicht. Ausser dass die ganzen me-too-Trackbacks inzwischen auf Twitter stattfi nden (ausser hier). Da [...]


Onlineproxy zu Die Interessantheit von Trackbacks
Mo, 29.03.2010 09:06
hat sich deine meinung zu trac kbacks geändert in letzter zei t?


florian zu Hallo 2009, tschüss Blog
Mi, 21.01.2009 22:33
Aber es hätte auch sein Gutes: Eine Plattform weniger für e klige Linkspammer.


Jan zu Hallo 2009, tschüss Blog
Mi, 21.01.2009 15:39
Ja manchmal hat man im Leben e infach so viele Sachen, denen man sich widmen möchte oder au ch muss, dass da gewisse [...]


Dirk zu Call A Bike
Mo, 10.11.2008 14:17
Ich leihe mir ungern eine Fahr rad fahre lieber nur mein eige nes. Hatte mal ein negatives E rlebenis mit einen Leihr [...]


Azundris zu
Fr, 25.07.2008 01:50
Schaust Du Wikipedia. «The first version of SQL was devel oped at IBM by Donald D. Chamb erlin and Raymond F. Boy [...]


Tags

acl05 auto bahn blogs cl clustering fun gemaule hardware java klassik krol linguistics metal musik ner new york city niagaracmt oboe php reisen remember twilight saxophon search semantics server sjbo solaris sun t1 uima

Kategorien

  • XML computing
  • XML english
  • XML german
  • XML life
  • XML meta
  • XML misc
  • XML music
  • XML studies


Alle Kategorien

Blog abonnieren

XML RSS 0.91 feed
XML RSS 1.0 feed
XML RSS 2.0 feed
ATOM/XML ATOM 0.3 feed
ATOM/XML ATOM 1.0 feed
XML RSS 2.0 Kommentare

Verwaltung des Blogs

Login

Powered by

Serendipity PHP Weblog

Donnerstag, 22. Februar 2007

PEAR::Translation2 considered bad.

Geschrieben von florian in computing, english um 23:53
The application I'm working on is of course supposed to be localized to all kinds of languages (european ones first, but with a certain sinophile coworker, anything is possible). So, I was looking at internationalization/localization support for PHP, and arrived at two contenders:

  • the gettext PHP extension (Tutorial)

  • PEAR::Translation2

The basic idea of both is to create string tables, where you can look up a keyword/word/phrase and get the translation for the selected language.

First, there's gettext:

  • It is proven technology as the traditional UNIX i18n/l10n tool.

  • It is bundled with stock PHP, though you have to enable it.

  • It is fast

  • It has sweet syntactic sugar: _()

  • It has the nice plural support feature of ngettext()

  • There are tools to extract strings from the PHP files and put them into the string table

  • There is a Smarty Plugin that makes localizing Smarty templates easier, too.



So, thats all great. But I guess, it isn't OO-fashionable, so someone had to go and reinvent the wheel classfully, and badly at that: PEAR::Translation2.

  • No syntactic sugar, no tools.

  • According to the (sucky) documentation, the recommended way of storing translations is in a database. Hello? Does anybody really think it is a good idea to hit the database some 100 times per page to fetch each and every translation from the database? Especially as translation string tables are static data.

  • Ok, maybe the authors also think that fetching each string individually isn't so clever. So there is getPage() to fetch the whole translation table. Theoretically, you can fetch groups of strings by pages, but this is useless if you don't want duplicate translations for strings you use on multiple pages. That brings us to...

  • the database schema design.
    You can choose between:
    One translation table, with one column for each language.
    Or: A separate translation table for each language.
    Please. If you have to reinvent the wheel, can't you do it with a good book about relational databases at your side?
    Oh, and the expected data types of the columns aren't documented, but you can set their names to your heart's contents, if that consoles you.

  • There is a gettext backend too, but I have no idea why they use File::Gettext instead of the gettext extension. The configuration is dreadful, too.



Summary: Translation2: Lots of unnecessary complexity combined with ugly backends for less features. (Only the Decorators might be nice.) Give me gettext!
Kommentare (0) | Trackbacks (0)
Tags für diesen Artikel: php
Artikel mit ähnlichen Themen:
Magpie: RSS-Parser für PHP
DTrace für PHP
Tags für diesen Artikel: php
Artikel mit ähnlichen Themen:
Magpie: RSS-Parser für PHP
DTrace für PHP

Trackbacks
Trackback für spezifische URI dieses Eintrags

Keine Trackbacks

Kommentare
Ansicht der Kommentare: (Linear | Verschachtelt)

Noch keine Kommentare

Kommentar schreiben

Umschließende Sterne heben ein Wort hervor (*wort*), per _wort_ kann ein Wort unterstrichen werden.
Standard-Text Smilies wie :-) und ;-) werden zu Bildern konvertiert.

Um maschinelle und automatische Übertragung von Spamkommentaren zu verhindern, bitte die Zeichenfolge im dargestellten Bild in der Eingabemaske eintragen. Nur wenn die Zeichenfolge richtig eingegeben wurde, kann der Kommentar angenommen werden. Bitte beachten Sie, dass Ihr Browser Cookies unterstützen muss um dieses Verfahren anzuwenden.
CAPTCHA

 
 
 
Powered by Serendipity | Template by Perun