]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/action.php
Fix localization for license notice in page footer (for ticket #2274: i18n cleanup)
[quix0rs-gnu-social.git] / lib / action.php
index e2427755852120fa61d1b5b8cb6576b1170dba49..0fc3a0dc435cd537bd647e2468ee3fcda13335a5 100644 (file)
@@ -198,8 +198,7 @@ class Action extends HTMLOutputter // lawsuit
 
             if (Event::handle('StartShowStatusNetStyles', array($this)) &&
                 Event::handle('StartShowLaconicaStyles', array($this))) {
-                $this->cssLink('css/display.css',null,'screen, projection, tv');
-                $this->cssLink('css/print.css','base','print');
+                $this->cssLink('css/display.css',null, 'screen, projection, tv, print');
                 Event::handle('EndShowStatusNetStyles', array($this));
                 Event::handle('EndShowLaconicaStyles', array($this));
             }
@@ -246,21 +245,20 @@ class Action extends HTMLOutputter // lawsuit
     {
         if (Event::handle('StartShowScripts', array($this))) {
             if (Event::handle('StartShowJQueryScripts', array($this))) {
-                $this->script('js/jquery.min.js');
-                $this->script('js/jquery.form.js');
-                $this->script('js/jquery.cookie.js');
-                $this->script('js/json2.js');
-                $this->script('js/jquery.joverlay.min.js');
+                $this->script('jquery.min.js');
+                $this->script('jquery.form.js');
+                $this->script('jquery.cookie.js');
+                $this->inlineScript('if (typeof window.JSON !== "object") { $.getScript("'.common_path('js/json2.js').'"); }');
+                $this->script('jquery.joverlay.min.js');
                 Event::handle('EndShowJQueryScripts', array($this));
             }
             if (Event::handle('StartShowStatusNetScripts', array($this)) &&
                 Event::handle('StartShowLaconicaScripts', array($this))) {
-                $this->script('js/xbImportNode.js');
-                $this->script('js/util.js');
-                $this->script('js/geometa.js');
+                $this->script('xbImportNode.js');
+                $this->script('util.js');
+                $this->script('geometa.js');
                 // Frame-busting code to avoid clickjacking attacks.
-                $this->element('script', array('type' => 'text/javascript'),
-                               'if (window.top !== window.self) { window.top.location.href = window.self.location.href; }');
+                $this->inlineScript('if (window.top !== window.self) { window.top.location.href = window.self.location.href; }');
                 Event::handle('EndShowStatusNetScripts', array($this));
                 Event::handle('EndShowLaconicaScripts', array($this));
             }
@@ -392,13 +390,20 @@ class Action extends HTMLOutputter // lawsuit
         $this->elementStart('address', array('id' => 'site_contact',
                                              'class' => 'vcard'));
         if (Event::handle('StartAddressData', array($this))) {
+            if (common_config('singleuser', 'enabled')) {
+                $url = common_local_url('showstream',
+                                        array('nickname' => common_config('singleuser', 'nickname')));
+            } else {
+                $url = common_local_url('public');
+            }
             $this->elementStart('a', array('class' => 'url home bookmark',
-                                           'href' => common_local_url('public')));
+                                           'href' => $url));
             if (common_config('site', 'logo') || file_exists(Theme::file('logo.png'))) {
                 $this->element('img', array('class' => 'logo photo',
                                             'src' => (common_config('site', 'logo')) ? common_config('site', 'logo') : Theme::path('logo.png'),
                                             'alt' => common_config('site', 'name')));
             }
+            $this->text(' ');
             $this->element('span', array('class' => 'fn org'), common_config('site', 'name'));
             $this->elementEnd('a');
             Event::handle('EndAddressData', array($this));
@@ -414,56 +419,75 @@ class Action extends HTMLOutputter // lawsuit
     function showPrimaryNav()
     {
         $user = common_current_user();
-        $connect = '';
-        if (common_config('xmpp', 'enabled')) {
-            $connect = 'imsettings';
-        } else if (common_config('sms', 'enabled')) {
-            $connect = 'smssettings';
-        } else if (common_config('twitter', 'enabled')) {
-            $connect = 'twittersettings';
-        }
-
         $this->elementStart('dl', array('id' => 'site_nav_global_primary'));
         $this->element('dt', null, _('Primary site navigation'));
         $this->elementStart('dd');
         $this->elementStart('ul', array('class' => 'nav'));
         if (Event::handle('StartPrimaryNav', array($this))) {
             if ($user) {
+                // TRANS: Tooltip for main menu option "Personal"
+                $tooltip = _m('TOOLTIP', 'Personal profile and friends timeline');
+                // TRANS: Main menu option when logged in for access to personal profile and friends timeline
                 $this->menuItem(common_local_url('all', array('nickname' => $user->nickname)),
-                                _('Home'), _('Personal profile and friends timeline'), false, 'nav_home');
+                                _m('MENU', 'Personal'), $tooltip, false, 'nav_home');
+                // TRANS: Tooltip for main menu option "Account"
+                $tooltip = _m('TOOLTIP', 'Change your email, avatar, password, profile');
+                // TRANS: Main menu option when logged in for access to user settings
                 $this->menuItem(common_local_url('profilesettings'),
-                                _('Account'), _('Change your email, avatar, password, profile'), false, 'nav_account');
-                if ($connect) {
-                    $this->menuItem(common_local_url($connect),
-                                    _('Connect'), _('Connect to services'), false, 'nav_connect');
-                }
+                                _('Account'), $tooltip, false, 'nav_account');
+                // TRANS: Tooltip for main menu option "Services"
+                $tooltip = _m('TOOLTIP', 'Connect to services');
+                // TRANS: Main menu option when logged in and connection are possible for access to options to connect to other services
+                $this->menuItem(common_local_url('oauthconnectionssettings'),
+                                _('Connect'), $tooltip, false, 'nav_connect');
                 if ($user->hasRight(Right::CONFIGURESITE)) {
+                    // TRANS: Tooltip for menu option "Admin"
+                    $tooltip = _m('TOOLTIP', 'Change site configuration');
+                    // TRANS: Main menu option when logged in and site admin for access to site configuration
                     $this->menuItem(common_local_url('siteadminpanel'),
-                                    _('Admin'), _('Change site configuration'), false, 'nav_admin');
+                                    _m('MENU', 'Admin'), $tooltip, false, 'nav_admin');
                 }
                 if (common_config('invite', 'enabled')) {
+                    // TRANS: Tooltip for main menu option "Invite"
+                    $tooltip = _m('TOOLTIP', 'Invite friends and colleagues to join you on %s');
+                    // TRANS: Main menu option when logged in and invitations are allowed for inviting new users
                     $this->menuItem(common_local_url('invite'),
-                                    _('Invite'),
-                                    sprintf(_('Invite friends and colleagues to join you on %s'),
+                                    _m('MENU', 'Invite'),
+                                    sprintf($tooltip,
                                             common_config('site', 'name')),
                                     false, 'nav_invitecontact');
                 }
+                // TRANS: Tooltip for main menu option "Logout"
+                $tooltip = _m('TOOLTIP', 'Logout from the site');
+                // TRANS: Main menu option when logged in to log out the current user
                 $this->menuItem(common_local_url('logout'),
-                                _('Logout'), _('Logout from the site'), false, 'nav_logout');
+                                _m('MENU', 'Logout'), $tooltip, false, 'nav_logout');
             }
             else {
                 if (!common_config('site', 'closed')) {
+                    // TRANS: Tooltip for main menu option "Register"
+                    $tooltip = _m('TOOLTIP', 'Create an account');
+                    // TRANS: Main menu option when not logged in to register a new account
                     $this->menuItem(common_local_url('register'),
-                                    _('Register'), _('Create an account'), false, 'nav_register');
+                                    _m('MENU', 'Register'), $tooltip, false, 'nav_register');
                 }
+                // TRANS: Tooltip for main menu option "Login"
+                $tooltip = _m('TOOLTIP', 'Login to the site');
+                // TRANS: Main menu option when not logged in to log in
                 $this->menuItem(common_local_url('login'),
-                                _('Login'), _('Login to the site'), false, 'nav_login');
+                                _m('MENU', 'Login'), $tooltip, false, 'nav_login');
             }
+            // TRANS: Tooltip for main menu option "Help"
+            $tooltip = _m('TOOLTIP', 'Help me!');
+            // TRANS: Main menu option for help on the StatusNet site
             $this->menuItem(common_local_url('doc', array('title' => 'help')),
-                            _('Help'), _('Help me!'), false, 'nav_help');
+                            _m('MENU', 'Help'), $tooltip, false, 'nav_help');
             if ($user || !common_config('site', 'private')) {
+                // TRANS: Tooltip for main menu option "Search"
+                $tooltip = _m('TOOLTIP', 'Search for people or text');
+                // TRANS: Main menu option when logged in or when the StatusNet instance is not private
                 $this->menuItem(common_local_url('peoplesearch'),
-                                _('Search'), _('Search for people or text'), false, 'nav_search');
+                                _m('MENU', 'Search'), $tooltip, false, 'nav_search');
             }
             Event::handle('EndPrimaryNav', array($this));
         }
@@ -484,6 +508,7 @@ class Action extends HTMLOutputter // lawsuit
         if ($text) {
             $this->elementStart('dl', array('id' => 'site_notice',
                                             'class' => 'system_notice'));
+            // TRANS: DT element for site notice. String is hidden in default CSS.
             $this->element('dt', null, _('Site notice'));
             $this->elementStart('dd', null);
             $this->raw($text);
@@ -772,11 +797,14 @@ class Action extends HTMLOutputter // lawsuit
     {
         $this->element('dt', array('id' => 'site_statusnet_license'), _('StatusNet software license'));
         $this->elementStart('dd', null);
+        // @fixme drop the final spaces in the messages when at good spot
+        // to let translations get updated.
         if (common_config('site', 'broughtby')) {
             $instr = _('**%%site.name%%** is a microblogging service brought to you by [%%site.broughtby%%](%%site.broughtbyurl%%). ');
         } else {
             $instr = _('**%%site.name%%** is a microblogging service. ');
         }
+        $instr .= ' ';
         $instr .= sprintf(_('It runs the [StatusNet](http://status.net/) microblogging software, version %s, available under the [GNU Affero General Public License](http://www.fsf.org/licensing/licenses/agpl-3.0.html).'), STATUSNET_VERSION);
         $output = common_markup_to_html($instr);
         $this->raw($output);
@@ -816,13 +844,17 @@ class Action extends HTMLOutputter // lawsuit
                                             'alt' => common_config('license', 'title'),
                                             'width' => '80',
                                             'height' => '15'));
-                //TODO: This is dirty: i18n
-                $this->text(_('All '.common_config('site', 'name').' content and data are available under the '));
-                $this->element('a', array('class' => 'license',
-                                          'rel' => 'external license',
-                                          'href' => common_config('license', 'url')),
-                               common_config('license', 'title'));
-                $this->text(_('license.'));
+                $this->text(' ');
+                // TRANS: license message in footer. %1$s is the site name, %2$s is a link to the license URL, with a licence name set in configuration.
+                $notice = _('All %1$s content and data are available under the %2$s license.');
+                $link = "<a class=\"license\" rel=\"external license\" href=\"" .
+                        htmlspecialchars(common_config('license', 'url')) .
+                        "\">" .
+                        htmlspecialchars(common_config('license', 'title')) .
+                        "</a>";
+                $this->raw(sprintf(htmlspecialchars($notice),
+                                   htmlspecialchars(common_config('site', 'name')),
+                                   $link));
                 $this->elementEnd('p');
                 break;
             }
@@ -968,7 +1000,7 @@ class Action extends HTMLOutputter // lawsuit
 
         if (is_null($arg)) {
             return $def;
-        } else if (in_array($arg, array('true', 'yes', '1'))) {
+        } else if (in_array($arg, array('true', 'yes', '1', 'on'))) {
             return true;
         } else if (in_array($arg, array('false', 'no', '0'))) {
             return false;