From 51c64f1d28c466c69dc693be15bce8bfbffeafd1 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Wed, 12 Nov 2008 00:05:47 +0000 Subject: Create a simple benchmark that loads 500 localized messages and performs 500 localizations on them. --- core/controllers/welcome.php | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) (limited to 'core/controllers') diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php index bc06bf07..b9c3ac8e 100644 --- a/core/controllers/welcome.php +++ b/core/controllers/welcome.php @@ -96,6 +96,47 @@ class Welcome_Controller extends Template_Controller { } } + function i18n($action) { + $translation_file = VARPATH . "translation.php"; + + switch($action) { + case "build": + $t = array(); + for ($i = 0; $i < 500; $i++) { + $t["this is message $i of many"] = "localized version of $i"; + } + + $fp = fopen($translation_file, "wb"); + fwrite($fp, "auto_render = false; + } + } + function add_albums_and_photos($count) { srand(time()); $parents = ORM::factory("item")->where("type", "album")->find_all()->as_array(); -- cgit v1.2.3