After reading our previous DocMaker 3.x blog posts, it's needless to say you're
getting quite good in using the DocMaker API: integrating a rich text editor, working with visitors, enhanced style manipulation,
using layers, ...
This small post will not enrich you with cool new features but give you some interesting
information to keep in mind when using different languages of InDesign Server.
Introduction
Adobe InDesign and Adobe InDesign Server are both available in different languages.
When using the DocMaker API, this can be important for several API calls. Let's
have a look.
Styles
Suppose your document contains several paragraph styles. There are several ways
to load the desired style from the collection.
| C# |
1
2
3
4
5
6
7
8
9
10
11
|
Document document;
ParagraphStyle myStyle;
// By index
myStyle = document.ParagraphStyles[3];
// By id
myStyle = document.ParagraphStyles["123"];
// By name
myStyle = document.ParagraphStyles.Single(style => style.Name == "myParagraphStyle");
|
The tricky part is in loading the style by name. Next to the paragraph styles the
designer created in the document, there are also default InDesign paragraph styles
available. These styles are always written between brackets: [Style Name].
The name of these default styles depend on the language of your InDesignServer instance.
eg. [Basic Paragraph] in English will be translated in an non-English InDesignServer
([Basis Alinea]).
It is important to know that following line of code will fail when using a localized
InDesignServer.
| C# |
1
|
ParagraphStyle myStyle = ParagraphStyles.Single(style => style.Name == "[Basic Paragraph]");
|
Languages
The same goes for languages in InDesign. Each language name is translated depending
on the language of InDesignServer.
eg. 'Dutch: 2005 Reform' can be translated to 'Nederlands: Nieuwe spelling'.
| C# |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
Document document;
InDesignLanguage myLanguage;
Guid adamLanguageId;
// By index
myLanguage = document.Languages[1];
// By id
myLanguage = document.Languages["573"];
// By ADAM language id
myLanguage = document.Languages[adamLanguageId];
// By name
myLanguage = document.Languages.Single(language => language.Name == "French");
|
Again, the last line will fail if English is not the current InDesignServer language.
Layers
When InDesign/InDesignServer creates a new layer, the default naming also depends
on the language. eg. 'Layer 1' and 'Laag 1'.
In following example the last line will return null if the layer does not exist.
| C# |
1
2
3
4
5
6
7
8
9
10
11
|
Document document;
Layer layer;
// By index
layer = document.Languages[0];
// By id
layer = document.Languages["368"];
// By name
layer = document.Languages.GetByName("Layer 1");
|
Wrapping up
With this new information you can keep following things in mind:
- Only load your object by name if you are 100% sure it can not be translated.
- A single DocMaker solution can use multiple InDesignServer installations, making
it possible to have a multi-language InDesignServer batch. This way, it is not unlikely
that a single document will eventually be used by different localized InDesignServer
instances.