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

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

Guide ,
Jul 02, 2025 Jul 02, 2025

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));
}
 
TOPICS
Scripting
209
Translate
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

correct answers 2 Correct answers

Guide , Jul 02, 2025 Jul 02, 2025
Translate
Guide , Jul 02, 2025 Jul 02, 2025

@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.

Translate
Community Expert ,
Jul 02, 2025 Jul 02, 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 

Translate
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
Guide ,
Jul 02, 2025 Jul 02, 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.

Translate
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 ,
Jul 02, 2025 Jul 02, 2025

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

Translate
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
Guide ,
Jul 02, 2025 Jul 02, 2025

Hi m1b.

alert($.locale);

Popup: zh-CN.

 

alert(localize(sNoSelection));
Popup: Place the cursor inside a table.
.

 

Translate
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
Guide ,
Jul 02, 2025 Jul 02, 2025
LATEST

@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.

Translate
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
Guide ,
Jul 02, 2025 Jul 02, 2025
Translate
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