CopperSpice API  1.9.1
Internationalization

Explanation regarding how to adapt a program which needs to support multiple written languages. More...

Classes

class  QLocale
 Formats data based on a given language or country More...
 
class  QTextCodec
 Converts between text encodings and QString More...
 
class  QTextDecoder
 State-based decoder More...
 
class  QTextEncoder
 State-based encoder More...
 
class  QTranslator
 Internationalization support for text output More...
 

Detailed Description

Software applications may need to support text strings in multiple languages. This is accomplished in a CopperSpice program by marking all the strings which need to be translated to another another language. The allows the programmer to write all the text strings in one specific language and provide translation tables which are then used at run time.

The localization process is what provides the necessary adjustments things like currency symbols and the date formats.

Writing Systems

A program written with English text can be adapted for countries like Canada, Australia, or England with relatively few changes. Providing the translations and other localization changes for regions like Japan, Korea, or Germany will require more substantial work.

Input widgets and text drawing methods offer built in support for rendering text which contains glyphs from a variety of different written languages.

Special line breaking behavior
Some of the Asian languages are written without spaces between words. Line breaks can occur either after every character (with exceptions) as in Chinese, Japanese and Korean, or after logical word boundaries as in Thai.
Bidirectional writing
Arabic and Hebrew are written from right to left, except for numbers and embedded English text which is written left to right.
For more information refer to Unicode Technical Annex #9.
Non-spacing or diacritical marks (accents or umlauts in European languages)
Some languages such as Vietnamese make extensive use of these marks and some characters can have more than one mark at the same time to clarify pronunciation.
Ligatures
Some pairs of characters get replaced by a combined glyph forming a ligature. Common examples are the fl and fi ligatures used in typesetting US and European books.

Special Cases

The following are special cases which may require some additional work.

QPainter::drawText(int x, int y, const QString8 &str)
Always draws the string with the left edge at the position specified with the x, y parameters. This will usually give you left aligned strings. Arabic and Hebrew application strings are usually right aligned so for these languages use the version of drawText() which takes a QRect. This will align in accordance with the language.
QTextLayout
In some languages such as Arabic or languages from India, the width and shape of a glyph changes depending on the surrounding characters, which QTextLayout takes into account. Writing custom input controls usually requires a certain knowledge of the scripts being utilized. Subclassing QLineEdit or QTextEdit is suggested for these situations.

Additional Documentation