var LANG_KEYS = "_EN,_DE,_FR,_IT";
//
function handleLayer(layer, lang_identifier) {
var str = layer.name.slice(-3);
if (LANG_KEYS.indexOf(str) <= 0) {
// layer is localized: switch on or off
layer.enabled = (str === lang_identifier);
} else {
// layer not localized: do nothing
};
};
function handleProject(lang_identifier) {
var M = app.project.numItems,
m, comp;
var N, n, layer;
for (m = 1; m <= M; m++) {
comp = app.project.item(m);
if (comp.typeName !== "Composition") continue;
N = comp.numLayers;
for (n = 1; n <= N; n++) {
layer = comp.layer(n);
handleLayer(layer, lang_identifier);
};
};
};
// UI
var win = new Window("palette", "script name");
win.alignChildren = ['fill', 'top'];
win.spacing = 5;
var keyMENU = win.add("dropdownlist", undefined, LANG_KEYS.split(","));
var runBTN = win.add("button", undefined, "go");
keyMENU.selection = 0;
runBTN.onClick = function() {
handleProject(keyMENU.selection.text);
};
win.show()