Skip navigation
Currently Being Moderated

How to localize Photoshop layer names

Mar 22, 2012 11:26 AM

I'm trying to get the default layer names for background, group, etc used by Photoshop depending on users local language.


As I haven't found a direct way I decided to use javascript instead:


I have a jsx code like

function GetBackground()


var message = localize( "$$$/LayerName/Background=Background");

return message;



and in the extension I use

var result:SyncRequestResult = CSXSInterface.instance.evalScript("GetBackground");



but result value is undefined.


Any help would be appreciated.

  • Currently Being Moderated
    Mar 26, 2012 2:33 AM   in reply to MSSDedalus

    Hello MSSDedalus,


    the returned result from the called extend is in form of a object; so you should add this code to the extendscript (just a example):


    var xml = '<object>';

    var xml = xml += '<property id="strMessage"><string>'+message+'</string></property>';

    var xml = xml += '</object>';


    and then return the xml variable instead of the message one.


    Then, you should have to modify the actionscript code as well:


    var result:SyncRequestResult = CSXSInterface.instance.evalScript("GetBackground");

    var oResult:Object;

        if((SyncRequestResult.COMPLETE == result.status) &&


         oResult = as Object;

         //Make sure oResult has the property you are expecting



            var localizedString:String = oResult.strMessage;




    This can be found on the official documentation too.




    Mark as:
  • Currently Being Moderated
    Mar 26, 2012 4:03 AM   in reply to MSSDedalus

    Have you tried this? (no separate jsx required)


    var message:String = HostObject.getRoot(HostObject.extensions[0]).localize( "$$$/LayerName/Background=Background");
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points