12.07.2015 Views

free openSS

free openSS

free openSS

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Annex B. Localization – Technical Aspects ❘ 39Client SideA normal GTK+-based text entry widget will provide an “Input Methods” context menu that can be openedby right clicking within the text area. This menu provides the list of all installed GTK+ IM modules, whichthe user can choose from. The menu is initialized by querying all installed modules for the engines theyprovide.From the client’s point of view, each text entry is represented by an IM context, which communicateswith the IM module after every key press event by calling a key filter function provided by the module.This allows the IM to intercept the key presses and translate them into characters. Non-character keys,such as function keys or control keys, are not usually intercepted. This allows the client to handle specialkeys, such as shortcuts.There are also interfaces for the other direction. The IM can also call the client for some actions by emittingGLib signals, for which the handlers may be provided by the client by connecting callbacks to the signals:“preedit_changed”Uncommitted (pre-edit) string is changed. The client may update the display, but notthe input buffer, to let the user see the keystrokes.“commit”Some characters are committed from the IM. The committed string is also passed sothat the client can take it into its input buffer.“retrieve_surrounding”The IM wants to retrieve some text around the cursor.“delete_surrounding”The IM wants to delete the text around the cursor. The client should delete the textportion around the cursor as requested.IM ModulesGTK+ input methods are implemented using loadable modules that provide entry functions for queryingand creating the desired IM context. These are used as interface with the “Input Methods” context menuin text entry areas.The IM module defines a new IM context class or classes and provides filter functions to be called by theclient upon key press events. It can determine proper action to the key and return TRUE if it means tointercept the event or FALSE to pass the event back to the client.Some IM (e.g., CJK and European) may do a stateful conversion which is incrementally matching theinput string with predefined patterns until each unique pattern is matched before committing theconverted string. During the partial matching, the IM emits the “preedit_changed” signal to the client forevery change, so that it can update the pre-edit string to the display. Finally, to commit characters, theIM emits the “commit” signal, along with the converted string as the argument, to the IM context. SomeIM (e.g., Thai) is context-sensitive. It needs to retrieve text around the cursor to determine the appropriateaction. This can be done through the “retrieve_surrounding” signal.In addition, the IM may request to delete some text from the client’s input buffer as required by Thaiadvanced IM. This is also used to correct the illegal sequences. This can be done via the “delete_surrounding”signal.LocalesAs mentioned in earlier, the GNU C library is internationalized according to POSIX and ISO/IEC 14652.Both locales are discussed in this section.Locale NamingA locale is described by its language, country and character set. The naming convention as given inOpenI18N guideline 26is:lang_territory.codeset[@modifiers]26Library of Congress, ISO 639-2 Registration Authority; available from lcweb.loc.gov/standards/iso639-2.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!