Ticket #22 (assigned enhancement)

Opened 1 year ago

Last modified 1 year ago

Gettext localization

Reported by: jwa Assigned to: bergie (accepted)
Priority: major Milestone: MidCOM 3.0
Component: MidCOM core Version:
Keywords: Cc:

Description

Localization should be moved from Midgard's own to gettext

Change History

06/02/07 12:58:20 changed by jwa

  • component changed from MidCOM component to MidCOM core.

06/05/07 15:25:59 changed by bergie

Should be fairly easy to switch to Gettext by mapping each component to a separate Gettext "message domain".

Something like the following:

// Inform gettext about a new localization domain when a component is loaded
bindtextdomain('net.nemein.discussion', MIDCOM_ROOT.'lib/net/nemein/discussion/locale')

// Show localized message
echo dgettext('net.nemein.discussion', 'new reply');

For backwards compatibility, we should be able to wrap this quite easily with $_MIDCOM->i18n->get_string($stringid, $component = null)

Then we need to consider how to extract strings with xgettext if a component uses this wrapper instead of good plain old gettext() function.

Advantages with using Gettext:

  • Performance (probably, at least when using PHP's gettext extension that is written in C)
  • Possibility to edit translations using an external translation client
  • Compatibility with translation workflows used with all other free software projects
  • Possibility to separate plural and singular phrases in localications
  • Possibility to remove at least some code from MidCOM

07/24/07 11:35:10 changed by bergie

  • owner changed from tarjei to bergie.
  • status changed from new to assigned.