Results 1 to 4 of 4

Thread: Note to those creating language packs.

  1. #1
    sadek's Avatar
    sadek is offline Sugar Team Member
    Join Date
    Sep 2005
    Posts
    244

    Default Array conversion tool & note to those creating language packs

    I have debugged a few issues with modules that were loaded via the module loader (specifically the Forums module) concurrently with a language pack, and all these issues ended up being caused by the same thing.

    When defining language files, it seems that a lot of individuals are defining them as arrays, just like we have them defined in our application. For example, <sugarroot>/include/language/<your_lang>.lang.php, this is what it may look like.

    Code:
      'moduleList' => array (
         'Home' => 'Accueil' ,
         'Dashboard' => 'Tableaux de bord' ,
         'Contacts' => 'Contacts' ,
         'Accounts' => 'Comptes' ,
         'Opportunities' => 'Affaires' ,
         'Cases' => 'Tickets' ,
         'Notes' => 'Notes' ,
         'Calls' => 'Appels' ,
         'Emails' => 'Emails' ,
         'Meetings' => 'Réunions' ,
         'Tasks' => 'Tâches' ,
         'Calendar' => 'Calendrier' ,
         'Leads' => 'Leads' ,
         'Quotes' => 'Devis' ,
         'Products' => 'Produits' ,
         'Reports' => 'Rapports' ,
         'Forecasts' => 'Prévisions' ,
          'ForecastSchedule'=>'Planification Prévision',
          'MergeRecords'=>'Fusionner Enregistrements',
         'Quotas' => 'Objectifs',
         'Teams' => 'Equipes' ,
         'Activities' => 'Activités' ,
         'Bugs' => 'Suivi Bugs' ,
         'Feeds' => 'Flux RSS' ,
         'iFrames' => 'Mon Portail' ,
         'TimePeriods' => 'Périodes' ,
         'Project' => 'Projets' ,
         'ProjectTask' => 'Tâches Projet' ,
         'Campaigns' => 'Campagnes' ,
         'Documents' => 'Documents' ,
         'Sync' => 'Sync' ,
         'ReportMaker' => 'SweetReports' ,
         'WorkFlow' => 'Work Flow' ,
         'Users' => 'Utilisateurs' ,
         'Releases' => 'Releases' ,
         'Prospects' => 'Prospects' ,
         'Queues' => 'Queues' ,
         'EmailMarketing' => 'Email Marketing' ,
         'EmailTemplates' => 'Email Modèles' ,
         'ProspectLists' => 'Listes des Prospects' ,
         'SavedSearch' => 'Recherches Sauvegardées',
         'Contracts' => 'Contrats'   ),
    The problem with this is that it overrides the entire stock array, so if there are any additional array indexes, they are no longer a part of the array.

    For example, when you load the Forums module, it adds the line below:
    Code:
         'Forums' => 'Forums',
    To avoid overriding this, and all the other custom array indexes, I'd suggest defining them as follows:
    Code:
    $app_list_strings['moduleList']['Home'] = 'Accueil';
    $app_list_strings['moduleList']['Dashboard'] = 'Tableaux de bord';
    $app_list_strings['moduleList']['Contacts'] = ''Contacts'';
    ...
    ...
    $app_list_strings['moduleList']['Contracts'] = ''Contrats";
    If anyone sees any reason why all arrays should not be defined as shown above, please feel free to let me know.

    I've attached a script that will convert all array definitions from the first illustrated format to the second. Please place it in your webroot, access the script, type in the path to the language pack file, and execute!

    Thanks,
    -Sadek
    Attached Files Attached Files
    Last edited by sadek; 2006-09-26 at 11:55 PM. Reason: title not completely appropriate - changing

  2. #2
    aserrano is offline Sugar Community Member
    Join Date
    Nov 2004
    Location
    Alicante, Spain
    Posts
    57

    Default Re: Note to those creating language packs.

    Hello Sadek,

    I know I should have asked these questions before, but… better late than never:
    1. Does sugar load en_us locale strings no matter which language is selected for the active locale?
    2. If 1) is true, then, does your proposal allow for default en_us locale strings to be used like fallback strings for untranslated strings in the active locale?

    Best regards,
    Alberto.

  3. #3
    lobanw is offline Member
    Join Date
    Apr 2011
    Posts
    7

    Default Re: Note to those creating language packs.

    Just wanted to say thanks for your post because I am a new language pack developer and was running into the same issues as you were. Luckily there are true users that share information once they come across the problem! Thanks so much!

  4. #4
    Partho is offline Junior Member
    Join Date
    Feb 2007
    Posts
    11

    Default Re: Note to those creating language packs.

    Thanks to share with us

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •