How to implement the support for a new language?
The Microsoft .Net Framework organizes language support in the following way. Each language has a main language resource assembly. For example, English (en). Within each language, there may be culture / locale specific versions of a language resource assembly. For example, United States English (en-us) or British English (en-gb). Quark XML Author provides the same support for main language and locale specific language resources.
Figure 1: Locale specific versions of English supported by .Net
In addition, we need to differentiate between the Display Language and Editing Language within the context of Microsoft Office applications. The Display Language is the language displayed in the user interface (UI) of the Microsoft Office application. This includes menu items, toolbar buttons, ribbons, ribbon buttons, backstage views and Help. The Display Language only supports main language resources such as English (en), but not locale specific language resources such as United States English (en-us). The Editing Language is the language of the content that you are authoring on the Word canvas. This includes language-specific features such as dictionaries and grammar checking. The Editing Language supports locale specific language resources, “Figure”.
Figure 2: The user can specify both an editing language and a display language
Microsoft and Quark XML Author support using one language for the Display Language and a different language for the Editing Language. However, Quark XML Author does not support the authoring of multiple languages within a single Quark XML Author document.
Presently, Quark XML Author is distributed with the following Display language resources:
English main language
Spanish main language
Japanese main language
French main language
Quark XML Author supports the following languages:
Support for these languages must be enabled in Microsoft Word. East Asian languages will also require IME to input characters.
Figure 3: Choosing an editing language
Bidirectional language support
Bidirectional languages (right-to-left languages) refers to any writing system that is written from right to left and includes languages that require contextual shaping, such as Arabic, and languages that do not. Right-to-Left languages are written and read mainly from right to left, but some portions of the text, such as numbers and embedded Latin languages (e.g. English) are written and read left to right.
Bidirectional language support in Microsoft Office
Microsoft Office supports right-to-left functionality and features for languages that work in a right-to-left (or a combined right-to-left, left-to-right) environment for entering, editing, and displaying text.
Bidirectional language support in Quark XML Author
XML Author supports authoring in LTR and RTL layouts depending on the default editing language set in MS Word.
To support Bidirectional Text in XML Author, the following option must be disabled in Microsoft Word:
Figure 4: The option to automatically switch keyboard to match language of surrounding text must be disabled.
Configuring the XAS to allow support of direction attributes for elements
The Quark XML Author structure must be configured to allow support for direction attributes of elements. Use the directionAttribute datatype to enable Quark XML Author to support bidirectional text.
An example is shown below:
<Attributes> … <AttributeDef name="dir" datatype="directionAttribute" visible="false"/> <AttributeDef name="tablestyle" datatype="tableStyle" friendly="" visible="false"/> … </Attributes> The following corresponding changes are required in the XpressSchema.xsd file: <xs:attributeGroup name="fieldAttributes"> … <xs:enumeration value="directionAttribute"/> … </xs:attributeGroup> <xs:attributeGroup name="tableStyle"> … <xs:attribute name="tableDirection" type="xs:string" use="optional" /> … </xs:attributeGroup>
Configuring the user interface for bidirectional language support
The dir attribute sets the text direction for elements regardless of the text direction of the document. Once this attribute is set, UI controls can be used to set text direction.
For example, the Text Direction buttons can be configured in config.xml to facilitate the insertion of elements with a right-to-left or left-to-right text direction, as in Microsoft Word.
<buttonGroup id="TextDirection"> <toggleButton id ="TextDirectionLeftToRight"imageMso="TextDirectionLeftToRight"> <InternalClass name="ToggleReadingDirectionControl" directionAttribute="ltr" /> </toggleButton> <toggleButton id="TextDirectionRightToLeft" imageMso="TextDirectionRightToLeft"> <InternalClass name="ToggleReadingDirectionControl" directionAttribute="rtl" /> </toggleButton> </buttonGroup>
Figure 5: Text direction buttons.
Configuring bidirectional language support at the content level
Use the TextDirection formatting type to format attributes that will allow different text runs within a single paragraph.
<Formatting> ... <TextDirection name="ph" friendly="direction" TextDirectionAttributeName="dir"/> ... </Formatting>
The following changes must be made to the XpressSchema.xsd file:
<xs:element name="XpressSchema"> <xs:complexType> <xs:sequence> ... ... <xs:element name="TextDirection" minOccurs="0"> <xs:complexType> <xs:attribute name="name" type="xs:string" use="required"/> <xs:attribute name="friendly" type="xs:string" use="optional"/> <xs:attribute name="TextDirectionAttributeName" type="xs:string" use="required"/> ... ... </xs:sequence> </xs:complexType> </xs:element>
Configuring bidirectional language support at the element level
Text runs will be created for blocks of text whose text direction is different as compared to the element.
<topic id ="" xmlns:inv="urn:xpressauthor:xpressdocument" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink" xsi:noNamespaceSchemaLocation="BUSDOCS.xsd" xml:lang="ar" dir="rtl"> <title/><body/></topic>
The XML snippet generated for left-to-right text in a paragraph:
<body> <p widow-orphan="true" xml:id="IDd3ab0288-d634-4e82-90b1-c1ecd1b3ee5f">سشةحمث <ph dir="ltr"> sample text </ph> </p> </body
Add the following to the element definition to support multi-directonal text runs:
<Formatting> -------- <FormattingType name="ph"/> </Formatting>
Configuring bidirectional language support at the document level
To configure bidirectional language support at the document level, see dir.