Dictionary
Set dictionaries
Main(); function Main() { var doc = app.activeDocument; var languageWithVendors = app.languagesWithVendors.itemByName("English: USA"); languageWithVendors.hyphenationVendor = "Hunspell"; languageWithVendors.spellingVendor = "Hunspell"; doc.textDefaults.appliedLanguage = languageWithVendors; }
Before
After
Get list of languages
var languagesWithVendors = app.languagesWithVendors; for (var i = 0; i < languagesWithVendors.length; i++) { $.writeln(i + " - " + languagesWithVendors[i].name); }
> app.languagesWithVendors.length
Result: 60
0 - [No Language]
1 - German: 1996 Reform
2 - German: 2006 Reform
3 - German: Swiss
4 - German: Swiss 2006 Reform
5 - German: Austria 2006 Reform
6 - Bengali (India)
7 - Gujarati (India)
8 - Hindi (India)
9 - Kannada (India)
10 - Malayalam (India)
11 - Marathi (India)
12 - Oriya (India)
13 - Punjabi (India)
14 - Tamil (India)
15 - Telugu (India)
16 - Bulgarian
17 - Catalan
18 - Czech
19 - Danish
20 - Greek
21 - English: Canadian
22 - English: UK
23 - English: USA
24 - English: USA Medical
25 - Spanish
26 - Estonian
27 - Finnish
28 - French: Canadian
29 - French
30 - Croatian
31 - Hungarian
32 - Italian
33 - Lithuanian
34 - Latvian
35 - Norwegian: Bokmål
36 - Dutch: Old Rules
37 - Dutch: 2005 Reform
38 - Norwegian: Nynorsk
39 - Polish
40 - Portuguese: Brazilian
41 - Portuguese: Orthographic Agreement
42 - Portuguese
43 - Romanian
44 - Russian
45 - Slovak
46 - Slovenian
47 - Swedish
48 - Turkish
49 - Ukrainian
50 - Indonesian (Indonesia)
51 - Khmer (Cambodia)
52 - Lao (Laos)
53 - Burmese (Myanmar [Burma])
54 - Sinhala (Sri Lanka)
55 - Thai
56 - English: USA Legal
57 - German: Old Rules
58 - Hebrew
59 - Arabic
How to reference a languagesWithVendors?
What if I want to get a reference, say, to Spanish language? Theoretically, the following line should work:
var languageWithVendors = app.languagesWithVendors.itemByName("Spanish")
But it results in “object is invalid”! In the list above I see it’s 26-th in the list so let’s try:
var languageWithVendors = app.languagesWithVendors[25];
It works! Now let’s look into Data browser:
Note the untranslatedName property: it has value of "Spanish: Castilian". Looks promising! So, let’s try:
var languageWithVendors = app.languagesWithVendors.itemByName("Spanish: Castilian");
And this does work again!