示例#1
0
<h3>Enabling translators</h3>
<p>Site translators have the ability to download the a translation, update it, and upload it back to the site. Note that translators have these abilities for all translations, not just a specific one. They cannot enable or disable a translation, create a translation for a new locale, delete a translation, or regenerate the template file.</p>

<p>To specify a user as a site translator, create an entry in the usersettings table for them:</p>
<blockquote>
<tt>INSERT INTO usersettings SET username='******', setting='site_translator', value='yes';</tt>
</blockquote>

<?php 
}
// user_is_a_sitemanager();
?>

<?php 
if (user_is_site_translator()) {
    ?>

<hr>

<h2>Translators</h2>

<h3>Character sets</h3>
<p>PO files, also known as message files, can be saved and uploaded in various different encodings, including ISO-8859-1 (ie: Latin-1) and UTF-8. The encoding must match the "Content-Type" heading at the top of the file to ensure proper localization of the page to the user. PO editors will do this for you automatically. Mismatched encodings and Content-Type headings will result in message corruption in the file, therefore it is imperative that you use a PO editor and not just a text editor!</p>

<p>The DP code currently only supports the ISO-8859-1 (ie: Latin-1) character set. Messages in PO files using different character sets, such as UTF-8, will be converted automatically before being shown to the user. Any characters that do not have an exact representation in ISO-8859-1 will be transliterated to the closest possible character. If you wish to represent characters in a message string that do not have ISO-8859-1 equivalents, use <a href='http://www.w3.org/TR/html4/sgml/entities.html'>HTML entities</a> in the string instead.</p>

<h3>PO Editors</h3>
<p>To work with DP code translations, you must use a PO editor. This is a tool that allows working with PO files, also known as message files, and ensures that the file is in the correct format and character set. Here are links to some common editors:</p>
<ul>
    <li><a href='https://poedit.net'>Poedit</a> - supports Windows, Mac, and Linux.</li>
示例#2
0
<?php

$relPath = "./../../pinc/";
include_once $relPath . 'base.inc';
include_once $relPath . 'theme.inc';
include_once $relPath . 'misc.inc';
include_once $relPath . 'user_is.inc';
include_once $relPath . 'metarefresh.inc';
include_once $relPath . 'POFile.inc';
require_login();
undo_all_magic_quotes();
$translate_url = "{$code_url}/locale/translators/index.php";
$may_manage = user_is_site_translator();
if ($may_manage) {
    $allowed_functions = array('manage', 'merge', 'upload', 'download', 'view');
} else {
    $allowed_functions = array('download', 'view');
}
if (user_is_a_sitemanager()) {
    $allowed_functions[] = 'xgettext';
    $allowed_functions[] = 'newtranslation';
    $allowed_functions[] = 'newtranslation2';
    $allowed_functions[] = 'delete';
    $allowed_functions[] = 'changeenable';
}
$func = get_enumerated_param($_GET, 'func', null, $allowed_functions, true);
if ($func == "download" || $func == "view") {
    // View or download temporary files. No theme needed.
    if (@$_REQUEST['locale'] == "template") {
        $filename = "{$dyn_locales_dir}/messages.pot";
    } else {