Skip to main content
Known Participant
August 24, 2016
Question

Language Id's wont change

  • August 24, 2016
  • 3 replies
  • 2024 views

Hi!

I'm poking around with the attemp to set the language ID for simplified Chinese by Javascript.

It does work when i use, for example, french but I couldnt find a way to do this for an asian language.

I also tried it with an installation of InDesign CC in chinese.

May anyone have an idea how to get this to work?

var _ps = app.documents.firstItem().allParagraphStyles;   

for (var i = 1; i < _ps.length; i++)    {

    _ps.composer = 'Adobe Japanese Paragraph Composer';

     _ps.appliedLanguage = '$ID/Chinese: Simplified';

Thomas

This topic has been closed for replies.

3 replies

Community Expert
August 24, 2016

Hi Thomas,

Japanese composer with language setting for Chinese Simplified?
How would that go together? I'm just curious, don't know a thing about the Japanese composer…

Adobe Japanese Paragraph Composer string is:
"$ID/HL Composer J"

Adobe Japanese Single-line Composer string is:
"$ID/HL Single J"

And what about the Chinese Simplified string?
Maybe appliedLanguage is looking for a native Chinese string?
( Just a wild guess )

Since your screenshot is showing "Chinesisch: vereinfacht" as available language for a paragraph style what would that style return, if you ask about its appliedLanguage value?

// Index 1 is the [Basic Paragraph Style] / German: [Einf. Abs.]

app.documents[0].paragraphStyles[1].appliedLanguage.name;

Regards,
Uwe

Community Expert
August 24, 2016

Or if you set the language in your UI to "Chinesisch: vereinfacht", what will happen if you retrieve the ID of the language and try to apply the language by its ID?

// Get the ID:

var myChineseLanguageID = app.documents[0].paragraphStyles[1].appliedLanguage.id;

// Target a DIFFERENT paragraph style in the SAME document:
app.documents[0].paragraphStyles[2].appliedLanguage = app.languagesWithVendors.itembyID(myChineseLanguageID);
// Target a DIFFERENT paragraph style in a SECOND document that is open:
app.documents[1].paragraphStyles[1].appliedLanguage = app.languagesWithVendors.itembyID(myChineseLanguageID);

Regards,
Uwe

Known Participant
August 25, 2016

I'm no scripter so I'm way out of my depth here, but I dimly recall Marc Autret's discussing peculiarities of "app.LanguagesWithVendors" back in December 2011.

David


Yeah i read this thread from Marc Autret.

But anyway for now i archieved my goal and

var _ps = app.documents.firstItem().allParagraphStyles;  

for (var i = 1; i < _ps.length; i++)    {

    _ps.composer = 'Adobe Japanese Paragraph Composer';

    _ps.appliedLanguage = '$ID/Chinese: Simplified';

does finally work!

Before it works i need to import Paragraph Formats with these language settings.

Afterwards they are available in the actual document and also scriptable.

Known Participant
August 24, 2016

tpk1982
Legend
August 24, 2016

give this

_ps.appliedLanguage = 'Chinesisch: vereinfacht';

Known Participant
August 24, 2016

Same result as before.
Do you have any idea how to copy the error message from the botton of the estk-window?

The console doesn't show this message.

tpk1982
Legend
August 24, 2016
tpk1982
Legend
August 24, 2016

I hope we don't need $ID, give straight away the name

_ps.appliedLanguage = 'Chinese: Simplified';