New _m() gettext wrapper with smart detection of plugin domains. Plugin base class registers your gettext files if present at initialization.

update_pot.sh replaced with update_po_templates.php which can do core, plugins, or all (default).
Top-level Makefile added to build .mo files for plugins as well as core.

As described on list:
http://lists.status.net/pipermail/statusnet-dev/2009-December/002869.html
This commit is contained in:
Brion Vibber
2009-12-08 12:17:11 -08:00
parent 3536f01258
commit 4b5e977a7b
43 changed files with 1873 additions and 267 deletions

View File

@@ -177,7 +177,7 @@ class MapstractionPlugin extends Plugin
$action->elementStart('div', array('id' => 'entity_map',
'class' => 'section'));
$action->element('h2', null, _('Map'));
$action->element('h2', null, _m('Map'));
$action->element('div', array('id' => 'map_canvas',
'class' => 'gray smallmap',
@@ -188,7 +188,7 @@ class MapstractionPlugin extends Plugin
array('nickname' => $action->trimmed('nickname')));
$action->element('a', array('href' => $mapUrl),
_("Full size"));
_m("Full size"));
$action->elementEnd('div');
}

View File

@@ -68,10 +68,10 @@ class AllmapAction extends MapAction
}
if ($this->page == 1) {
return sprintf(_("%s friends map"),
return sprintf(_m("%s friends map"),
$base);
} else {
return sprintf(_("%s friends map, page %d"),
return sprintf(_m("%s friends map, page %d"),
$base,
$this->page);
}

View File

@@ -0,0 +1,48 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-12-07 20:38-0800\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: allmap.php:71
#, php-format
msgid "%s friends map"
msgstr ""
#: allmap.php:74
#, php-format
msgid "%s friends map, page %d"
msgstr ""
#: map.php:72
msgid "No such user."
msgstr ""
#: map.php:79
msgid "User has no profile."
msgstr ""
#: usermap.php:71
#, php-format
msgid "%s map, page %d"
msgstr ""
#: MapstractionPlugin.php:180
msgid "Map"
msgstr ""
#: MapstractionPlugin.php:191
msgid "Full size"
msgstr ""

View File

@@ -69,14 +69,14 @@ class MapAction extends OwnerDesignAction
$this->user = User::staticGet('nickname', $nickname);
if (!$this->user) {
$this->clientError(_('No such user.'), 404);
$this->clientError(_m('No such user.'), 404);
return false;
}
$this->profile = $this->user->getProfile();
if (!$this->profile) {
$this->serverError(_('User has no profile.'));
$this->serverError(_m('User has no profile.'));
return false;
}

View File

@@ -68,7 +68,7 @@ class UsermapAction extends MapAction
if ($this->page == 1) {
return $base;
} else {
return sprintf(_("%s map, page %d"),
return sprintf(_m("%s map, page %d"),
$base,
$this->page);
}