<?php $relPath = "./../../pinc/"; include_once $relPath . 'base.inc'; include_once 'common.inc'; // Initialize the graph before anything else. // This makes use of the jpgraph cache if enabled. // Last argument to init_pie_graph is the cache timeout in minutes. $graph = init_pie_graph(640, 400, 58); $res = mysql_query("SELECT IFNULL(LEFT(u_intlang,2),'') AS intlang,COUNT(*) AS num FROM users GROUP BY intlang ORDER BY num DESC"); $x = array(); $y = array(); while ($r = mysql_fetch_assoc($res)) { array_push($x, ($r['intlang'] ? dgettext("iso_639", eng_name($r['intlang'])) : _("Browser default")) . " (%d)"); array_push($y, $r['num']); } $title = _("Number of users per user interface language"); draw_pie_graph($graph, $x, $y, $title); // vim: sw=4 ts=4 expandtab
function manage_form($locale) { global $dyn_locales_dir, $translate_url, $charset; $system_locales = get_installed_system_locales(); $translation_enabled = is_locale_translation_enabled($locale); echo "<p><a href='{$translate_url}'>" . _("Back to the Translation Center") . "</a></p>"; echo "<h1>" . sprintf(_("Managing locale %s"), $locale) . "</h1>\n"; echo "<p><b>" . _("Locale") . ":</b> {$locale}</p>\n"; if (!in_array($locale, $system_locales)) { echo "<p><b>" . sprintf(_("Warning: While a locale translation exists for %s, a system locale does not. Without a system locale installed, gettext will not use this translation."), $locale) . "</b></p>"; } echo "<p><b>" . _("Language") . ":</b> " . eng_name($locale) . "</p>\n"; echo "<p><b>" . _("Translation status") . ":</b> "; if ($translation_enabled) { echo _("Enabled"); } else { echo _("Disabled"); } echo "</p>\n"; $po_filename = "{$dyn_locales_dir}/{$locale}/LC_MESSAGES/messages.po"; $po_file = new POFile($po_filename); if ($po_file->exists) { $total_strings = $po_file->messages_count; $translated_strings = $po_file->messages_translated_count; echo "<p><b>" . _("PO file") . ":</b> "; echo "<a href='{$translate_url}?func=view&locale={$locale}'>" . _("View") . "</a> | <a href='{$translate_url}?func=download&locale={$locale}'>" . _("Download") . "</a> (" . _("Last modified") . ": " . date("F d Y H:i:s", $po_file->last_modified) . ")"; echo " - "; echo sprintf(_('%1$s of %2$s translated (%3$d%%)'), $translated_strings, $total_strings, $translated_strings / $total_strings * 100); echo "</p>"; $pot_filename = "{$dyn_locales_dir}/messages.pot"; $pot_file = new POFile($pot_filename); if ($pot_file->exists && $pot_file->last_modified > $po_file->last_modified) { echo "<p>" . _("The current template is more recent than the PO file. You should merge the PO file with the current template.") . "</p>"; } echo "<form action='{$translate_url}?func=merge' method='POST'>"; echo "<input type='hidden' name='locale' value='{$locale}'>"; echo "<input type='submit' value='" . attr_safe(_("Merge current PO file with the current template")) . "'> "; echo _("Run <code>msgmerge</code> to update the current PO file against the current template.") . "<br>\n"; echo "<input type='checkbox' name='fuzzy'> " . _("Do fuzzy matching when an exact match is not found (can be much slower)") . "<br>"; echo "</form><br><br>\n"; } else { echo "<p>" . _("No PO file.") . "</p>\n"; } echo "<form action='{$translate_url}?func=upload' method='POST' enctype='multipart/form-data'>\n"; echo "<input type='hidden' name='locale' value='{$locale}'>"; echo _("Select a PO file to upload:") . " "; echo "<input type='hidden' name='MAX_FILE_SIZE' value='5000000'>"; echo "<input type='file' name='userfile'><br>\n"; echo "<input type='submit' value='" . attr_safe(_("Upload file")) . "'> "; echo _("This replaces the current PO file with the file you provide, and installs the translation for use by the site."); echo "</form>\n"; if (user_is_a_sitemanager()) { echo "<br><br>"; echo "<h2>" . _("Site administrator functions") . "</h2>"; echo "<form action='{$translate_url}?func=changeenable' method='POST'>"; echo "<input type='hidden' name='locale' value='{$locale}'>"; if ($translation_enabled) { $checkbox_state = "checked"; } else { $checkbox_state = ""; } echo "<input type='checkbox' name='enable_locale' value='1' {$checkbox_state}> "; echo _("Enable locale translation") . " "; echo "<input type='submit' value='" . attr_safe(_("Save")) . "'> "; echo "</form>\n"; echo "<br><br>"; echo "<form action='{$translate_url}?func=delete' method='POST'>"; echo "<input type='hidden' name='locale' value='{$locale}'>"; $confirm = javascript_safe(_("Are you sure you want to delete this locale and its translation file?"), $charset); echo "<input type='submit' onClick='return confirm(\"{$confirm}\");' value='" . attr_safe(_("Delete this locale")) . "'> "; echo _("Delete the locale directory, PO file and MO file.") . "<br>\n"; echo "</form>\n"; } }