当前位置: 首页>>代码示例>>PHP>>正文


PHP load_translations函数代码示例

本文整理汇总了PHP中load_translations函数的典型用法代码示例。如果您正苦于以下问题:PHP load_translations函数的具体用法?PHP load_translations怎么用?PHP load_translations使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了load_translations函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: check_requirements

 function check_requirements()
 {
     if (!is_plugin_active('woocommerce/woocommerce.php') || !is_plugin_active('woocommerce-dynamic-pricing/woocommerce-dynamic-pricing.php')) {
         load_translations();
         deactivate_plugins(basename(__FILE__));
         wp_die('<h1>' . __('Missing Requirements', 'wc-sales-products-not-dynamic') . '</h1>' . '<p><em>' . __('Exclude WooCommerce products on sale from Dynamic Pricing', 'wc-sales-products-not-dynamic') . '</em>' . __(' can not be activated because it requires the WooCommerce and WooCommerce Dynamic Pricing plugins to be installed and activated.', 'wc-sales-products-not-dynamic') . '</p> <a href="' . admin_url('plugins.php') . '">' . __('Go back', 'wc-sales-products-not-dynamic') . '</a> </p>');
     }
 }
开发者ID:desaulniers-simard,项目名称:wc-sales-products-not-dynamic,代码行数:8,代码来源:wc-sales-products-not-dynamic.php

示例2: save_translation

function save_translation($lang, $addition = '', $remove = array())
{
    global $base_dir;
    $translations = load_translations($lang);
    $num = isset($_GET['count']) ? $_GET['count'] : 0;
    for ($i = 0; $i < $num; ++$i) {
        if (isset($_POST['key' . $i])) {
            $key = stripslashes($_POST['key' . $i]);
            $value = stripslashes($_POST['trans' . $i]);
            $translations[$key] = $value;
        }
    }
    if ($file = fopen($base_dir . './languages/global_' . $lang . '.php', 'w')) {
        $lookup = array();
        foreach ($remove as $id) {
            $lookup[$id] = true;
        }
        fwrite($file, "<?php\n\n/* auto-generated by administrationdit_language.php */\n\n");
        reset($translations);
        $id = 0;
        foreach ($translations as $key => $value) {
            if (!isset($lookup[$id])) {
                fwrite($file, '$strings[\'' . addslashes($key) . '\']=\'' . addslashes($value) . '\'' . ";\n");
            }
            $id++;
        }
        if ($addition != '') {
            fwrite($file, '$strings[\'' . addslashes($addition) . '\']=\'' . addslashes($addition) . '\'' . ";\n");
        }
        fwrite($file, "\n?>\n");
        fclose($file);
        echo count($translations) - count($lookup) . text("translations_saved_ok");
        if (count($lookup)) {
            echo "<BR>" . count($lookup) . text("labels_deleted");
        }
    }
}
开发者ID:jgatica,项目名称:Netoffice,代码行数:37,代码来源:edit_language.php

示例3: define

define('BASEDIR', dirname(__FILE__));
define('APPLICATION_PATH', dirname(BASEDIR));
define('OBJECTS_PATH', APPLICATION_PATH . '/includes');
define('TEMPLATE_FOLDER', BASEDIR . '/templates/');
require_once OBJECTS_PATH . '/i18n.inc.php';
class user
{
    var $infos = array();
}
class project
{
    var $id = 0;
}
$user = new user();
$proj = new project();
load_translations();
# no caching to prevent old pages if user goes back and forth during install
header("Expires: Tue, 03 Jul 2001 06:00:00 GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
# Step 1 and 2 of composer install now working also with SAFE_MODE enabled in php5.3.*
#if(ini_get('safe_mode') == 1){
#	$composerit = 'composerit.pl'; // try it with perl scripts
#}else{
$composerit = 'composerit.php';
// try it with php
#}
?>
<!DOCTYPE html>
<html>
开发者ID:canneverbe,项目名称:flyspray,代码行数:31,代码来源:composertest.php

示例4: load_textdomain

function load_textdomain($domain, $mofile)
{
    global $translations;
    $translations[$domain] =& load_translations($mofile);
}
开发者ID:akirk,项目名称:GlotPress,代码行数:5,代码来源:app.php

示例5: feather_translate

function feather_translate($text, $domain = 'featherbb')
{
    $translations = load_translations($domain);
    $translations = $translations->translate($text);
    return $translations;
}
开发者ID:bohwaz,项目名称:featherbb,代码行数:6,代码来源:l10n.php

示例6: createTestData

function createTestData()
{
    # quick safety
    exit;
    if (PHP_SAPI !== 'cli') {
        die('Please call it only from commandline');
    }
    global $db, $fs, $proj, $user, $notify;
    // Use this only on a new test installation, code does not work on
    // an existing one, and never will.
    ### Simulation Settings ###
    # Set conservative data as default, setup bigger values for further performance tests.
    # maybe setting moved out of this function to make performance graphs with multiple runs..
    // Borg Inc. is a big multinational company delivering
    $maxproducts = 3;
    # =projects
    $maxversions = 3;
    // both to it's
    $maxcorporateusers = 5;
    // working in
    $maxcorporates = 3;
    // and
    $maxindividualusers = 5;
    // who are all happy to report to us about
    $maxtasks = 10;
    // There are many problems in our products. And then there are also
    $maxviewers = 10;
    // who just like to watch what's going on here at Borg Inc.
    // Our users are also keen to add attachments to their reports and comments, so there are
    $maxattachments = 5;
    // in our database;
    // Our users are also very active with commenting.
    $maxcomments = 20;
    // To handle all the resulting work, we need
    $maxadmins = 2;
    $maxmanagers = 2;
    $maxdevelopers = 3;
    // people working together all over the globe to care for their needs.
    ### End of Simulation Settings ###
    // We also have both a very innovative and standardized naming scheme for our products.
    // And we have also made one big invention offered only to our customers in the world:
    // Time travel! You can comment on tasks and other comments in them even before the task
    // is even opened or the original comment made.
    // Add more according to your taste...
    $subjects[] = "%s sucks!";
    $subjects[] = "%s is utterly crap!";
    $subjects[] = "Developers of %s should be hanged!";
    $subjects[] = "Developers of %s should be strangled!";
    $subjects[] = "Developers of %s should be eaten alive by zombies!";
    $subjects[] = "Developers of %s should be thrown in a pit of snakes!";
    $subjects[] = "Who is the idiot responsible for %s?";
    error_reporting(E_ALL);
    // die('Enable me by commenting this out by editing and read the contents first!'.basename(__FILE__).' at line '.__LINE__);
    define('IN_FS', 1);
    require_once dirname(__FILE__) . '/../includes/fix.inc.php';
    require_once dirname(__FILE__) . '/../includes/class.flyspray.php';
    require_once dirname(__FILE__) . '/../includes/constants.inc.php';
    require_once dirname(__FILE__) . '/../includes/i18n.inc.php';
    require_once dirname(__FILE__) . '/../includes/class.tpl.php';
    require_once dirname(__FILE__) . '/../vendor/autoload.php';
    $conf = parse_ini_file('../flyspray.conf.php', true) or die('Cannot open config file.');
    $db = new Database();
    $db->dbOpenFast($conf['database']);
    $RANDOP = 'RAND()';
    if ($db->dblink->dataProvider == 'postgres') {
        $RANDOP = 'RANDOM()';
    }
    #die();
    $fs = new Flyspray();
    $user = new User(1);
    $proj = new Project(1);
    $notify = new Notifications();
    load_translations();
    for ($i = 1; $i <= $maxadmins; $i++) {
        $user_name = "admin{$i}";
        $real_name = "Administrator {$i}";
        $password = $user_name;
        $time_zone = 0;
        // Assign different one!
        $email = null;
        // $user_name . '@example.com';
        Backend::create_user($user_name, $password, $real_name, '', $email, 0, $time_zone, 1, 1);
    }
    for ($i = 1; $i <= $maxmanagers; $i++) {
        $user_name = "pm{$i}";
        $real_name = "Project Manager {$i}";
        $password = $user_name;
        $time_zone = 0;
        // Assign different one!
        $email = null;
        // $user_name . '@example.com';
        Backend::create_user($user_name, $password, $real_name, '', $email, 0, $time_zone, 2, 1);
    }
    $db->Query('UPDATE {projects} SET project_is_active = 0 WHERE project_id = 1');
    // Show more columns by default, trying to make database or flyspray crash under stress.
    $db->Query("UPDATE {prefs} SET pref_value = 'id project category tasktype severity summary status openedby dateopened progress comments attachments votes' WHERE pref_name = 'visible_columns'");
    // Add 3 different Global developer groups with different
    // view rights first, then assign developers to them at random.
    // Borg Inc. has a strict hierarchy on who can see and do what.
    // Somewhat more relaxed with our own developers.
//.........这里部分代码省略.........
开发者ID:krayon,项目名称:flyspray,代码行数:101,代码来源:CreateTestData.php

示例7: init

/**
 * Initialize common behavior
 *
 * Currently:
 * - Loads translations
 * - Registers post types
 *
 * @since 3.0.0
 */
function init()
{
    load_translations();
    register_post_types();
}
开发者ID:evgalak,项目名称:woocommerce-product-faqs,代码行数:14,代码来源:shared.php

示例8: luna_translate

function luna_translate($text, $domain = 'default')
{
    $translations = load_translations($domain);
    $translations = $translations->translate($text);
    return $translations;
}
开发者ID:istrwei,项目名称:Luna,代码行数:6,代码来源:l10n.php

示例9: ob_flush

                    ob_flush();
                    exit;
                }
            }
        }
    }
}
// not cookie, no sso
if (!isset($w->sess_id)) {
    require INC_DIR . '/func.php';
    require LIB_DIR . '/class_file.php';
    // cache + template
    require LIB_DIR . '/class_template.php';
    $o->lang = $w->lang;
    $o->mid_content = VOID;
    load_translations($w->lang, $l);
    $t = new TEMPLATE();
    $t->debug = $w->debug;
    $t->translations = $l;
    // keelemuutujad templeidile nähtavaks. keelekontroll on config.php's
    //echo "<!--";
    //echo $auth_method;
    //print_r($w);
    //echo "-->";
    if (!$authok) {
        switch ($auth_method) {
            case 'sso':
                if ($w->allow_sso) {
                    require INC_DIR . '/sso.php';
                }
                break;
开发者ID:jotttt,项目名称:auth,代码行数:31,代码来源:main.php

示例10: createTestData

function createTestData()
{
    # quick safety
    exit;
    if (PHP_SAPI !== 'cli') {
        die('');
    }
    // Use this only on a new test installation, code does not work on
    // an existing one, and never will.
    // Borg Inc. is a big multinational company delivering
    $maxproducts = 50;
    // both to it's
    $maxcorporateusers = 450;
    // working in
    $maxcorporates = 50;
    // and
    $maxindividualusers = 10;
    // who are all happy to report to us about
    $maxtasks = 150;
    // the many problems in our products. And then there are also
    $maxviewers = 50;
    // who just like to watch what's going on here at Borg Inc.
    // Our users are also keen to add attachments to their reports and comments, so there are
    $maxattachments = 500;
    // in our database;
    // Our users are also very active with commenting.
    $maxcomments = 750;
    // To handle all the resulting work, we need
    $maxadmins = 3;
    $maxmanagers = 5;
    $maxdevelopers = 50;
    // people working together all over the globe to care for their needs.
    // We also have both a very innovative and standardized naming scheme for our products.
    // And we have also made one big invention offered only to our customers in the world:
    // Time travel! You can comment on tasks and other comments in them even before the task
    // is even opened or the original comment made.
    // Add more according to your taste...
    $subjects[] = "%s sucks!";
    $subjects[] = "%s is utterly crap!";
    $subjects[] = "Developers of %s should be hanged!";
    $subjects[] = "Developers of %s should be strangled!";
    $subjects[] = "Developers of %s should be eaten alive by zombies!";
    $subjects[] = "Developers of %s should be thrown in a pit of snakes!";
    $subjects[] = "Who is the idiot responsible for %s?";
    error_reporting(E_ALL);
    // die('Enable me by commenting this out by editing and read the contents first!'.basename(__FILE__).' at line '.__LINE__);
    define('IN_FS', 1);
    require_once dirname(__FILE__) . '/../includes/fix.inc.php';
    require_once dirname(__FILE__) . '/../includes/class.flyspray.php';
    require_once dirname(__FILE__) . '/../includes/constants.inc.php';
    require_once dirname(__FILE__) . '/../includes/i18n.inc.php';
    require_once dirname(__FILE__) . '/../includes/class.tpl.php';
    require_once dirname(__FILE__) . '/../vendor/autoload.php';
    $conf = @parse_ini_file('../flyspray.conf.php', true) or die('Cannot open config file.');
    $db = new Database();
    $db->dbOpenFast($conf['database']);
    $RANDOP = 'RAND()';
    if ($db->dblink->dataProvider == 'postgres') {
        $RANDOP = 'RANDOM()';
    }
    $fs = new Flyspray();
    $user = new User(1);
    $proj = new Project(1);
    $notify = new Notifications();
    load_translations();
    for ($i = 1; $i <= $maxadmins; $i++) {
        $user_name = "admin{$i}";
        $real_name = "Administrator {$i}";
        $password = $user_name;
        $time_zone = 0;
        // Assign different one!
        $email = null;
        // $user_name . '@foo.bar.baz.org';
        Backend::create_user($user_name, $password, $real_name, '', $email, 0, $time_zone, 1, 1);
    }
    for ($i = 1; $i <= $maxmanagers; $i++) {
        $user_name = "pm{$i}";
        $real_name = "Project Manager {$i}";
        $password = $user_name;
        $time_zone = 0;
        // Assign different one!
        $email = null;
        // $user_name . '@foo.bar.baz.org';
        Backend::create_user($user_name, $password, $real_name, '', $email, 0, $time_zone, 2, 1);
    }
    $db->Query('UPDATE {projects} SET project_is_active = 0 WHERE project_id = 1');
    // Show more columns by default, trying to make database or flyspray crash under stress.
    $db->Query("UPDATE {prefs} SET pref_value = 'id project category tasktype severity summary status openedby dateopened progress comments attachments votes' WHERE pref_name = 'visible_columns'");
    // Add 3 different Global developer groups with different
    // view rights first, then assign developers to them at random.
    // Borg Inc. has a strict hierarchy on who can see and do what.
    // Somewhat more relaxed with our own developers.
    $db->Query("INSERT INTO {groups} " . "(group_name,group_desc,project_id,group_open,view_comments,manage_project,view_tasks, view_groups_tasks, view_own_tasks,open_new_tasks,modify_own_tasks) " . "VALUES('Developer Group 1', 'Developer Group 1', 0, 1, 1, 0, 1, 1, 1, 1, 1)");
    $db->Query("INSERT INTO {groups} " . "(group_name,group_desc,project_id,group_open,view_comments,manage_project,view_tasks, view_groups_tasks, view_own_tasks,open_new_tasks,modify_own_tasks) " . "VALUES('Developer Group 2', 'Developer Group 2', 0, 1, 1, 0, 0, 1, 1, 1, 1)");
    $db->Query("INSERT INTO {groups} " . "(group_name,group_desc,project_id,group_open,view_comments,manage_project,view_tasks, view_groups_tasks, view_own_tasks,open_new_tasks,modify_own_tasks) " . "VALUES('Developer Group 3', 'Developer Group 3', 0, 1, 1, 0, 0, 0, 1, 1, 1)");
    // Add also general groups for corporate users, individual users and viewers.
    // Allow only login. Not so relaxed with them bastards.
    $db->Query("INSERT INTO {groups} " . "(group_name,group_desc,project_id,group_open) " . "VALUES('Corporate Users', 'Corporate Users', 0, 1)");
    $db->Query("INSERT INTO {groups} " . "(group_name,group_desc,project_id,group_open) " . "VALUES('Trusted Users', 'Trusted Users', 0, 1)");
    $db->Query("INSERT INTO {groups} " . "(group_name,group_desc,project_id,group_open) " . "VALUES('Non-trusted Users', 'Non-trusted Users', 0, 1)");
//.........这里部分代码省略.........
开发者ID:canneverbe,项目名称:flyspray,代码行数:101,代码来源:CreateTestData.php


注:本文中的load_translations函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。