Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Language pack sync tool

  1. #1
    julian's Avatar
    julian is offline Sugar Team Member
    Join Date
    Sep 2004
    Posts
    1,639

    Default Language pack sync tool

    Hello all,

    A while back, I developed a simple tool to sync language packs when a new version of Sugar was released. The tool scans through the new (English) language files and adds any missing strings to the existing language packs. It's fairly easy to use and definitely speeds up the translation process, so I'll explain how to use it here. In this example, you'll be syncing language files to 3.5.1 from 3.5.0:

    1) Extract the new Sugar files (3.5.1) into a directory on your webserver
    2) Extract your existing language pack (3.5.0) into the 3.5.1 directory
    3) Copy sync_lang.php into the main Sugar directory (3.5.1)
    4) Open sync_lang.php and confirm that the settings are correct:

    Code:
    // Begin configuration section
    $header = "<?php
    /*********************************************************************************
     * The contents of this file are subject to the SugarCRM Professional End User
     * License Agreement (\"License\") which can be viewed at
     * http://www.sugarcrm.com/crm/products/sugar-professional-eula.html
     * By installing or using this file, You have unconditionally agreed to the
     * terms and conditions of the License, and You may not use this file except in
     * compliance with the License.  Under the terms of the license, You shall not,
     * among other things: 1) sublicense, resell, rent, lease, redistribute, assign
     * or otherwise transfer Your rights to the Software, and 2) use the Software
     * for timesharing or service bureau purposes such as hosting the Software for
     * commercial gain and/or for the benefit of a third party.  Use of the Software
     * may be subject to applicable fees and any use of the Software without first
     * paying applicable fees is strictly prohibited.  You do not have the right to
     * remove SugarCRM copyrights from the source code or user interface.
     *
     * All copies of the Covered Code must include on each user interface screen:
     *  (i) the \"Powered by SugarCRM\" logo and
     *  (ii) the SugarCRM copyright notice
     * in the same form as they appear in the distribution.  See full license for
     * requirements.
     *
     * Your Warranty, Limitations of liability and Indemnity are expressly stated
     * in the License.  Please refer to the License for the specific language
     * governing these rights and limitations under the License.  Portions created
     * by SugarCRM are Copyright (C) 2004-2005 SugarCRM, Inc.; All Rights Reserved.
     ********************************************************************************/
    
    ";
    
    $footer = "\n?>";
    
    $root_lang = "en_us.lang.php";
    
    $modules_not_to_parse = array("vCals", "CVS");
    // End configuration section
    $header contains the file header-- this will be prepended to each synced file.
    $footer contains the file footer-- this will be appended to each synced file.
    $root_lang specifies the filename of the root language-- the "new" language pack that will be used to refresh the old ones.
    $modules_not_to_parse is an array of directories in the ./modules/ directory that will not be processed by the script. It's usually safe to leave this as-is.

    5) Once you've confirmed the settings, visit http://sugar_server/your_sugar_url/sync_lang.php in your browser. The script will execute automatically.

    After the script execution is complete, your existing language files will be updated to the new version. Any missing files or strings have been replaced with their English equivalent. To test the sync, add the language pack to the system and browse through the application-- all strings should be present.

    If you guys can think of any enhancements to make, or if you encounter bugs, let me know! My e-mail address is julian@sugarcrm.com.

    Enjoy,
    Attached Files Attached Files
    Julian Ostrow
    Systems and Applications Engineer
    SugarCRM Inc.

  2. #2
    RPeters is offline Sugar Community Member
    Join Date
    Sep 2005
    Posts
    13

    Default Re: Language pack sync tool

    how about also outputting the added strings to the screen.
    This way you can immediately translate the new strings...

    i didn't test this yet so i don't know if this functionallity is already there

  3. #3
    julian's Avatar
    julian is offline Sugar Team Member
    Join Date
    Sep 2004
    Posts
    1,639

    Default Re: Language pack sync tool

    Hello RPeters,

    It's not part of the script yet, but that's a great idea. I was also considering having any new strings marked with some special character (i.e. *) in the language file itself. I'll look into both of these options and see how hard it is to add.
    Julian Ostrow
    Systems and Applications Engineer
    SugarCRM Inc.

  4. #4
    juergen is offline Sugar Community Member
    Join Date
    Apr 2005
    Posts
    338

    Default Re: Language pack sync tool

    I'd like an extraction tool for language pack files :-)

    I did not receive a manifest file for use with the upgrade wizard. Can you let me have this?

    Thanks!

    Juergen
    This space is for rent ;-)

  5. #5
    julian's Avatar
    julian is offline Sugar Team Member
    Join Date
    Sep 2004
    Posts
    1,639

    Default Re: Language pack sync tool

    Hello Juergen,

    Sure, here's an example manifest file that I sent out. Let me break down each part:

    Code:
    <?php
    // created: 2005-08-30 16:00:00
    $manifest = array (
      'acceptable_sugar_versions' =>
      array (
        'exact_matches' =>
        array (
        ),
        'regex_matches' =>
        array (
        	0 => '3\.5\.1[a-z]?'
        ),
      ),
      'acceptable_sugar_flavors' =>
      array (
        0 => 'OS',
        1 => 'PRO',
        2 => 'ENT',
      ),
      'name' => 'pt_br language pack',
      'description' => 'pt_br language pack',
      'author' => '',
      'published_date' => '2005-09-29 22:50:00',
      'version' => '3.5.1',
      'type' => 'langpack',
      'icon' => '',
      'is_uninstallable' => TRUE,
      'copy_files' =>
    	  array (
    		'from_dir' => 'pt_br_351',
    		'to_dir' => '',
    		'force_copy' =>
    			array (
    			),
    	  ),
    );
    ?>
    acceptable_sugar_versions is an array that contains two other arrays:
    exact_matches contains exact version matches, i.e. "3.5.0a"
    regex_matches contains regular expression matches, i.e. "3.5.[0-1][a-z]?" (which would match 3.5.x, basically)

    The package can only be installed on versions that match one of the patterns (or exact matches) above.

    acceptable_sugar_flavors is an array that contains which "Sugar Editions" that package can be installed on (Open Source and/or Professional and/or Enterprise).

    name is the name of the package.

    description is the description of the package, displayed during installation.

    author contains the author's name

    published_date is the date the package was released

    version is the version of the package itself

    type defines the type of package: module, patch, theme, or langpack

    icon allows you to specify a relative path in the package that contains an icon for the package (i.e. ./pt_br_351/icon.gif)

    is_uninstallable allows you to specify whether or not the package can be uninstalled through the Upgrade Wizard

    copy_files is an array that controls which files are copied from the package during installation. In this particular case, the contents of ./pt_br_351/ in the ZIP file will be copied to the main Sugar directory (demarked by "" in the 'to_dir' directive). This particular language pack's structure looks like:

    Code:
    |   manifest.php
    \---pt_br_351
        +---include
        |   \---language
        |           pt_br.lang.php
        |           
        \---modules
            +---<module directories here>
    manifest.php and a directory named 'pt_br_351' exist at the top level. Two directories, 'include' and 'modules' exist under 'pt_br_351.'

    There are a few more directives that can be used in manifest files, but I'll get into those later. We're going to be updating a document on SugarForge soon that details the manifest file in full.
    Attached Files Attached Files
    Julian Ostrow
    Systems and Applications Engineer
    SugarCRM Inc.

  6. #6
    juergen is offline Sugar Community Member
    Join Date
    Apr 2005
    Posts
    338

    Default Re: Language pack sync tool

    I just wanted to install a local environment for easy translation which looks like tins:

    PHPLauncher and in its webfolder you will find:

    index.php (was sync_lang.php)
    include folder with subfolder language, containing en_us.lang.php and ge_ge.lang.php files
    The same witn modules, only the modules folder containing the Subfolder language and the english and german language files.

    But, if i run the sync script, it says:

    -- Entering ./include/language/. . .
    Not A Valid Entry Point

    So, anyone any idea, what's wrong?

    Perhaps Julian?

    Thanks!

    Juergen
    PS: Its the same, if i transfer the files/folders onto my webserver....
    This space is for rent ;-)

  7. #7
    romaing is offline Sugar Community Member
    Join Date
    Dec 2005
    Location
    Warsaw
    Posts
    12

    Default Re: Language pack sync tool

    Quote Originally Posted by juergen
    I just wanted to install a local environment for easy translation which looks like tins:

    PHPLauncher and in its webfolder you will find:

    index.php (was sync_lang.php)
    include folder with subfolder language, containing en_us.lang.php and ge_ge.lang.php files
    The same witn modules, only the modules folder containing the Subfolder language and the english and german language files.

    But, if i run the sync script, it says:

    -- Entering ./include/language/. . .
    Not A Valid Entry Point

    So, anyone any idea, what's wrong?

    Perhaps Julian?

    Thanks!

    Juergen
    PS: Its the same, if i transfer the files/folders onto my webserver....
    Hello,

    Since SugarCRM 4.0.1 release, you got a new line added to all lang files which is :

    PHP Code:
    if(empty($GLOBALS['sugarEntry'])) die('Not A Valid Entry Point'); 
    So if you use any script that include sugar lang files, this line will simply end the script and display a 'Not A Valid Entry Point' message.

    The solution to this problem is quite simple as you only have to had a line like this at the begining of your script:

    PHP Code:
    $sugarEntry true
    That should help you.

    regards

  8. #8
    juergen is offline Sugar Community Member
    Join Date
    Apr 2005
    Posts
    338

    Default Re: Language pack sync tool

    Thanks!
    This did the trick.

    You're my god

    Juergen
    This space is for rent ;-)

  9. #9
    julian's Avatar
    julian is offline Sugar Team Member
    Join Date
    Sep 2004
    Posts
    1,639

    Default Re: Language pack sync tool

    Hello all,

    I'll be sending out a new version of the script some time this week. Good find!
    Julian Ostrow
    Systems and Applications Engineer
    SugarCRM Inc.

  10. #10
    malcolmh's Avatar
    malcolmh is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Aug 2004
    Posts
    1,712

    Default Re: Language pack sync tool

    Quote Originally Posted by julian
    Hello all,

    I'll be sending out a new version of the script some time this week. Good find!
    If generating a new version of the tool, it would also be great to mark the lines i.e. with ++ or something that are added to the language file.

    What do other people think about this sort of option?
    Cheers Malcolm

    Genius4U Limited - Ingenious simple IT solutions for you / Genial einfache IT Lösungen für Sie
    http://www.genius4u.com or http://www.genius4u.de

Page 1 of 2 12 LastLast

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
  •