- Joined
- Jul 26, 2006
- Messages
- 3,626
- Reaction score
- 1,006
So this project of mine involves localization, currently only dutch and english but I'm designing it for more languages in future.
All the localization strings are in a database table with fields "key", "en" and "nl" for the key, english translation and dutch translation respectively. In an include which is included in every page, I have this:
This fills up an array ($CONFIG["LANG"]) for use in the currently opened file.
Now as this script will be executed every time the page is loaded for anyone, is it worth caching the entire localization table so the entire table (with probably a few hundred sentences in the end) doesn't have to be queried from the MySQL database every time but is just somewhere on disk?
All the localization strings are in a database table with fields "key", "en" and "nl" for the key, english translation and dutch translation respectively. In an include which is included in every page, I have this:
PHP:
$CONFIG["LANG"] = array();
$query = $db->query("SELECT * FROM `localization`");
while($result = $query->fetch_assoc()) {
$CONFIG["LANG"][key($result)] = $result[$_SESSION["SELECTED_LANG"]];
}
This fills up an array ($CONFIG["LANG"]) for use in the currently opened file.
Now as this script will be executed every time the page is loaded for anyone, is it worth caching the entire localization table so the entire table (with probably a few hundred sentences in the end) doesn't have to be queried from the MySQL database every time but is just somewhere on disk?

