function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rudi_HulsbosRudi_Hulsbos 

Translation of Custom Labels in Customer Portal using JSON

Hi All,


We have added quite a lot of css styling to our customer portal, and for that reason we have created custom labels in Salesforce to translate them into different languages. From our customer portal we use the getJSON function to call a visualforce page that contains all the cusotm label values, the returned values will be the translated labels. Now, we had all this working for some time but had to make some changes to the portal and now some of the labels are not translating anymore. There is only one tab that is translating all the labels, and that is the new case menu tab, this is a tab in the portal that points to a custom visualforce tab, when you navigate to any of the other tabs like home the translations do not work. Any ideas on how to resolve this issue or where to troublshoot? I have included the code samples below.


Thanks,


Rudi


<apex:page contentType="application/json">
{!$CurrentPage.parameters.callback}([
        {LabelName: 'homeMenu', LabelValue: '{!$Label.HomeMenu}'},
        {LabelName: 'supportMenu', LabelValue: '{!$Label.SupportMenu}'},
        {LabelName: 'LogOutMenu', LabelValue: '{!$Label.LogOutMenu}'},
        {LabelName: 'newCaseMenu', LabelValue: '{!$Label.NewCaseMenu}'},
        {LabelName: 'viewCaseMenu', LabelValue: '{!$Label.ViewCaseMenu}'},
        {LabelName: 'termsandconditions', LabelValue: '{!$Label.termsandconditions}'},
        {LabelName: 'privacypolicy', LabelValue: '{!$Label.privacypolicy}'},
        {LabelName: 'tclink', LabelValue: '{!$Label.privacypolicylink}'},
        {LabelName: 'KnowledgeBase', LabelValue: '{!$Label.KnowledgeBase}'}])
</apex:page>


$.getJSON("/apex/portalmenusourceJSON?callback=?", function(data){                 
                 $.each(data, function(index,obj){
                     attr="a[label='"+obj.LabelName+"']";
                     $(attr).html(obj.LabelValue);
                  });

*werewolf**werewolf*

Did you try to manually input the URL /apex/portalmenusourceJSON?callback=? to see if it actually returns anything?  That URL sure looks suspect to me (particularly the callback=? part).