Plugin Directory

Changeset 946612


Ignore:
Timestamp:
07/10/2014 11:01:37 PM (12 years ago)
Author:
puggan
Message:

lang_support

Location:
bitid-authentication/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • bitid-authentication/trunk/ajax.php

    r946553 r946612  
    1919    {
    2020        $data['status'] = -1;
    21         $data['html'] = "<p>Error: The current session dosn't have a bitid-nonce.</p>";
     21        $data['html'] = "<p>" . __("Error: The current session dosn't have a bitid-nonce.", 'bitid-authentication') . "</p>";
    2222    }
    2323    else if($nonce_row['address'])
     
    3232            if(is_user_logged_in())
    3333            {
    34                 $data['html'] = "<p>Allredy logged in</p>";
     34                $data['html'] = "<p>" . __("Allredy logged in", 'bitid-authentication') . "</p>";
    3535                $data['reload'] = 1;
    3636            }
     
    4444                    do_action('wp_login', $user->user_login, $user);
    4545
    46                     $data['html'] = "<p>Sucess, loged in as '{$user->user_login}'</p>";
     46                    $data['html'] = "<p>" . sprintf(__("Sucess, loged in as '%s'", 'bitid-authentication'), $user->user_login) . "</p>";
    4747                    $data['reload'] = 1;
    4848
     
    5252                else
    5353                {
    54                     $data['html'] = "<p>Bitid verification Sucess, but no useraccount connected to '{$data['adress']}'</p>";
     54                    $data['html'] = "<p>" . sprintf(__("Bitid verification Sucess, but no useraccount connected to '%s'", 'bitid-authentication'), $data['adress']) . "</p>";
    5555                }
    5656            }
     
    5858        else
    5959        {
    60             $data['html'] = "<p>Bitid verification Sucess, but no useraccount connected to '{$data['adress']}'</p>";
     60            $data['html'] = "<p>" . sprintf(__("Bitid verification Sucess, but no useraccount connected to '%s'", 'bitid-authentication'), $data['adress']) . "</p>";
    6161        }
    6262    }
  • bitid-authentication/trunk/bitid-authentication.php

    r946553 r946612  
    1111Author: Puggan
    1212Author URI: http://blog.puggan.se
     13Text Domain: bitid-authentication
    1314*/
    1415
    15 DEFINE("BITID_AUTHENTICATION_PLUGIN_VERSION", '0.0.4');
     16DEFINE("BITID_AUTHENTICATION_PLUGIN_VERSION", '0.0.3a');
    1617
    1718    require_once("bitid.php");
     
    7576  address VARCHAR(34) COLLATE utf8_bin DEFAULT NULL,
    7677  birth DATETIME NOT NULL,
    77   pulse DATETIME DEFAULT NULL,
     78  pulse DATETIME NOT NULL,
    7879  PRIMARY KEY (address),
    7980  KEY (user_id),
     
    9697    {
    9798//      add_options_page( 'Bitid Options', 'Bitid', 'edit_users', 'bitid-authentication', 'bitid_option_page' );
    98         add_users_page( 'My Bitid' , 'Bitid', 'read', 'my-bitid', 'bitid_my_option_page' );
     99        add_users_page(
     100            _x('My Bitid', 'page_title', 'bitid-authentication'),
     101            _x('Bitid', 'menu_name', 'bitid-authentication'),
     102            'read',
     103            'my-bitid',
     104            'bitid_my_option_page'
     105        );
    99106    }
    100107
     
    148155                            if($db_result)
    149156                            {
    150                                 echo bitid_admin_notice("The address '{$address}' is now linked to your account.");
     157                                echo bitid_admin_notice(sprintf(__("The address '%s' is now linked to your account.", 'bitid-authentication'), $address));
    151158
    152159                                $addresses = bitid_list_users_addresses($user_id);
     
    154161                            else
    155162                            {
    156                                 echo bitid_admin_notice("Failed to link address '{$default_address}' to your account.", 'error');
     163                                echo bitid_admin_notice(sprintf(__("Failed to link address '%s' to your account.", 'bitid-authentication'), $address), 'error');
    157164                            }
    158165                        }
    159166                        else
    160167                        {
    161                             echo bitid_admin_notice("The address '{$default_address}' isn't valid.", 'error');
     168                            echo bitid_admin_notice(sprintf(__("The address '%s' isn't valid.", 'bitid-authentication'), $address), 'error');
    162169                        }
    163170                    }
     
    166173                        $default_address = (string) @$_REQUEST['address'];
    167174                    }
     175
     176                    $legend_title = _x("Add bitid-address", 'legend_title', 'bitid-authentication');
     177                    $label_title = _x("Bitid-address", 'input_label', 'bitid-authentication');
     178                    $button_title = _x("Link to my account", 'button', 'bitid-authentication');
    168179
    169180                    echo <<<HTML_BLOCK
     
    171182    <fieldset style='border: solid black 2px; width: 40em; padding: 10px; margin: 10px;'>
    172183        <legend style='font-size: larger;'>
    173             Add bitid-address
     184            {$legend_title}
    174185        </legend>
    175186        <div class='fieldset_content'>
    176187            <label>
    177188                <span style='width: 10em; display: inline-block;'>
    178                     Bitid-address:
     189                    {$label_title}:
    179190                </span>
    180191                <input type='text' name='address' value='{$default_address}' style='width: 25em;'/>
    181192            </label>
    182193            <br />
    183             <input type='submit' value='Link to my account' style='margin-left: 10em;' />
     194            <input type='submit' value='{$button_title}' style='margin-left: 10em;' />
    184195        </div>
    185196    </fieldset>
     
    214225                        if($_POST)
    215226                        {
    216                             echo bitid_admin_notice("Select some rows before asking to delete them", 'error');
     227                            echo bitid_admin_notice(__("Select some rows before asking to delete them", 'bitid-authentication'), 'error');
    217228                            break;
    218229                        }
    219230                        else
    220231                        {
    221                             echo bitid_admin_notice("Missing paramater 'address'", 'error');
     232                            echo bitid_admin_notice(sprintf(__("Missing paramater '%s'", 'bitid-authentication'), 'address'), 'error');
    222233                            break;
    223234                        }
     
    241252                    if($found_addresses)
    242253                    {
    243                         echo bitid_admin_notice("The address '" . implode("', '", $found_addresses) . "' isn't connected to your account.", 'error');
     254                        echo bitid_admin_notice(
     255                            sprintf(
     256                                _n(
     257                                    "The address %s isn't connected to your account.",
     258                                    "Those addresses %s arn't connected to your account.",
     259                                    count($found_addresses),
     260                                    'bitid-authentication'
     261                                ),
     262                                "'" . implode("', '", $found_addresses) . "'"
     263                            ),
     264                            'error'
     265                        );
    244266                    }
    245267
     
    267289                    if($failed_addresses)
    268290                    {
    269                         echo bitid_admin_notice("Failed to remove the adress '" . implode("', '", $failed_addresses) . "'", 'error');
     291                        echo bitid_admin_notice(
     292                            sprintf(
     293                                _n(
     294                                    "Failed to remove the adress %s.",
     295                                    "Failed to remove those addresses %s.",
     296                                    count($failed_addresses),
     297                                    'bitid-authentication'
     298                                ),
     299                                "'" . implode("', '", $failed_addresses) . "'"
     300                            ),
     301                            'error'
     302                        );
    270303                    }
    271304
    272305                    if($deleted_addresses)
    273306                    {
    274                         $deleted_addresses_string = "'" . implode("', '", $deleted_addresses) . "'";
    275 
    276                         echo bitid_admin_notice("The address '{$deleted_addresses_string}' is no longer linked to your account.");
     307                        echo bitid_admin_notice(
     308                            sprintf(
     309                                _n(
     310                                    "The address %s is no longer linked to your account.",
     311                                    "Those addresses %s is no longer linked to your account.",
     312                                    count($deleted_addresses),
     313                                    'bitid-authentication'
     314                                ),
     315                                "'" . implode("', '", $deleted_addresses) . "'"
     316                            ),
     317                            'error'
     318                        );
    277319
    278320                        $addresses = bitid_list_users_addresses($user_id);
     
    289331        }
    290332
     333        $page_title = _x("My bitid-addresses", "page_title", 'bitid-authentication');
     334        $add_link_title = __("Add New");
     335
    291336        echo <<<HTML_BLOCK
    292337<div class="wrap">
    293338    <h2>
    294         <span>My bitid-addresses</span>
    295         <a class="add-new-h2" href="?page={$_REQUEST['page']}&action=add">Add New</a>
     339        <span>{$page_title}</span>
     340        <a class="add-new-h2" href="?page={$_REQUEST['page']}&action=add">{$add_link_title}</a>
    296341    </h2>
    297342
    298343HTML_BLOCK;
     344
    299345        if(!$addresses)
    300346        {
    301             echo bitid_admin_notice("You have no bitid-addresses connected to your account.");
     347            echo bitid_admin_notice(__("You have no bitid-addresses connected to your account.", 'bitid-authentication'));
    302348            return;
    303349        }
     
    309355                return array(
    310356                    'cb' => '<input type="checkbox" />',
    311                     'address' => 'Bitid-address',
    312                     'birth' => 'Added',
    313                     'pulse' => 'Last time used',
     357                    'address' => _x('Bitid-address', 'column_name', 'bitid-authentication'),
     358                    'birth' => _x('Added', 'column_name', 'bitid-authentication'),
     359                    'pulse' => _x('Last time used', 'column_name', 'bitid-authentication'),
    314360                );
    315361            }
     
    355401                $action_template = '<a href="?page=%s&action=%s&address=%s">%s</a>';
    356402                $actions = array(
    357                     'edit'      => sprintf($action_template, $_REQUEST['page'], 'edit', $item['address'], 'Edit'),
    358                     'delete'    => sprintf($action_template, $_REQUEST['page'], 'delete', $item['address'], 'Remove'),
     403                    'edit'      => sprintf($action_template, $_REQUEST['page'], 'edit', $item['address'], __('Edit')),
     404                    'delete'    => sprintf($action_template, $_REQUEST['page'], 'delete', $item['address'], __('Remove')),
    359405                );
    360406                return $item['address'] . $this->row_actions($actions);
     
    364410            {
    365411                return array(
    366                     'delete' => 'Delete',
     412                    'delete' => __('Delete'),
    367413                );
    368414            }
     
    462508        }
    463509
     510        $title = _x("BitID login", 'qr_image_label', 'bitid-authentication');
     511        $alt_text = htmlentities(_x("QR-code for BitID", 'qr_alt_text', 'bitid-authentication'), ENT_QUOTES);
     512
    464513        $url_encoded_url = urlencode($url);
    465514        $messages .= <<<HTML_BLOCK
    466515<div id='bitid'>
    467516    <p>
    468         <span>BITID login:</span>
     517        <span>{$title}:</span>
    469518        <a href='{$url}'>
    470             <img src='https://chart.googleapis.com/chart?cht=qr&chs=300x300&chl={$url_encoded_url}' />
     519            <img src='https://chart.googleapis.com/chart?cht=qr&chs=300x300&chl={$url_encoded_url}' alt='{$alt_text}' title='{$alt_text}' />
    471520        </a>
    472521    </p>
Note: See TracChangeset for help on using the changeset viewer.