]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Merge branch '0.9.x' into twitstream
authorBrion Vibber <brion@pobox.com>
Tue, 2 Nov 2010 22:10:56 +0000 (15:10 -0700)
committerBrion Vibber <brion@pobox.com>
Tue, 2 Nov 2010 22:10:56 +0000 (15:10 -0700)
actions/newgroup.php
actions/showstream.php
classes/Profile.php
js/util.js
lib/action.php
plugins/OStatus/classes/Ostatus_profile.php
plugins/Realtime/README
plugins/Realtime/RealtimePlugin.php
plugins/Realtime/locale/Realtime.pot [new file with mode: 0644]
plugins/Realtime/realtimeupdate.css
plugins/Realtime/realtimeupdate.js

index 9c1870b1c626177dff58fb3d5687a638e060bbc4..e0e7978c32ebb430d07972e96b00cfa204e30128 100644 (file)
@@ -151,7 +151,7 @@ class NewgroupAction extends Action
             // TRANS: %d is the maximum number of allowed characters.
             $this->showForm(sprintf(_m('Description is too long (maximum %d character).',
                                        'Description is too long (maximum %d characters).',
-                                       User_group::maxDescription(),
+                                       User_group::maxDescription()),
                                     User_group::maxDescription()));
             return;
         } else if (!is_null($location) && mb_strlen($location) > 255) {
index fb5b061fbe3031ef725aeb23710c9e22c2800bab..dd6c91b00481cdb7f5c907887d5b984bd7fa6f40 100644 (file)
@@ -63,21 +63,24 @@ class ShowstreamAction extends ProfileAction
 
     function title()
     {
-        if (!empty($this->profile->fullname)) {
-            $base = $this->profile->fullname . ' (' . $this->user->nickname . ') ';
-        } else {
-            $base = $this->user->nickname;
-        }
+        $base = $this->profile->getFancyName();
         if (!empty($this->tag)) {
-            $base .= sprintf(_(' tagged %s'), $this->tag);
-        }
-
-        if ($this->page == 1) {
-            return $base;
+            if ($this->page == 1) {
+                // TRANS: Page title showing tagged notices in one user's stream. Param 1 is the username, 2 is the hash tag.
+                return sprintf(_('%1$s tagged %2$s'), $base, $this->tag);
+            } else {
+                // TRANS: Page title showing tagged notices in one user's stream. Param 1 is the username, 2 is the hash tag, 3 is the page number.
+                return sprintf(_('%1$s tagged %2$s, page %3$d'), $base, $this->tag, $this->page);
+            }
         } else {
-            return sprintf(_('%1$s, page %2$d'),
-                           $base,
-                           $this->page);
+            if ($this->page == 1) {
+                return $base;
+            } else {
+                // TRANS: Extended page title showing tagged notices in one user's stream. Param 1 is the username, param 2 is the page number.
+                return sprintf(_('%1$s, page %2$d'),
+                               $base,
+                               $this->page);
+            }
         }
     }
 
index 37d2c571f9391a265666aa4417bfcba3fb9fd766..064ba551c4bf6de46047989e3b7a3cad8dba1a70 100644 (file)
@@ -141,11 +141,32 @@ class Profile extends Memcached_DataObject
         return true;
     }
 
+    /**
+     * Gets either the full name (if filled) or the nickname.
+     *
+     * @return string
+     */
     function getBestName()
     {
         return ($this->fullname) ? $this->fullname : $this->nickname;
     }
 
+    /**
+     * Gets the full name (if filled) with nickname as a parenthetical, or the nickname alone
+     * if no fullname is provided.
+     *
+     * @return string
+     */
+    function getFancyName()
+    {
+        if ($this->fullname) {
+            // TRANS: Full name of a profile or group followed by nickname in parens
+            return sprintf(_('%1$s (%2$s)'), $this->fullname, $this->nickname);
+        } else {
+            return $this->nickname;
+        }
+    }
+
     /**
      * Get the most recent notice posted by this user, if any.
      *
index 1989e92c099ea050c7edcf3e50e1f22c8297eff1..1be3f305355ae36a753b1adfc0884d068dce39bb 100644 (file)
@@ -56,6 +56,15 @@ var SN = { // StatusNet
             NoticeDataGeoCookie: 'NoticeDataGeo',
             NoticeDataGeoSelected: 'notice_data-geo_selected',
             StatusNetInstance:'StatusNetInstance'
+        },
+    },
+
+    messages: {},
+    msg: function(key) {
+        if (typeof SN.messages[key] == "undefined") {
+            return '[' + key + ']';
+        } else {
+            return SN.messages[key];
         }
     },
 
@@ -416,7 +425,7 @@ var SN = { // StatusNet
                     });
 
                     return false;
-                });
+                }).attr('title', SN.msg('showmore_tooltip'));
             }
             else {
                 $.fn.jOverlay.options = {
index 01bb0f7e92bebe78bc50ae7eb7afad4f43bbc412..766cfca2699aa0b390dfb31de4ef66f748e59c88 100644 (file)
@@ -283,6 +283,7 @@ class Action extends HTMLOutputter // lawsuit
             if (Event::handle('StartShowStatusNetScripts', array($this)) &&
                 Event::handle('StartShowLaconicaScripts', array($this))) {
                 $this->script('util.js');
+                $this->showScriptMessages();
                 // Frame-busting code to avoid clickjacking attacks.
                 $this->inlineScript('if (window.top !== window.self) { window.top.location.href = window.self.location.href; }');
                 Event::handle('EndShowStatusNetScripts', array($this));
@@ -292,6 +293,54 @@ class Action extends HTMLOutputter // lawsuit
         }
     }
 
+    /**
+     * Exports a map of localized text strings to JavaScript code.
+     *
+     * Plugins can add to what's exported by hooking the StartScriptMessages or EndScriptMessages
+     * events and appending to the array. Try to avoid adding strings that won't be used, as
+     * they'll be added to HTML output.
+     */
+    function showScriptMessages()
+    {
+        $messages = array();
+        if (Event::handle('StartScriptMessages', array($this, &$messages))) {
+            // Common messages needed for timeline views etc...
+
+            // TRANS: Localized tooltip for '...' expansion button on overlong remote messages.
+            $messages['showmore_tooltip'] = _m('TOOLTIP', 'Show more');
+
+            $messages = array_merge($messages, $this->getScriptMessages());
+        }
+        Event::handle('EndScriptMessages', array($this, &$messages));
+        if ($messages) {
+            $this->inlineScript('SN.messages=' . json_encode($messages));
+        }
+        return $messages;
+    }
+
+    /**
+     * If the action will need localizable text strings, export them here like so:
+     *
+     * return array('pool_deepend' => _('Deep end'),
+     *              'pool_shallow' => _('Shallow end'));
+     *
+     * The exported map will be available via SN.msg() to JS code:
+     *
+     *   $('#pool').html('<div class="deepend"></div><div class="shallow"></div>');
+     *   $('#pool .deepend').text(SN.msg('pool_deepend'));
+     *   $('#pool .shallow').text(SN.msg('pool_shallow'));
+     *
+     * Exports a map of localized text strings to JavaScript code.
+     *
+     * Plugins can add to what's exported on any action by hooking the StartScriptMessages or
+     * EndScriptMessages events and appending to the array. Try to avoid adding strings that won't
+     * be used, as they'll be added to HTML output.
+     */
+    function getScriptMessages()
+    {
+        return array();
+    }
+
     /**
      * Show OpenSearch headers
      *
index 03fcb71df02a16b79d7f9be365dabd476c2718e8..90bf671eb1d5f7c160532f387420ae95e8555059 100644 (file)
@@ -588,7 +588,8 @@ class Ostatus_profile extends Memcached_DataObject
                 // We mark up the attachment link specially for the HTML output
                 // so we can fold-out the full version inline.
 
-                // TRANS: Shown when a notice is longer than supported and/or when attachments are present.
+                // @fixme I18N this tooltip will be saved with the site's default language
+                // TRANS: Shown when a notice is longer than supported and/or when attachments are present. At runtime this will usually be replaced with localized text from StatusNet core messages.
                 $showMoreText = _m('Show more');
                 $attachUrl = common_local_url('attachment',
                                               array('attachment' => $attachment->id));
index 99c79cfab541d8b5b5e2076321d6c8f35eb90883..9b36d87f3795b8c27084b10e2020274f40059a5b 100644 (file)
@@ -5,6 +5,6 @@
 * Pause ~ retain up to 50-100 most recent notices
 * Add geo data
 * Make it work for Conversation page (perhaps a little tricky)
-* IE is updating the counter in document title all the time (Not sure if this is still an issue)
+* IE is updating the counter in document title all the time (Not sure if this
+  is still an issue)
 * Reconsider the timestamp approach
-
index 352afcf7853ff4a76eb3fb858954ebc22f3bcfa4..99d1ff9c102d161be154e2a2cd2b88c07ebd81cb 100644 (file)
@@ -43,7 +43,6 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
  * @license  http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  * @link     http://status.net/
  */
-
 class RealtimePlugin extends Plugin
 {
     protected $replyurl = null;
@@ -326,6 +325,32 @@ class RealtimePlugin extends Plugin
         return array('plugins/Realtime/realtimeupdate.js');
     }
 
+    /**
+     * Export any i18n messages that need to be loaded at runtime...
+     *
+     * @param Action $action
+     * @param array $messages
+     *
+     * @return boolean hook return value
+     */
+    function onEndScriptMessages($action, &$messages)
+    {
+        // TRANS: Text label for realtime view "play" button, usually replaced by an icon.
+        $messages['realtime_play'] = _m('BUTTON', 'Play');
+        // TRANS: Tooltip for realtime view "play" button.
+        $messages['realtime_play_tooltip'] = _m('TOOLTIP', 'Play');
+        // TRANS: Text label for realtime view "pause" button
+        $messages['realtime_pause'] = _m('BUTTON', 'Pause');
+        // TRANS: Tooltip for realtime view "pause" button
+        $messages['realtime_pause_tooltip'] = _m('TOOLTIP', 'Pause');
+        // TRANS: Text label for realtime view "popup" button, usually replaced by an icon.
+        $messages['realtime_popup'] = _m('BUTTON', 'Pop up');
+        // TRANS: Tooltip for realtime view "popup" button.
+        $messages['realtime_popup_tooltip'] = _m('TOOLTIP', 'Pop up in a window');
+
+        return true;
+    }
+
     function _updateInitialize($timeline, $user_id)
     {
         return "RealtimeUpdate.init($user_id, \"$this->replyurl\", \"$this->favorurl\", \"$this->repeaturl\", \"$this->deleteurl\"); ";
diff --git a/plugins/Realtime/locale/Realtime.pot b/plugins/Realtime/locale/Realtime.pot
new file mode 100644 (file)
index 0000000..e491ce0
--- /dev/null
@@ -0,0 +1,53 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2010-11-02 19:46+0000\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. TRANS: Text label for realtime view "play" button, usually replaced by an icon.
+#: RealtimePlugin.php:339
+msgctxt "BUTTON"
+msgid "Play"
+msgstr ""
+
+#. TRANS: Tooltip for realtime view "play" button.
+#: RealtimePlugin.php:341
+msgctxt "TOOLTIP"
+msgid "Play"
+msgstr ""
+
+#. TRANS: Text label for realtime view "pause" button
+#: RealtimePlugin.php:343
+msgctxt "BUTTON"
+msgid "Pause"
+msgstr ""
+
+#. TRANS: Tooltip for realtime view "pause" button
+#: RealtimePlugin.php:345
+msgctxt "TOOLTIP"
+msgid "Pause"
+msgstr ""
+
+#. TRANS: Text label for realtime view "popup" button, usually replaced by an icon.
+#: RealtimePlugin.php:347
+msgctxt "BUTTON"
+msgid "Pop up"
+msgstr ""
+
+#. TRANS: Tooltip for realtime view "popup" button.
+#: RealtimePlugin.php:349
+msgctxt "TOOLTIP"
+msgid "Pop up in a window"
+msgstr ""
index f43c97de52e71bb8053b18ffaf38ed70899a6e9b..b277b30a14e74369314bf2c4cead9d5c53fb4cfb 100644 (file)
@@ -35,7 +35,6 @@ width:70%;
 margin-left:1%;
 }
 
-
 #notices_primary {
 position:relative;
 }
@@ -75,4 +74,3 @@ line-height:1.2;
 #showstream #notices_primary {
 margin-top: 18px;
 }
-
index 25dc12d584617adc11eae223a6de2e17962696a4..f49cef95e6c50334cedbba8100289f108ad30e6d 100644 (file)
@@ -261,9 +261,10 @@ RealtimeUpdate = {
         RealtimeUpdate.addNoticesHover();
 
         $('#realtime_playpause').remove();
-        $('#realtime_actions').prepend('<li id="realtime_playpause"><button id="realtime_pause" class="pause" title="Pause">Pause</button></li>');
-
-        $('#realtime_pause').bind('click', function() {
+        $('#realtime_actions').prepend('<li id="realtime_playpause"><button id="realtime_pause" class="pause"></button></li>');
+        $('#realtime_pause').text(SN.msg('realtime_pause'))
+                            .attr('title', SN.msg('realtime_pause_tooltip'))
+                            .bind('click', function() {
             RealtimeUpdate.removeNoticesHover();
             RealtimeUpdate.showPlay();
             return false;
@@ -274,9 +275,10 @@ RealtimeUpdate = {
      {
         RealtimeUpdate.setPause(true);
         $('#realtime_playpause').remove();
-        $('#realtime_actions').prepend('<li id="realtime_playpause"><span id="queued_counter"></span> <button id="realtime_play" class="play" title="Play">Play</button></li>');
-
-        $('#realtime_play').bind('click', function() {
+        $('#realtime_actions').prepend('<li id="realtime_playpause"><span id="queued_counter"></span> <button id="realtime_play" class="play"></button></li>');
+        $('#realtime_play').text(SN.msg('realtime_play'))
+                           .attr('title', SN.msg('realtime_play_tooltip'))
+                           .bind('click', function() {
             RealtimeUpdate.showPause();
             return false;
         });
@@ -334,10 +336,11 @@ RealtimeUpdate = {
 
      initAddPopup: function(url, timeline, path)
      {
-         $('#realtime_timeline').append('<button id="realtime_popup" title="Pop up in a window">Pop up</button>');
-
-         $('#realtime_popup').bind('click', function() {
-             window.open(url,
+         $('#realtime_timeline').append('<button id="realtime_popup"></button>');
+         $('#realtime_popup').text(SN.msg('realtime_popup'))
+                             .attr('title', SN.msg('realtime_popup_tooltip'))
+                             .bind('click', function() {
+                window.open(url,
                          '',
                          'toolbar=no,resizable=yes,scrollbars=yes,status=no,menubar=no,personalbar=no,location=no,width=500,height=550');