10.6 Localization of Resource Databases

We’ve seen that X resources are a useful way to allow the localization of strings—rather than hardcoding its strings, an X client can look them all up by name from a locale-dependent resource file. The twist here is that although resource values can be localized, and may contain text in the encoding of the locale, resource names must still be hardcoded into the application. As you might expect, R5 specifies that resource names in the Host Portable Character Encoding are always supported, and that any other encodings are implementation-dependent. What this means is that a Chinese user who wishes to customize the behavior of an application written by a Japanese programmer will have to specify values for resources that are named using Latin characters in the X Portable Character Set. Those resource names may be English phonetic representations of Japanese words which are mnemonic to the Japanese programmer, but which are meaningless to the Chinese (or American) user. This situation is unfortunate but there is no way around it within the scope of the X Resource Manager mechanisms. If resource names are to be localized, they would have to be looked up in a database as well, and then we would need hardcoded names for the names. Another approach would be to use resource numbers in place of resource names. These remain constant across all locales, but where a resource name is mnemonic to the original programmer, at least, a resource number would be ...

Get XLIB Programming Manual, Rel. 5, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.