Forum Moderators: coopster
Should I force languages to be on their own URL? I'm thinking of using subdomains, ala "example.com" (english), "es.example.com" (spanish), "fr.example.com" (french). That seems like it would be easier than registering country tld's like "example.fr". The solution I'm testing right now merely stores the language in a session.
The most important part would be that (a) your content be in French, and ...
Use top-level domains: To help us serve the most appropriate version of a document, use top-level domains whenever possible to handle country-specific content. We're more likely to know that http://www.example.de contains Germany-focused content, for instance, than http://www.example.com/de or http://de.example.com.
I don't want to sound pedantic
it was such a great lead-in I couldn't resist
I've tried out a couple of prefab packages now. Most are utter crap,
So what is the best way to externalize your strings? I did some initial performance testing and this is what I've come up with so far:source [litfuel.net]
1. INI FILE - store all your strings in a .ini file such as welcomeMsg = "Hi There" which can be parsed with parse_ini_file()
2. Native PHP Arrays - store your strings in a .php file using $msg['welcomeMsg'] = "Hi There"; which can be just included as a native php array
3. XML Format - store your strings as <string code="welcomeMsg">Hi There</string> and parsed using php5's simpleXML
4. SQL LITE - storing your strings in a SQL lite DB per language and having a function wrapper for queries
the winner?
well in a test of 50,000, 10,000 and 1,000 string files #4 SQL LITE was FIVE times as fast as SimpleXML (2nd place) and something like 20 Times faster than parsing INI files.
just want to add that everyone needs to evaluate their particular environment
I am a little surprised at the differences he found between xml and file
Opening a connection to a regular INNOdb SQL database to retrieve phrases, even with a primary key index, would be too slow for a high-load environment or very large lexicon. Perhaps imperceptible under light loads or with a small index, but I can imagine it would get clumsy as it grows.