• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Scripting for localization advice needed

Community Beginner ,
Apr 25, 2020 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

413

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
community guidelines
Community Expert ,
Apr 25, 2020 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

Votes

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
community guidelines
Mentor ,
Apr 25, 2020 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

Votes

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
community guidelines
Community Beginner ,
Apr 26, 2020 Apr 26, 2020

Copy link to clipboard

Copied

LATEST

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? 

Votes

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
community guidelines