logo_kerberos.gif

Projects/Localization

From K5Wiki
< Projects
Revision as of 10:08, 9 June 2011 by Ghudson (talk | contribs) (Design)

Jump to: navigation, search
This is an early stage project for MIT Kerberos. It is being fleshed out by its proponents. Feel free to help flesh out the details of this project. After the project is ready, it will be presented for review and approval.


This project is targeted at release 1.10.


Overview

The purpose of this project is to add infrastructure for localization of user interface messages in the krb5 tree, using gettext.

Design

Basic infrastructure

Macros will be added to k5-platform.h to define _() and N_(), and to null out calls to bindtextdomain(), setlocale(), and dgettext() when krb5 is built without localization support.

A single text domain, mit-krb5, will be used for all messages.

krb5int_lib_init() will be extended to call bindtextdomain() for the mit-krb5 textdomain.

Strings in the tree which should be translated will be marked up with _(), which will be defined to dgettext("mit-krb5", string) when built with localization support. Strings which will be translated later will be marked up with N_().

Build infrastructure will be added to run xgettext to extract marked strings from C source files into a pot file, and to convert po files into mo files and install them.

com_err library

There are several versions of the com_err library. MIT krb5 is typically built either with its own internal version of com_err, or with the system com_err which typically comes from e2fsprogs. The following changes will be made to the internal krb5 com_err and have also been submitted to the e2fsprogs maintainer for its version of com_err:

  • compile_et defines N_() to a no-op and marks up error message strings with it.
  • If compile_et is passed the --textdomain option, it stores the text domain as a string at the end of the error table, before the null terminator.
  • If compile_et is also passed the --localedir option, it stores it in the error table after the text domain.
  • If an error table has a text domain, error_message() will call dgettext on the text domain and error string.
  • If an error table also has a locale directory, add_error_table() will call bindtextdomain on the text domain and locale direcetory.

If we build against a system com_err with no support for compile_et --textdomain, we will translate com_err results in krb5int_get_error(), which should reach most uses.

Programs in the tree such as kinit will call setlocale() at startup.

The test framework will be modified to set the locale to C to ensure that it sees the expected (untranslated) output.

Markup

Relevant Mailing List Threads

http://mailman.mit.edu/pipermail/krbdev/2011-May/010011.html