Highlighted

Scripting for localization advice needed

New Here ,
Apr 25, 2020

Copy link to clipboard

Copied

So i made a script for localization purposes. 

The script identify a specifc layer name and changes its source text. 

This is the change command I use:

comp.layer("Layer name").property("ADBE Text Properties").property("ADBE Text Document").setValue(newText);

Issue number one is while I'm testing this functionaliy, sometimes it works perfectly, and sometines it changes the layer name together with the source text, and I don't want this to happend. I want the layer name to stay exactly the same.

 

Issue number two, some of the text layers contain names that I don't want to change. 

For example: 

English: Dave's house

Italian : la casa di Dave

So I need to keep the name and translate the sentance. and the names are always diffrent. 

Also the name and the reset of the sentance have diffrentte color, and they are on the same layer. 

Any adivce on how to go about this ? 

 

Thanks a lot 🙂

Topics

Scripting

Views

291

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Scripting for localization advice needed

New Here ,
Apr 25, 2020

Copy link to clipboard

Copied

So i made a script for localization purposes. 

The script identify a specifc layer name and changes its source text. 

This is the change command I use:

comp.layer("Layer name").property("ADBE Text Properties").property("ADBE Text Document").setValue(newText);

Issue number one is while I'm testing this functionaliy, sometimes it works perfectly, and sometines it changes the layer name together with the source text, and I don't want this to happend. I want the layer name to stay exactly the same.

 

Issue number two, some of the text layers contain names that I don't want to change. 

For example: 

English: Dave's house

Italian : la casa di Dave

So I need to keep the name and translate the sentance. and the names are always diffrent. 

Also the name and the reset of the sentance have diffrentte color, and they are on the same layer. 

Any adivce on how to go about this ? 

 

Thanks a lot 🙂

Topics

Scripting

Views

292

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Guide ,
Apr 25, 2020

Copy link to clipboard

Copied

Assuming you have the layer name in a variable, you could just do something like this:

 

var layerName = "Layer name";
var theLayer = comp.layer(layerName);
theLayer.property("ADBE Text Properties").property("ADBE Text Document").setValue(newText);
theLayer.name = layerName;

 

I don't know about the second issue.

 

Dan

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Guide ,
Apr 25, 2020

Copy link to clipboard

Copied

If you know all the names, you can use regex or string comparison to find the parts you will keep.

But I don't think that is an effective way.

 

A better approch will be to have the names seperated, like on another "support" text layer which is hidden and from which you read the names as you need them.

 

With more details about the project, the purpose and the structure, there might be better solutions.

 

*Martin

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
HeladIL LATEST
New Here ,
Apr 26, 2020

Copy link to clipboard

Copied

Hi, unfortunately the names are changing between version.

I thought maybe I could use an expression for the source text.

But can I read and use the expression varibles from a script? 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...