Uploaded image for project: 'FreePBX'
  1. FreePBX
  2. FREEPBX-3164

left nav pulls it's translations from amp.po and not the module directories

    XMLWordPrintable

    Details

      Description

      See FREEPBX-2459 for some related issues, this is a continuation regarding the left nav now that we have featurecodeadmin worked out:

      The following change appears to allow each module to provide their own translation for the left nav bar. However, languages that have their left nav translations provided in the main amp.po (the only way to do it before), but don't have it included in the module's own .po end up falling back to English. If the module does not contain any translations, then it uses the amp.po.

      So the question, do we make this move so that going forward module's can provide their own translation for the left nav bar? (The categories will still come out of amp.po since they are shared), and thus break some of the old ones?

      Here is the patch:

      {noformat}
      Index: freepbx_admin.php
      ===================================================================
      — freepbx_admin.php (revision 6538)
      +++ freepbx_admin.php (working copy)
      @@ -12,12 +12,21 @@
      $sort = Array();
      $sort_name = Array();
      $sort_type = Array();
      + $text_domain = Array();
      // Sorting menu by category and name
      foreach ($fpbx_menu as $key => $row) {
      $category[$key] = $row['category'];
      $sort[$key] = $row['sort'];
      $sort_name[$key] = $row['name'];
      $sort_type[$key] = $row['type'];
      +
      + if (extension_loaded('gettext') && is_dir("modules/".$key."/i18n")) { + bindtextdomain($key,"modules/".$text_domain."/i18n"); + bind_textdomain_codeset($key, 'utf8'); + $text_domain[$key] = true; + } else { + $text_domain[$key] = false; + }
      }

      if ($fpbx_usecategories) {
      @@ -95,9 +104,9 @@

      echo "\t<li class=\"".implode(' ',$li_classes)."\">";
      if (isset($row['disabled']) && $row['disabled']) { - echo _($row['name']); + echo $text_domain[$key] ? dgettext($key,$row['name']) : _($row['name']); } else { - echo '<a href="'.$href.'" '.$extra_attributes.' >'._($row['name'])."</a>"; + echo '<a href="'.$href.'" '.$extra_attributes.' >'. ($text_domain[$key] ? dgettext($key,$row['name']) : _($row['name'])) . "</a>"; }
      echo "</li>\n";
      }{noformat}

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                plindheimer PL
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  NextupJiraPlusStatus

                  Error rendering 'slack.nextup.jira:nextup-jira-plus-status'. Please contact your Jira administrators.