[Pmwiki-users] pmwiki localization ?

Patrick R. Michaud pmichaud
Wed Jul 30 09:41:07 CDT 2003


> Basically, we could have two localized files: one for "language tokens"
> ("Edit Page", "Search Wiki", ...) and one for messages. 

Actually, since PmWiki already allows extensive customization and
localization of the prompts--I don't know that we need to separate
items into separate tokens and message files--it can all be placed
in a customization file.  

> Both files will presumably contain the php equivalent of a {key,value}
> pair per line, and messages may need replaceable parts, so that you can
> re-use the same message in different situations. That is, messages should
> be referred to by numbers (1, 2, 3, ...), and the "value" of
> a message entry should contain the equivalent of C's "%s", like:
>    error "%s" from function "%s"
> and similar things.

Although this is one of the "classic" mechanisms for doing 
internationalization, it's probably overkill for PmWiki, and I've never 
liked referring to messages by an index number because it makes the
code hard to read.  Plus, PmWiki already has formatting available
(the equivalent of C's "%s") in its FmtPageName routine.  (One of the
problems with "%s" substitution is that the values being substituted
always have to be in the same sequence, which doesn't always work for some
languages.  I think PmWiki's $-substitutions are easier to deal with.)

So, it seems easier to me to just set PmWiki's configuration 
variables directly.  For example, last night Joris and I had a 
pretty good Nederlands translation running in less than an hour
(http://www.pmichaud.com/wiki/Development/LanguageNl) and it's 
implemented as a fairly straightforward 89-line PHP file.  Converting
PmWiki to Dutch is then as easy as adding include_once("local/lang-nl.php")
at the beginning of local.php.

And, of course, none of these approaches are mutually exclusive--if
one wanted to implement the messages/tokens in the classic manner
with token and message files, one could write an external PmWiki
module to support it.  But until/unless we come up with an orthogonal
and standard set of PmWiki skins in which to place the text, I think
it's probably more trouble than it's worth.  :-)

Pm



More information about the pmwiki-users mailing list