|
Posted by Wolfram Schlich on 10/01/31 11:23
Hi,
I'm in the process of creating a PHP+Smarty+MySQL based webapp.
The frontend should be multilingual and as I've never used Smarty
before, I have searched for more information on that topic.
Here's what I found so far:
- Smarty Wiki (http://smarty.incutio.com/): Internationalization
- IntSmarty (http://www.coggeshall.org/oss/intsmarty/)
- A thread in the Smarty Forum
(http://www.phpinsider.com/smarty-forum/viewtopic.php?t=84):
best way to build a multi-language site with smarty
So, having read most of that, I am somewhat unsure what would be the
"best" solution (in my case).
Most resp. all of the above mentioned solutions use flat files for
their message catalogs (some use gettext .mo files, some XML and
some INI files). As my webapp itself is completely database driven
(only some configuration settings are in flat files), I thought it
would be the best idea to store the message catalogs inside the
database as well, in regard to maintainability etc.
What are the pro and contras to database and flat file storage in
case of message catalogs?
My thoughts so far:
- pro-db:
- easier maintainability
- contra-db:
- in case of an unavailable database, all the error messages
would only be available in the original language (english
for example), which would be very unsatisfying for the
corresponding user when he/she is no native english speaker
- pro-gettext:
- message strings inside the sources are more descriptive
- message strings are only translated once
- variable placeholders can be included in the message string
- contra-gettext:
- several steps are required to create and update translations
- create:
xgettext -n myscript.php # -> messages.po
# <translate messages.po>
msgfmt messages.po # -> messages.mo
- update:
mv messages.po old.po
xgettext -n myscript.php # -> messages.po
# <translate messages.po>
msgmerge old.po messages.po --output-file=new.po
msgfmt new.po # -> new.mo
mv new.mo messages.mo
Is there a ready solution using database storage for its message
catalogs?
Would it be a good idea to try to combine gettext with database
storage for the .po-files' contents?
Would you recommend solutions which use a marker inside the sources
to mark strings for translation, leaving the original strings inside
the sources, like gettext does ('t("no messages")'), or prefer a
solution which only refers to abstract hierarchical IDs inside the
sources, for example like 't("msg.list.nomsgs")'?
Thanks in advance.
--
Wolfram Schlich
Navigation:
[Reply to this message]
|