diff options
author | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-09-09 00:33:50 +0000 |
---|---|---|
committer | marcus <marcus@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-09-09 00:33:50 +0000 |
commit | 75a9e7176004492c3a2b0180f05dc93a4abf3c53 (patch) | |
tree | 69f51cd603ba16c13ca0eec0e008b627e808d49d /engine/lib/languages.php | |
parent | 98e364dd438cf6100ec76ac596331564213d0982 (diff) | |
download | elgg-75a9e7176004492c3a2b0180f05dc93a4abf3c53.tar.gz elgg-75a9e7176004492c3a2b0180f05dc93a4abf3c53.tar.bz2 |
Introducing: Admin only translation "completeness" helper.
git-svn-id: https://code.elgg.org/elgg/trunk@2064 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/languages.php')
-rw-r--r-- | engine/lib/languages.php | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/engine/lib/languages.php b/engine/lib/languages.php index 1e2714d77..93ea5d09b 100644 --- a/engine/lib/languages.php +++ b/engine/lib/languages.php @@ -105,10 +105,31 @@ $installed = array(); foreach ($CONFIG->translations as $k => $v) + { $installed[$k] = elgg_echo($k, $k); + + if ((isadminloggedin()) && ($k!='en')) + $installed[$k] .= " (" . get_language_completeness($k) . "% " . elgg_echo('complete') . ")"; + } return $installed; } + + /** + * Return the level of completeness for a given language code (compared to english) + */ + function get_language_completeness($language) + { + global $CONFIG; + + $language = sanitise_string($language); + + $en = count($CONFIG->translations['en']); + + $lang = count($CONFIG->translations[$language]); + + return round(($lang / $en) * 100, 2); + } register_translations(dirname(dirname(dirname(__FILE__))) . "/languages/");
|