Skip to main content
dublove
Legend
July 2, 2025
Answered

How does the script automatically select the UI interface language based on the windows system?

  • July 2, 2025
  • 2 replies
  • 392 views

I saw a script here.
https://github.com/gsingelmann/indd_autocolumn/tree/master 

 

The author (Gerald Singelmann) seems to have set "en" "de" "it" three languages, is it possible to automatically choose to display the appropriate language interface according to different windows systems.
I tried to add cn and nothing seems to change anything.

var sAutoColumn = {  en: "AutoColumn2...", de: "AutoSpalte2...", it: "AutoColumn2..."}

if (app.selection.length) {
    app.doScript(autoSpalte, undefined, undefined, UndoModes.ENTIRE_SCRIPT, localize(sAutoColumn));
}
 
Correct answer dublove

It might be wrong. What does $.locale give you?


@m1b @Dirk Becker 

Thank you.

According to Dirk Becker's pointers, I found iso639 language code.
Chinese code is zh.
and added $.localize = true;
to enable localization.
It worked.

2 replies

Legend
July 3, 2025
m1b
Community Expert
Community Expert
July 2, 2025

@dublove  can you try this please?

var sNoSelection = {
    "en": "Place the cursor inside a table",
    "de": "Platzieren Sie den Cursor in einer Tabelle.",
    "it": "Posiziona il cursore all'interno di una cella",
    "zh-CN": "将光标放在表格内",
    "zh-TW": "將遊標放在表格內",
};

alert(localize(sNoSelection));

 

Let me know if it works on your system. You can also try this:

alert($.locale);

- Mark 

dublove
dubloveAuthor
Legend
July 2, 2025

@m1b 

Hi m1b.
This js is reporting errors straight away.
I've tried it and it's still displaying the English interface.
I think the representation of zh-CN is wrong.

m1b
Community Expert
Community Expert
July 2, 2025

It might be wrong. What does $.locale give you?