Ticket #3404 (closed Bugs: fixed)

Opened 5 years ago

Last modified 5 years ago

Dashboard issue

Reported by: chocho Assigned to:
Priority: minor Milestone: 2.6
Component: System Dashboard Version: 2.5-branch
Keywords: Cc:
Confirmation: Need testing Distro:
Backend Engine: All Distro Ver:
Backend Ver: SVN Revision (if applicable):

Description

Hi,
On dashboard and more specify on uptime window, times are translated on first line, but no to others. I can't figure out the reason for this.
I'll attach screenshot with that.

Attachments

dashboard_uptime.JPG (18.1 kB) - added by chocho on 11/16/08 13:45:31.
dashboard_uptime-2.JPG (17.0 kB) - added by chocho on 11/16/08 15:28:48.

Change History

11/16/08 13:45:31 changed by chocho

  • attachment dashboard_uptime.JPG added.

11/16/08 14:55:27 changed by p_lindheimer

  • confirmation changed from Unreviewed to Need testing.

have a try at this. The issue is that the string is coming directly from Asterisk so the translation will take some extra push-ups:

Index: class.astinfo.php
===================================================================
--- class.astinfo.php   (revision 7278)
+++ class.astinfo.php   (working copy)
@@ -214,12 +214,40 @@
                        $response = $this->astman->send_request('Command',array('Command'=>"show uptime"));
                }
                $astout = explode("\n",$response['data']);
-
+
+
+               if ($_COOKIE['lang'] == "en_US") {
+                       $translate = false;
+               } else {
+                       $translate = true;
+                       $units = array(
+                               '/second/', '/seconds/',
+                               '/minute/', '/minutes/',
+                               '/hour/', '/hours/',
+                               '/day/', '/days/',
+                               '/week/', '/weeks/',
+                               '/year/', '/years/',
+                       );
+                       $tunits = array(
+                               _('second'), _('seconds'),
+                               _('minute'), _('minutes'),
+                               _('hour'), _('hours'),
+                               _('day'), _('days'),
+                               _('week'), _('weeks'),
+                               _('year'), _('years'),
+                       );
+               }
                foreach ($astout as $line) {
                        if (preg_match('/^System uptime: (.*)$/i',$line,$matches)) {
                                $output["system"] = preg_replace('/,\s+(\d+ seconds?)?\s*$/', '', $matches[1]);
+                               if ($translate) {
+                                       $output["system"] = preg_replace($units,$tunits,$output["system"]);
+                               }
                        } else if (preg_match('/^Last reload: (.*)$/i',$line,$matches)) {
                                $output["reload"] = preg_replace('/,\s+(\d+ seconds?)?\s*$/', '', $matches[1]);
+                               if ($translate) {
+                                       $output["reload"] = preg_replace($units,$tunits,$output["reload"]);
+                               }
                        }
                }
 

11/16/08 14:59:09 changed by p_lindheimer

  • status changed from new to closed.
  • resolution set to fixed.

(In [7280]) fixes #3404 jump through hoops to translate strings coming from Asterisk

11/16/08 15:28:27 changed by chocho

There is some progres.
But it translate in (I'm not sure what is the word, sorry) one hour for hours and add 's' after that.
Unless I'm doing something wrong.
I'll attach new screenshot.

11/16/08 15:28:48 changed by chocho

  • attachment dashboard_uptime-2.JPG added.

11/16/08 16:01:40 changed by p_lindheimer

(In [7286]) Merged revisions 7273-7285 via svnmerge from http://svn.freepbx.org/modules/branches/2.5

........

r7279 | p_lindheimer | 2008-11-16 09:37:21 -0800 (Sun, 16 Nov 2008) | 1 line

fixes #3401 introduced from ref #3368

........

r7280 | p_lindheimer | 2008-11-16 11:59:09 -0800 (Sun, 16 Nov 2008) | 1 line

fixes #3404 jump through hoops to translate strings coming from Asterisk

........

r7281 | p_lindheimer | 2008-11-16 12:06:58 -0800 (Sun, 16 Nov 2008) | 1 line

fixes #3400 make sure no duplicates in queue memebers

........

r7284 | p_lindheimer | 2008-11-16 12:51:03 -0800 (Sun, 16 Nov 2008) | 1 line

Module Publish Script: queues 2.5.4.5

........

r7285 | p_lindheimer | 2008-11-16 12:52:25 -0800 (Sun, 16 Nov 2008) | 1 line

Module Publish Script: dashboard 2.5.0.4

........

11/16/08 16:21:25 changed by chocho

Also for 1 minute is right and without this 's'.

11/17/08 02:37:00 changed by chocho

Wow, now all is OK. Thank you for your great work Philippe !