30 Replies Latest reply on Aug 25, 2016 10:27 AM by Laubender

    Language Id's wont change

    funkturmmitte Level 1

      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[i].composer = 'Adobe Japanese Paragraph Composer';

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

       

      Thomas

        • 2. Re: Language Id's wont change
          tpk1982 Level 4

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

           

          _ps[i].appliedLanguage = 'Chinese: Simplified';

          • 3. Re: Language Id's wont change
            funkturmmitte Level 1

            I already saw the mentioned thread but even after reading it i couldn't get it done.

            • 4. Re: Language Id's wont change
              tpk1982 Level 4

              try _ps[i].appliedLanguage = 'Chinese: Simplified';

               

              or just post the screen shot of your desired language in indesign

              • 5. Re: Language Id's wont change
                funkturmmitte Level 1

                _ps[i].appliedLanguage = 'Chinese: Simplified';

                also doesn't work.

                I'm testing this on a german version of  InDesign as well as an chinese version.

                • 6. Re: Language Id's wont change
                  tpk1982 Level 4

                  So that i asked to post the screenshot like mine

                   

                  Screen Shot 2016-08-24 at 5.02.42 PM.png

                  • 8. Re: Language Id's wont change
                    tpk1982 Level 4

                    give this

                     

                    _ps[i].appliedLanguage = 'Chinesisch: vereinfacht';

                    • 9. Re: Language Id's wont change
                      funkturmmitte Level 1

                      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.

                      • 10. Re: Language Id's wont change
                        tpk1982 Level 4

                        use try catch method

                        • 11. Re: Language Id's wont change
                          tpk1982 Level 4

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

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

                              _ps[i].composer = 'Adobe Japanese Paragraph Composer';

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

                               }}

                          catch(e){alert(e)}

                          • 12. Re: Language Id's wont change
                            funkturmmitte Level 1

                            ---------------------------

                            Error: Ungültiger Wert für Einrichtung der Eigenschaft „appliedLanguage“. LanguageWithVendors, Language or String erwartet, aber „Chinesisch: vereinfacht“ erhalten.

                            ---------------------------

                            The translation should be like this:

                            Invalid value for set property 'appliedLanguage'. Expected LanguageWithVendors, Language or String but received "Chinesisch: vereinfacht".

                            • 13. Re: Language Id's wont change
                              Laubender Adobe Community Professional & MVP

                              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

                              • 14. Re: Language Id's wont change
                                Laubender Adobe Community Professional & MVP

                                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

                                • 15. Re: Language Id's wont change
                                  funkturmmitte Level 1

                                  Well, as I know the Japanese paragraph composer is used for all CJK (Korean, Japanese, Chinese) languages.

                                  The result is, according to native speakers, correct.

                                  With the Chinese version of indesign there is only a string "Chinese: simplified" in the idml file (can't check the correct spelling right now as I am out out the office).

                                  • 16. Re: Language Id's wont change
                                    funkturmmitte Level 1

                                    Thank you Uwe, I'm gonna try it tomorrow.

                                    • 17. Re: Language Id's wont change
                                      funkturmmitte Level 1
                                      // Index 1 is the [Basic Paragraph Style] / German: [Einf. Abs.]
                                      app.documents[0].paragraphStyles[1].appliedLanguage.name;
                                      

                                       

                                      This returns "Chinesisch: vereinfacht"

                                       

                                      And

                                      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);
                                      

                                       

                                      Simply returns this error message:

                                      ReferenceError: app.languagesWithVendors.itembyID is not a function

                                       

                                      About the Japanese Paragraph Composer: https://helpx.adobe.com/indesign/using/composing-cjk-characters.html

                                      • 18. Re: Language Id's wont change
                                        Laubender Adobe Community Professional & MVP

                                        Sorry. There is a typo on my side.
                                        itemByID, not: itembyID. I typed too fast.

                                         

                                        Uwe

                                        • 19. Re: Language Id's wont change
                                          funkturmmitte Level 1

                                          By the way, the list of of available languages in the chinese Version of InDesign reads like this:

                                           

                                          [未指定语言] => $ID/[No Language]  OR  $ID/[No language]

                                          中文: 简体 => $ID/Chinese: Simplified

                                          中文: 繁体 => $ID/Chinese: Traditional

                                          丹麦语 => $ID/Danish

                                          乌克兰语 => $ID/Ukrainian  OR  $ID/IDX_Ukrainian

                                          俄语 => $ID/Russian  OR  $ID/IDX_Russian

                                          保加利亚语 => $ID/Bulgarian  OR  $ID/IDX_Bulgarian

                                          克罗地亚语 => $ID/Croatian  OR  $ID/IDX_Croatian

                                          加泰罗尼亚语 => $ID/Catalan

                                          匈牙利语 => $ID/Hungarian  OR  $ID/IDX_Hungarian

                                          印地文 (印度) =>

                                          古加拉提文 (印度) =>

                                          土耳其语 => $ID/Turkish  OR  $ID/IDX_Turkish

                                          埃纳德文 (印度) =>

                                          奥里亚语(印度) =>

                                          孟加拉文 (印度) =>

                                          希伯来语 => $ID/PlaceHolder_Hebrew  OR  $ID/Hebrew  OR  $ID/kWRIndexGroup_HebrewAlphabet

                                          希腊语 => $ID/PlaceHolder_Greek  OR  $ID/Greek  OR  $ID/kWRIndexGroup_GreekAlphabet

                                          德语: 1996 年改革后的规则 => $ID/German: Reformed

                                          德语: 2006 年改革后的规则 => $ID/de_DE_2006

                                          德语: 旧规则 => $ID/German: Traditional

                                          德语: 瑞士 => $ID/German: Swiss

                                          德语: 瑞士(2006 年改革后的规则) => $ID/de_CH_2006

                                          意大利语 => $ID/Italian

                                          拉脱维亚语 => $ID/Latvian  OR  $ID/IDX_Latvian

                                          挪威语: 博克马尔 => $ID/Norwegian: Bokmal

                                          挪威语: 尼诺斯克 => $ID/Norwegian: Nynorsk

                                          捷克语 => $ID/Czech  OR  $ID/IDX_Czech

                                          斯洛伐克语 => $ID/Slovak  OR  $ID/IDX_Slovak

                                          斯洛文尼亚语 => $ID/Slovenian  OR  $ID/IDX_Slovenian

                                          旁遮普文 (印度) =>

                                          日文 => $ID/PlaceHolder_Japanese  OR  $ID/Japanese

                                          法语 => $ID/French

                                          法语: 加拿大 => $ID/French: Canadian

                                          波兰语 => $ID/Polish  OR  $ID/IDX_Polish

                                          泰卢固文 (印度) =>

                                          泰米尔文 (印度) =>

                                          爱沙尼亚语 => $ID/Estonian  OR  $ID/IDX_Estonian

                                          瑞典语 => $ID/Swedish

                                          立陶宛语 => $ID/Lithuanian  OR  $ID/IDX_Lithuanian

                                          罗马尼亚语 => $ID/Romanian  OR  $ID/IDX_Romanian

                                          芬兰语 => $ID/Finnish

                                          英语: 加拿大 => $ID/English: Canadian

                                          英语: 美国 => $ID/English: USA

                                          英语: 美国医学 => $ID/English: USA Medical

                                          英语: 美国法律 => $ID/English: USA Legal

                                          英语: 英国 => $ID/English: UK

                                          荷兰语: 2005 年改革后的规则 => $ID/nl_NL_2005

                                          荷兰语: 旧规则 => $ID/Dutch

                                          葡萄牙语 => $ID/Portuguese

                                          葡萄牙语: 巴西 => $ID/Portuguese: Brazilian

                                          葡萄牙语: 拼字协议 => $ID/Portuguese: Orthographic Agreement

                                          西班牙语 => $ID/Spanish  OR  $ID/Spanish: Castilian  OR  $ID/IDX_Spanish

                                          阿拉伯语 => $ID/Arabic  OR  $ID/PlaceHolder_Arabic  OR  $ID/kWRIndexGroup_ArabicAlphabet

                                          韩文 => $ID/hngl  OR  $ID/Korean  OR  $ID/Hangul

                                          马拉地文 (印度) =>

                                          马拉雅拉姆语(印度) =>

                                          • 20. Re: Language Id's wont change
                                            funkturmmitte Level 1

                                            The result is "Ergebnis: [object LanguageWithVendors]"

                                            • 21. Re: Language Id's wont change
                                              Laubender Adobe Community Professional & MVP

                                              Hi Thomas,

                                              the result of where exactly? I guess you mean the contents of the JavaScript Console of your ESTK.
                                              So check your paragraph style, not the JavaScript Console of the ESTK, if the right language is now applied.

                                               

                                              Explanation:
                                              You just ran a code snippet from the ESTK, that is not wrapped into any function or is terminated with an exit(); command.

                                               

                                              So the message in the JavaScript console would reflect the last returned object of your snippet.
                                              And that indeed should be a [object LanguageWithVendors] if all goes well.

                                               

                                              Regards,
                                              Uwe

                                              • 22. Re: Language Id's wont change
                                                funkturmmitte Level 1

                                                Hi Uwe!

                                                Yes, i meant the content of the console.

                                                Thank you a lot for your effort, but actually there has been no effect in the paragraph styles – nothing changed.

                                                The chinese language is not accessible in the german InDesign version - but if i edit the content of idml files it shows up in the menu. Also i can use the entry in the menu in documents in which the language has been selected before.

                                                Quiete the same for the paragraph composer. The Japanese one is not accessible with the german GUI but it can be activated by a script or the import of definitions from another document.

                                                 

                                                Regards

                                                Thomas

                                                • 23. Re: Language Id's wont change
                                                  Laubender Adobe Community Professional & MVP

                                                  funkturmmitte wrote:

                                                  … The chinese language is not accessible in the german InDesign version - but if i edit the content of idml files it shows up in the menu. Also i can use the entry in the menu in documents in which the language has been selected before.


                                                  Hm. Then you need the original Chinese language version to get what you want.


                                                  For this: Do not uninstall your German InDesign.
                                                  Do a second install with InDesign through the Adobe CC Desktop App where you first set your system language to Chinese before, then set the language inside the CC Desktop App to Chinese and chose the Chines version to install. And after installing setting back your system language to German.

                                                   

                                                  Then you should get a merge of a German UI InDesign with (some or all?) Chinese features.


                                                  Note: I never tried this.

                                                  But you could ask Willi Adelberger who once did this, if I recall that right:

                                                  https://forums.adobe.com/people/Willi+Adelberger

                                                   

                                                  Best,
                                                  Uwe

                                                  • 24. Re: Language Id's wont change
                                                    funkturmmitte Level 1

                                                    Thank you Uwe, i've been aware of this, and i already did this a while ago.

                                                    I'll keep on searching for a scriptable way to set the language.

                                                     

                                                    Regards

                                                    Thomas

                                                    • 25. Re: Language Id's wont change
                                                      David W. Goodrich Level 3

                                                      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

                                                      • 26. Re: Language Id's wont change
                                                        Laubender Adobe Community Professional & MVP

                                                        Hi David,
                                                        thank you for pointing at this thread.

                                                         

                                                        However, there seems to be no real solution unless one is using—my guess—the "real" Chinese version (whatever that is).
                                                        Perhaps a Chinese version plus the system language set to Chinese and the keyboard as well?! Don't know.

                                                         

                                                        Regards,
                                                        Uwe

                                                        • 27. Re: Language Id's wont change
                                                          funkturmmitte Level 1

                                                          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[i].composer = 'Adobe Japanese Paragraph Composer';
                                                              _ps[i].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.

                                                          • 28. Re: Language Id's wont change
                                                            Laubender Adobe Community Professional & MVP

                                                            Aha!
                                                            Don't get me wrong here, but did you test, if the rules for breaking lines according to Simplified Chinese are working alright?
                                                            If yes, this is quiet a hack. The underlying technology would be there but is not exposed directly to the UI or even to straight scripting…

                                                             

                                                            I wish you all the best!
                                                            Uwe

                                                            • 29. Re: Language Id's wont change
                                                              funkturmmitte Level 1

                                                              Well, the line breaks are done by the Japanese paragraph composer.

                                                              For my workmates, which are native speakers , it looks fine. And it's seems like the spellcheck does also work now.

                                                              • 30. Re: Language Id's wont change
                                                                Laubender Adobe Community Professional & MVP

                                                                Good to know, Thomas.
                                                                Thank you very much for reporting back.

                                                                 

                                                                Best,
                                                                Uwe