Permalink
Browse files

r2361@opsdev009 (orig r112193): sgrimm | 2008-07-23 14:48:10 -0700

 Wrap user-visible strings in <fb:intl> tags to allow translation.
  • Loading branch information...
1 parent 2f1a8e2 commit a9ce141c4fb395cce929c9964c48680f505701f8 (no author) committed Jul 23, 2008
@@ -11,6 +11,8 @@
$constants .= "define('IMAGE_LOCATION', ROOT_LOCATION . 'images/');\n";
+define('LIB_PATH', $settings['MAIN_PATH'].'lib/');
+
include_once $settings['MAIN_PATH'].'client/facebook.php';
include_once $settings['MAIN_PATH'].'lib/display.php';
$fb = new Facebook($settings['API_KEY'], $settings['SECRET_KEY']);
@@ -44,7 +44,7 @@
}
.smiley {
- font-size: 25pt;
+ font-size: 25pt !important;
font-weight: bold;
padding: 10px;
}
@@ -60,12 +60,12 @@
h2 {
- font-size: 20pt;
+ font-size: 20pt !important;
text-align: center;
}
h3 {
- font-size: 12pt;
+ font-size: 12pt !important;
text-align: center;
}
@@ -40,8 +40,8 @@
} else {
$data = array('errorCode'=> VALIDATION_ERROR,
- 'errorTitle'=> 'No smiley selected',
- 'errorMessage'=>'Please select a smiley.');
+ 'errorTitle'=> '<fb:intl>No smiley selected</fb:intl>',
+ 'errorMessage'=>'<fb:intl>Please select a smiley.</fb:intl>');
}
echo json_encode($data);
@@ -25,8 +25,8 @@
} else {
$data = array('errorCode'=> FACEBOOK_API_VALIDATION_ERROR,
- 'errorTitle'=> 'No mood selected',
- 'errorMessage'=>'Please select a smiley.');
+ 'errorTitle'=> '<fb:intl>No mood selected</fb:intl>',
+ 'errorMessage'=>'<fb:intl>Please select a smiley.</fb:intl>');
}
echo json_encode($data);
@@ -1,7 +1,7 @@
<?php
-include_once '../howareyoufeeling/lib/moods.php';
-include_once '../howareyoufeeling/lib/constants.php';
+include_once LIB_PATH.'moods.php';
+include_once LIB_PATH.'constants.php';
$picked = $_POST['picked'];
$moods = get_moods();
$fb = new Facebook('aa08653913021c3435f9deef7ed9693b',
@@ -36,8 +36,11 @@
padding: 20px;
}
</style>
-<h2>We are pleased to announce that <fb:name useyou="false" uid="'.$fb->user.'"/> is feeling:</h2>
-<div class="box"><div class="smiley">'.$moods[$mood][1].'</div><div >'.$moods[$mood][0].'</div></div>';
+<h2><fb:intl>We are pleased to announce that <fb:name useyou="false" uid="'.$fb->user.'"/> is feeling:</fb:intl></h2>
+<div class="box"><div class="smiley">'.$moods[$mood][1].'</div><div >
+<fb:intl desc="Mood name for \'' . $moods[$mood][1] . '\'">'
+ .$moods[$mood][0]
+.'</fb:intl></div></div>';
$feed = array('fbml' => $content);
$data = array('method'=> 'profileBox',
@@ -19,11 +19,11 @@
// Setting info section for example
// (Don't do this! Wait for user to add content)
$info_fields = get_sample_info();
- $fb->api_client->profile_setInfo('My Smilies', 5, $info_fields, $user);
+ $fb->api_client->profile_setInfo('<fb:intl desc="Profile box header">My Smilies</fb:intl>', 5, $info_fields, $user);
// Setting info main profile box for example
// (Don't do this! Wait for user to add content)
- $main_box = get_user_profile_box(array('Happy', ':)'), $user);
+ $main_box = get_user_profile_box(array('<fb:intl desc="Mood name for \':)\'">Happy</fb:intl>', ':)'), $user);
$fb->api_client->profile_setFBML(null, $user, null, null, null, $main_box);
// Don't do this again
@@ -32,25 +32,36 @@
echo render_header();
-echo '<h2>Welcome to Smiley!</h2>';
-echo '<p>Smiley is a sample app created to demonstrate the many '
- .'platform integration points of the Facebook profile.</p>';
+echo '<h2><fb:intl>Welcome to Smiley!</fb:intl></h2>';
+echo '<p><fb:intl>Smiley is a sample app created to demonstrate the many '
+ .'platform integration points of the Facebook profile.</fb:intl></p>';
// Profile box
-echo 'Here is an button for adding a box to your profile. This will go away if you add the box:';
+echo '<fb:intl>Here is a button for adding a box to your profile. This will go away if you add the box:</fb:intl>';
echo '<div class="section_button"><fb:add-section-button section="profile"/></div>';
// Info section
-echo 'Here is an button for adding an info section to your profile. This will go away if you add the section:';
+echo '<fb:intl>Here is a button for adding an info section to your profile. This will go away if you add the section:</fb:intl>';
echo '<div class="section_button"><fb:add-section-button section="info" /></div>';
// Permissions
-echo 'These are FBML tags that can prompt users for extended permissions from the canvas page.<br />These will go away if you grant these permissions:<br />';
-echo '<fb:prompt-permission perms="email">Enable Email</fb:prompt-permission>';
+echo '<fb:intl>These are FBML tags that can prompt users for extended permissions from the canvas page. These will go away if you grant these permissions:</fb:intl><br />';
+echo '<fb:prompt-permission perms="email"><fb:intl desc="Link to enable E-mail notification">Enable Email</fb:intl></fb:prompt-permission>';
echo '<br />';
-echo '<fb:prompt-permission perms="infinite_session">Enable Permanent Login</fb:prompt-permission>';
+echo '<fb:prompt-permission perms="infinite_session"><fb:intl>Enable Permanent Login</fb:intl></fb:prompt-permission>';
-echo '<p>Upon submitting the form below, you will be prompted to grant email permissions (unless you\'ve already done so for this app):';
-echo '<form promptpermission="email"><br />How often would you like to be notified of new smilies?<br /><input type="text" name="frequency"><input type="submit" value="Notify Me"></form></p>';
+echo '<p><fb:intl>Upon submitting the form below, you will be prompted to grant email permissions (unless you\'ve already done so for this app):</fb:intl>';
+echo '<form promptpermission="email"><br /><fb:intl>How often would you like to be notified of new smilies?</fb:intl>';
+echo '<br />';
+echo '<input type="text" name="frequency">';
+echo '<fb:tag name="input">'
+ . '<fb:tag-attribute name="type">submit</fb:tag-attribute>'
+ . '<fb:tag-attribute name="value">'
+ . '<fb:intl desc="Button label: Set notification frequency">'
+ . 'Notify Me'
+ . '</fb:intl>'
+ . '</fb:tag-attribute>'
+ . '</fb:tag>';
+echo '</form></p>';
@@ -1,8 +1,7 @@
<?php
-
// increment these when you change css or js files
-define('CSS_VERSION', '20');
+define('CSS_VERSION', '21');
define('JS_VERSION', '20');
function render_bool($res) {
@@ -30,11 +29,34 @@ function render_header($selected ='Home') {
$header .=
'<fb:tabs>'
- .'<fb:tab-item title="Home" href="index.php" '
- .'selected="' . ($selected == 'Home') .'" />'
- .'<fb:tab-item title="My Smilies" href="mysmilies.php" selected="' . ($selected == 'Mine') . '" />'
- .'<fb:tab-item title="New Smiley" href="newsmiley.php" selected="' . ($selected == 'New') . '" />'
- .'<fb:tab-item title="Send Smiley" href="sendSmiley.php" selected="' . ($selected == 'Send') . '" />'
+ .'<fb:tab-item href="index.php" selected="' . ($selected == 'Home') .'">'
+ .'<fb:fbml-attribute name="title">'
+ .'<fb:intl desc="Tab label for main app page">'
+ .'Home'
+ .'</fb:intl>'
+ .'</fb:attribute>'
+ .'</fb:tab-item>'
+ .'<fb:tab-item href="mysmilies.php" selected="' . ($selected == 'Mine') . '">'
+ .'<fb:fbml-attribute name="title">'
+ .'<fb:intl desc="Tab label for list of user\'s smilies">'
+ .'My Smilies'
+ .'</fb:intl>'
+ .'</fb:attribute>'
+ .'</fb:tab-item>'
+ .'<fb:tab-item href="newsmiley.php" selected="' . ($selected == 'New') . '">'
+ .'<fb:fbml-attribute name="title">'
+ .'<fb:intl desc="Tab label for page to create new smiley">'
+ .'New Smiley'
+ .'</fb:intl>'
+ .'</fb:attribute>'
+ .'</fb:tab-item>'
+ .'<fb:tab-item href="sendSmiley.php" selected="' . ($selected == 'Send') . '">'
+ .'<fb:fbml-attribute name="title">'
+ .'<fb:intl desc="Tab label for page to send a smiley">'
+ .'Send Smiley'
+ .'</fb:intl>'
+ .'</fb:attribute>'
+ .'</fb:tab-item>'
.'</fb:tabs>';
$header .= '<div id="main_body">';
return $header;
@@ -49,7 +71,7 @@ function render_footer() {
function render_inline_style() {
return '<style>
h2 {
- font-size: 20pt;
+ font-size: 20pt !important;
text-align: center;
}
@@ -99,7 +121,7 @@ function render_inline_style() {
}
.smiley {
- font-size: 25pt;
+ font-size: 25pt !important;
font-weight: bold;
padding: 10px;
color: black;
@@ -108,7 +130,7 @@ function render_inline_style() {
.big_smiley {
- font-size: 100pt;
+ font-size: 100pt !important;
font-weight: bold;
padding: 40px;
}
@@ -128,6 +150,8 @@ function render_emoticon_grid($moods) {
$ret.='<div class="table"><div class="row">';
foreach($moods as $mood) {
list($title,$smiley) = $mood;
+ $title = '<fb:intl desc="Mood name for \'' . $smiley . '\'">' . $title
+ . '</fb:intl>';
if ($i%3==0 && $i!=0) {
$ret.='</div><div class="row">';
}
@@ -155,7 +179,7 @@ function render_handler_css() {
margin-top: 20px;
}
.smiley {
- font-size: 20pt;
+ font-size: 20pt !important;
font-weight: bold;
padding: 0px;
padding-top: 20px;
@@ -29,7 +29,10 @@ function create_feed_story($user, $picked, $method='feedStory') {
padding: 20px;
}
</style>
-<div class="box2"><div class="smiley">'.$moods[$picked][1].'</div><div >'.$moods[$picked][0].'</div></div>';
+<div class="box2"><div class="smiley">'.$moods[$picked][1].'</div><div >
+<fb:intl desc="Mood name for \'' . $moods[$picked][1] . '\'">'
+ . $moods[$picked][0]
+.'</fb:intl></div></div>';
$image = IMAGE_LOCATION . '/smile'.$picked.'.jpg';
@@ -50,28 +50,37 @@ function get_other_moods() {
function get_sample_info() {
return array(
- array('field' => 'Good Smilies',
- 'items' =>
- array(array('label'=> 'Happy',
- 'image' => IMAGE_LOCATION . 'smile0.jpg',
- 'sublabel'=>'',
- 'description'=>'The original and still undefeated.',
- 'link'=>'http://www.facebook.com'),
- array('label'=>'Indifferent',
- 'image'=> IMAGE_LOCATION . 'smile1.jpg', 'description'=>'meh...',
- 'link'=>'http://www.facebook.com'),
- array('label'=>'Sad',
- 'image'=> IMAGE_LOCATION . 'smile2.jpg',
- 'description'=>'Oh my god! you killed my dog!',
- 'link'=>'http://www.facebook.com'),
- array('label'=>'Cool',
- 'image'=> IMAGE_LOCATION . 'smile3.jpg',
- 'link'=>'http://www.facebook.com',
- 'description'=>'Yeah. whatever'))),
- array('field'=> 'Bad',
- 'items'=>
- array(array('label'=> 'Evil',
- 'link'=>'http://www.evil.com'))));
+ array(
+ 'field' => '<fb:intl desc="Header for list of pleasant smilies">Good Smilies</fb:intl>',
+ 'items' =>
+ array(
+ array(
+ 'label'=> '<fb:intl desc="Mood name for \':)\'">Happy</fb:intl>',
+ 'image' => IMAGE_LOCATION . 'smile0.jpg',
+ 'sublabel'=>'',
+ 'description'=>'<fb:intl desc="Mood description for \':)\'">The original and still undefeated.</fb:intl>',
+ 'link'=>'http://www.facebook.com'),
+ array(
+ 'label'=>'<fb:intl desc="Mood name for \':|\'">Indifferent</fb:intl>',
+ 'image'=> IMAGE_LOCATION . 'smile1.jpg', 'description'=>'meh...',
+ 'link'=>'http://www.facebook.com'),
+ array(
+ 'label'=>'<fb:intl desc="Mood name for \':(\'">Sad</fb:intl>',
+ 'image'=> IMAGE_LOCATION . 'smile2.jpg',
+ 'description'=>'<fb:intl desc="Mood description for \':(\'">Oh my god! you killed my dog!</fb:intl>',
+ 'link'=>'http://www.facebook.com'),
+ array(
+ 'label'=>'<fb:intl desc="Mood name for \'B-|\'">Cool</fb:intl>',
+ 'image'=> IMAGE_LOCATION . 'smile3.jpg',
+ 'link'=>'http://www.facebook.com',
+ 'description'=>'<fb:intl desc="Mood description for \'B-|\'">Yeah. whatever</fb:intl>'))),
+ array(
+ 'field'=> '<fb:intl desc="Header for list of unpleasant smilies">Bad</fb:intl>',
+ 'items'=>
+ array(
+ array(
+ 'label'=> '<fb:intl desc="Mood name for \'&gt;:|\'">Evil</fb:intl>',
+ 'link'=>'http://www.evil.com'))));
}
function get_user_profile_box($mood) {
@@ -105,8 +114,8 @@ function get_user_profile_box($mood) {
}
</style>
- <h2>We are pleased to announce that <fb:name useyou="false" uid="profileowner" /> is feeling:</h2>
+ <h2><fb:intl>We are pleased to announce that <fb:name useyou="false" uid="profileowner" /> is feeling:</fb:intl></h2>
<div class="smile"><div class="smiley">'.$mood[1].'</div><div >'.$mood[0].'</div></div>
- <br /><p><a href="http://apps.facebook.com/mysmiley/" requirelogin=1>Visit Smiley</a></p>';
+ <br /><p><a href="http://apps.facebook.com/mysmiley/" requirelogin=1><fb:intl desc="Link to Smiley application">Visit Smiley</fb:intl></a></p>';
}
@@ -27,15 +27,19 @@
echo '<div style="text-align: center">';
-$pos_name = '<fb:name firstnameonly="true" useyou="false" possessive="true" linked="false" uid="'.$user.'"/>';
echo '<h2>'
- . $pos_name.' Smilies'
+ . '<fb:intl desc="Page header for list of someone\'s smilies">'
+ . '<fb:name firstnameonly="true" useyou="false" possessive="true" '
+ . 'linked="false" uid="'.$user.'"/>'
+ . ' Smilies'
+ . '</fb:intl>'
. '</h2>';
$user_name = '<fb:name useyou="false" uid="'.$fb->user.'"/>';
echo '<h3 style="padding: 7px 0px">'
- . 'We are pleased to announce that ' . $user_name
- . ' has been feeling:'
+ . '<fb:intl>'
+ . 'We are pleased to announce that ' . $user_name . ' has been feeling:'
+ . '</fb:intl>'
. '</h3>';
echo '<div style="overflow:hidden"><div class="past">';
@@ -46,12 +50,17 @@
echo '<a class="box" href="smile.php?smile='.$v.'"><div class="smiley">'
. $mood[1]
. '</div><div>'
- . $mood[0]
+ . '<fb:intl desc="Mood name for \'' . $mood[1] . '\'">'
+ . $mood[0]
+ . '</fb:intl>'
. '</div></a>';
}
echo '</div></div>';
if (isset($_POST['is_tab'])) {
- echo '<br><a href="http://apps.facebook.com/'.APP_SUFFIX.'" >Check out Smiley</a>';
+ echo '<br/>'
+ . '<a href="http://apps.facebook.com/'.APP_SUFFIX.'" >'
+ . '<fb:intl desc="Link to the Smiley application">Check out Smiley</fb:intl>'
+ . '</a>';
}
echo '</div>';
Oops, something went wrong.

0 comments on commit a9ce141

Please sign in to comment.