Results 1 to 6 of 6

Thread: Change State to Province - works in some custom modules but not in others

  1. #1
    Ramblin is offline Sugar Community Member
    Join Date
    May 2010
    Posts
    98

    Default Change label for State to Province - cannot get it to work in Custom directory

    I am setting up a Sugar CE (v6.2.1) in Canada and the address label used in Canada is Province instead of State.

    I created a package called Event_Manager built initially in Module Builder with custom coding as required. It has 5 custom modules and relates to 2 existing modules : Contacts and Accounts. I want to change the State label to Province in all the modules, including the existing ones.

    I have not been able to figure out how to use $app_strings to change the State field label globally (I know the code would be
    Code:
    <?php
    $app_strings['LBL_PRIMARY_ADDRESS_STATE'] = 'Province';
    ?>
    but I cannot find any directory in the custom directories that makes any difference and I have tried many.
    Is the $app_strings functionality deprecated/disabled?

    so I put, the following code
    Code:
    <?php
    $mod_strings['LBL_PRIMARY_ADDRESS_STATE'] = 'Province';
    ?>
    into a file called
    en_us.state_to_province.php

    in the language directory of my custom modules at
    <sugar_root>/custom/Extension/modules/EvMgr_Fac/Ext/Language
    (Module EvMgr_EV used as an example; the same file put into the same directories in the other custom modules)
    I also added the required directory path for the existing modules into the custom directory and put the file in there as well.

    After a Repair & Rebuild, the code does get consolidated into the en_us.lang.ext.php vardef file in each module, but it did not result in the label changing.

    I then added the code
    Code:
    'LBL_PRIMARY_ADDRESS_STATE' = 'Province';
    to the Module Builder package directly in
    <sugar_root>/custom/modulebuilder/packages/Event_Manager/modules/EvMgr_Ev/language
    and the State label did change in that module

    I can use the Module Builder solution for the new custom modules but not for the existing modules so I do not have a working solution yet.

    Can anyone tell me why the code added to the custom module directory is not working?

    Ramblin
    Last edited by Ramblin; 2011-08-08 at 09:34 AM. Reason: new information

  2. #2
    rafael.q.g@hotmail.com's Avatar
    rafael.q.g@hotmail.com is offline Sugar Community Member
    Join Date
    Jun 2011
    Location
    Florianópolis - Brazil
    Posts
    782

    Default Re: Change State to Province - works in some custom modules but not in others

    You have always to change/add the translation label in the near level to module which you want to translate.
    So in your case I think you should open moules/your_module/language/your_language_file.php
    and here include the correct translation, and then run repair and rebuild, it shoulod works.

    If not works (but it had to) a more hard solution is just to set this label on runtime by some javascript function, but here a little programming is needed.
    Rafael Queiroz Gonçalves
    Advanced OMG UML Certified Professional
    Sun Certified Enterprise Architect for the Java Platform
    Sun Certified Programmer for the Java 2 Platform
    IBM Certified Advanced Application Developer - Lotus Notes and Domino
    IBM Certified Application Developer - IBM WebSphere Portlet Factory
    Computer Science Mastering / UFSC - PPGCC

  3. #3
    Ramblin is offline Sugar Community Member
    Join Date
    May 2010
    Posts
    98

    Default Re: Change State to Province - works in some custom modules but not in others

    Thanks for the quick reply Rafael

    Question:
    I thought any changes made directly on the <sugar_root>/modules directory had the risk of being deleted in an upgrade and / or reDeploy from Module Builder or Studio?

    I thought any custom changes had to be done in the <sugar_root>/custom/Extension/modules/Ext directory?

    Richard

  4. #4
    Ramblin is offline Sugar Community Member
    Join Date
    May 2010
    Posts
    98

    Default Re: Change State to Province - works in some custom modules but not in others

    Well, I half solved the issue. I now have all the modules I want to show Province instead of State doing so. There are two labels that need to be defined by putting

    Code:
    <?php
    $mod_strings['LBL_PRIMARY_ADDRESS_STATE'] = 'Province';
    $mod_strings['LBL_STATE'] = 'Province';
    ?>
    into a file (i called en_us.state_to_province.php)

    in the custom module directory at <sugar_root>/custom/Extension/modules/<module>/Ext/Language

    I do not yet know why the $app_lists did not work so if anyone does figure that out please let me know but in the meantime, this is a brute-force method that works.

    Ramblin

  5. #5
    andopes's Avatar
    andopes is offline A Sugar Hero | Help Forum Moderator
    Join Date
    Jul 2006
    Location
    São Paulo - Brazil
    Posts
    8,335

    Default Re: Change State to Province - works in some custom modules but not in others

    Person based modules (Contacts, Leads) has primary address (LBL_PRIMARY_ADDRESS_STATE) and alt address (LBL_ALT_ADDRESS_STATE), Company based modules has billing address (LBL_BILLING_ADDRESS_STREET) and shipping address (LBL_SHIPPING_ADDRESS_STREET).

    Regards
    André Lopes
    DevToolKit / Project of the Month - June 2009
    Lampada Global Services- Open Source Solutions
    Avenida Ipiranga, 318
    Bloco B - CJ 1602
    São Paulo, SP 01046-010
    Brazil
    Office: +55 11 3237-3110
    Mobile: +55 11 7636-5859
    e-mail: andre@lampadaglobal.com

    Lampada Global delivers offshore software development and support services to customers around the world.
    Lampada is proud to be a SugarCRM Gold Partner, revolutionizing Customer Relationship Management.

    I DO NOT answer questions through PM and Email. If you need some help post your question into SugarForum.

  6. #6
    Ramblin is offline Sugar Community Member
    Join Date
    May 2010
    Posts
    98

    Default Re: Change State to Province - works in some custom modules but not in others

    Thank you André

    So, for the rest of you reading this, the location into which this code goes is still in the custom module directory at
    <sugar_root>/custom/Extension/modules/<module>/Ext/Language

    and you can still use the file name you want so long as it starts with en_us. and ends with .php - I used
    en_us.state_to_province.php

    with the code

    Code:
    <?php
    // Generic State label
    $mod_strings['LBL_STATE'] = 'Province';
    // State labels used when Person was originating template of a module
    $mod_strings['LBL_PRIMARY_ADDRESS_STATE'] = 'Province';
    $mod_strings['LBL_ALT_ADDRESS_STATE'] = 'Province';
    // State labels used when Company was originating template of a module
    //  Thanks to adpose for the additional information
    $mod_strings['LBL_BILLING_ADDRESS_STATE'] = 'Province';
    $mod_strings['LBL_SHIPPING_ADDRESS_STATE'] = 'Province';
    ?>
    I figure it does not hurt to define labels a module does not use and this way I just copy and paste the same file into each module.

    Ramblin

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 0
    Last Post: 2009-10-15, 09:05 AM
  2. Replies: 0
    Last Post: 2009-08-11, 10:57 PM
  3. Change State Textbox to Drop Down
    By wkcarlson in forum Developer Help
    Replies: 12
    Last Post: 2009-06-05, 08:24 PM
  4. Replies: 3
    Last Post: 2006-10-30, 01:50 PM
  5. Hosting change to SAFE MODE ON... will SugarCRm works?
    By cpinazo in forum General Discussion
    Replies: 1
    Last Post: 2005-12-15, 07:26 AM

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
  •