I am currently researching the best methods to integrate
i18n into projects.
There's several methods I have thought of doing this, first being a database scheme to store the strings and relevant locale, but the problem with this is that it would not be that easy to select the strings, because i would not like to perform quesries like so:
SELECT text FROM locales WHERE locale = 'en_GB' AND text_id = 245543
SELECT text FROM locales WHERE locale = 'en_GB' AND text_primary = 'hello'
The next method would be to store them within files such as
locales/en_gb/login/strings.php and then try and access them via an class specifically developed like so:
$Language = Registry::Construct('Language',array('en_GB')); echo $Language->login->strings->hello;
The issue with this is I would have to build a system that would update these files via an administration panel witch is very time consuming, not just building the system to manage the strings but actually managing the strings as the site grows
- What other methods are there that will be beneficial for a large system
- Is there any automated way to do 'Translation' as such
- Should I stick with a database method and build a system for users to translate strings with rating / suggest better version ?
- What systems have you tried in the past and should I look into them or totally avoid them.
In addition to
gettextalready mentioned, PHP 5.3 has native Internationalization support
If that's not an option, consider using Zend Framework's
Zend_Localeand related components for that.
Zend_Translatesupports a number of adapters, including but not limited to simple arrays, gettext, XmlTm and others.