[dokuwiki] Internationalization in plugin descriptions (via plugin.info.txt)

  • From: Luis Machuca Bezzaza <ryan.chappelle@xxxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Fri, 03 Dec 2010 03:23:36 -0300

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello everyone.

I had a talk at the IRC channel regarding the usage of plugin.info.txt as
the new standard manner to provide plugin information[1] in DokuWiki.

Although it is very good (it solves, for example, some git issues with
directory names), the one thing that keeps me from using it is the lack of
internationalization. The strings are fixated, one per field, whereas I like
to provide a language-dependant string in the 'descr' (description) field
via $this->getLang()[2]. Makes me feel worse, in the least, as I see the
current documentation states the file as "required" and overriding the
function at derived hierarchy as "shouldn't be needed" [3].

I would like to ask what the method is to provide a plugin.info.txt file yet
at the same time override specific fields in the loaded array; if such a
thing is not available I'd like to propose a change to the core Plugin class
 to do so that retains, for the most part, backwards compatibility --
essentially by adding a specific tag to the field to be overriden locally by
the Plugin Manager. It shouldn't be too hard to modify the parsing function
to accept entry like this for example:

- ----
base   example
author My Full Name
...
desc   ...an Example of how a plugin description looks like | LOCAL
url    http://www.dokuwiki.org/plugin:example
- ----

Another choice would be adding a new field which indicates which fields are
postprocessed, but I personally think it is overkill:

- ----
...
desc   ...an Example of how a plugin description looks like
url    http://www.dokuwiki.org/plugin:example
local  desc
- ----

Yet another alternative would be to simply to leave the file syntax as-is
and have the plugin manager automatically search for a previously
agreed-upon provided field in the language customization files, say
$lang['desc'] and $lang['name'].

I'm assuming here that the one field of interest to provide translations for
is the description field, and maybe the name. I don't think the author, date
or URL are going to change somehow across languages. But I guess I could be
proven wrong on any and all accounts...

Another IRC user, lupo I think, suggested to provide an assortment of local
files, like de.plugin.info.txt, but I discarded the idea because I think
most of the important information code-wise is redundant, and it would
needlessly clutter the plugin file structure. Whereas a lang/??/lang.php
file with localized strings is already standard procedure.

When the required component is found, the plugin manager would still load
the existing string in the file as the default description, but load and
replace with $this->getLang($fieldname) if made available.

For me the advantages are obvious, if admittedly small. There's no
particular reason why the plugin manager should assume everyone looking at
the configuration pages knows English (that's the point of providing
localized configuration descriptions already). Considering the nature of the
DW platform, its administration shouldn't be English- (or any language)
centric. As an addendum, the existence of plugins such as 'credits', which
would make this information accessible to the general public, as well as the
proposals for a new web Plugin Repository, which was a point touched back at
the IRC channel, make the availability of such information in a
world-accessible way make this a more patent issue.

Implementing this change at the core would make the overriding of getInfo()
at derived hierarchy for the sole purpose of changing one field unnecessary,
without a loss of functionality and without demanding any significant effort
from the plugin developers, as several of them include translations for some
of their plugin features already.

Any thoughts on this? Would appreciate comments from international
developers in this issue.

- ----

Relevant conversation:
http://irc.dokuwiki.org/index.php?d=2010-12-02#msg283854

Relevant links:
[1] http://www.dokuwiki.org/devel:plugin_info
[2] http://www.dokuwiki.org/devel:plugin_file_structure
[3] http://dev.splitbrain.org/reference/dokuwiki/inc/plugin.php.source.html#l20

- --
- ----
Luis Machuca Bezzaza
Secretario (S) GULIX - Grupo de Usuarios de GNU/Linux de la IX Región
http://www.gulix.cl/
- ----

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)

iEYEARECAAYFAkz4jOYACgkQ2o3b1t8iZA/IZwCfahUYbZX3a5uvzIYUQJhedhOl
XHgAn3wX9haUtwQMSZ42pT35HglVx/pa
=+J2b
-----END PGP SIGNATURE-----
-- 
DokuWiki mailing list - more info at
http://www.dokuwiki.org/mailinglist

Other related posts: