summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-06-02 13:12:36 -0700
committerBharat Mediratta <bharat@menalto.com>2009-06-02 13:12:36 -0700
commit76fcb8e654823fc9f829f7b6eced5905318634ec (patch)
tree10825a0610855f27ef0cc1b7286d98ee84a4f950
parent61e7b9b8f0803dbc968bfd760b6a0bd77e8c7853 (diff)
parent4f50357a3873bb612abf1e5fddebe9ee9cbadf40 (diff)
Merge branch 'master' of git@github.com:gallery/gallery3
-rw-r--r--modules/gallery/controllers/l10n_client.php102
-rw-r--r--modules/gallery/css/l10n_client.css14
-rw-r--r--modules/gallery/helpers/l10n_client.php76
-rw-r--r--modules/gallery/helpers/p.php2
-rw-r--r--modules/gallery/js/l10n_client.js100
-rw-r--r--modules/gallery/libraries/I18n.php27
-rw-r--r--modules/gallery/models/item.php6
-rw-r--r--modules/gallery/tests/xss_data.txt12
-rw-r--r--modules/gallery/views/l10n_client.html.php41
-rw-r--r--modules/gallery/views/move_tree.html.php4
-rw-r--r--modules/image_block/views/image_block_block.html.php2
-rw-r--r--modules/organize/views/organize_thumb_grid.html.php2
-rw-r--r--modules/recaptcha/views/form_recaptcha.html.php1
-rw-r--r--modules/search/views/search.html.php2
-rw-r--r--themes/default/views/album.html.php2
-rw-r--r--themes/default/views/photo.html.php2
16 files changed, 293 insertions, 102 deletions
diff --git a/modules/gallery/controllers/l10n_client.php b/modules/gallery/controllers/l10n_client.php
index c3a76659..aa93a758 100644
--- a/modules/gallery/controllers/l10n_client.php
+++ b/modules/gallery/controllers/l10n_client.php
@@ -24,11 +24,36 @@ class L10n_Client_Controller extends Controller {
access::forbidden();
}
- $input = Input::instance();
- $message = $input->post("l10n-message-source");
- $translation = $input->post("l10n-edit-target");
- $key = I18n::get_message_key($message);
$locale = I18n::instance()->locale();
+ $input = Input::instance();
+ $key = $input->post("l10n-message-key");
+
+ $root_message = ORM::factory("incoming_translation")
+ ->where(array("key" => $key,
+ "locale" => "root"))
+ ->find();
+
+ if (!$root_message->loaded) {
+ throw new Exception("@todo bad request data / illegal state");
+ }
+ $is_plural = I18n::is_plural_message(unserialize($root_message->message));
+
+ if ($is_plural) {
+ $plural_forms = l10n_client::plural_forms($locale);
+ $translation = array();
+ foreach($plural_forms as $plural_form) {
+ $value = $input->post("l10n-edit-plural-translation-$plural_form");
+ if (null === $value || !is_string($value)) {
+ throw new Exception("@todo bad request data");
+ }
+ $translation[$plural_form] = $value;
+ }
+ } else {
+ $translation = $input->post("l10n-edit-translation");
+ if (null === $translation || !is_string($translation)) {
+ throw new Exception("@todo bad request data");
+ }
+ }
$entry = ORM::factory("outgoing_translation")
->where(array("key" => $key,
@@ -38,7 +63,7 @@ class L10n_Client_Controller extends Controller {
if (!$entry->loaded) {
$entry->key = $key;
$entry->locale = $locale;
- $entry->message = serialize($message);
+ $entry->message = $root_message->message;
$entry->base_revision = null;
}
@@ -71,19 +96,6 @@ class L10n_Client_Controller extends Controller {
url::redirect("albums/1");
}
- private static function _l10n_client_form() {
- $form = new Forge("l10n_client/save", "", "post", array("id" => "gL10nClientSaveForm"));
- $group = $form->group("l10n_message");
- $group->hidden("l10n-message-source")->value("");
- $group->textarea("l10n-edit-target");
- $group->submit("l10n-edit-save")->value(t("Save translation"));
- // TODO(andy_st): Avoiding multiple submit buttons for now (hassle with jQuery form plugin).
- // $group->submit("l10n-edit-copy")->value(t("Copy source"));
- // $group->submit("l10n-edit-clear")->value(t("Clear"));
-
- return $form;
- }
-
private static function _l10n_client_search_form() {
$form = new Forge("l10n_client/search", "", "post", array("id" => "gL10nSearchForm"));
$group = $form->group("l10n_search");
@@ -94,41 +106,47 @@ class L10n_Client_Controller extends Controller {
}
public static function l10n_form() {
- if (!user::active()->admin) {
- access::forbidden();
- }
-
$calls = I18n::instance()->call_log();
+ $locale = I18n::instance()->locale();
if ($calls) {
+ $translations = array();
+ foreach (Database::instance()
+ ->select("key", "translation")
+ ->from("incoming_translations")
+ ->where(array("locale" => $locale))
+ ->get()
+ ->as_array() as $row) {
+ $translations[$row->key] = unserialize($row->translation);
+ }
+ // Override incoming with outgoing...
+ foreach (Database::instance()
+ ->select("key", "translation")
+ ->from("outgoing_translations")
+ ->where(array("locale" => $locale))
+ ->get()
+ ->as_array() as $row) {
+ $translations[$row->key] = unserialize($row->translation);
+ }
+
$string_list = array();
- foreach ($calls as $call) {
+ $cache = array();
+ foreach ($calls as $key => $call) {
list ($message, $options) = $call;
- // Note: Don't interpolate placeholders for the actual translation input field.
- // TODO: Use $options to generate a preview.
- if (is_array($message)) {
- // TODO: Handle plural forms.
- // Translate each message. If it has a plural form, get
- // the current locale's plural rules and all plural translations.
- continue;
- }
- $source = $message;
- $translation = '';
- $options_for_raw_translation = array();
- if (isset($options['count'])) {
- $options_for_raw_translation['count'] = $options['count'];
- }
- if (I18n::instance()->has_translation($message, $options_for_raw_translation)) {
- $translation = I18n::instance()->translate($message, $options_for_raw_translation);
- }
- $string_list[] = array('source' => $source,
+ // Ensure that the message is in the DB
+ l10n_scanner::process_message($message, $cache);
+ // Note: Not interpolating placeholders for the actual translation input field.
+ // TODO: Might show a preview w/ interpolations (using $options)
+ $translation = isset($translations[$key]) ? $translations[$key] : '';
+ $string_list[] = array('source' => $message,
+ 'key' => $key,
'translation' => $translation);
}
$v = new View('l10n_client.html');
$v->string_list = $string_list;
- $v->l10n_form = self::_l10n_client_form();
$v->l10n_search_form = self::_l10n_client_search_form();
+ $v->plural_forms = l10n_client::plural_forms($locale);
return $v;
}
diff --git a/modules/gallery/css/l10n_client.css b/modules/gallery/css/l10n_client.css
index 8973715f..6616f511 100644
--- a/modules/gallery/css/l10n_client.css
+++ b/modules/gallery/css/l10n_client.css
@@ -145,7 +145,6 @@ how it wants to round. */
margin:0em;
}
-
#l10n-client-string-editor {
display:none;
float:left;
@@ -168,18 +167,13 @@ how it wants to round. */
#gL10nClientSaveForm {
padding:0em;}
- #gL10nClientSaveForm .form-textarea {
- height:13em;
- font-size:1em; line-height:1.25em;
- width:95%;}
-
- #gL10nClientSaveForm .form-submit {
- margin-top: 0em;}
-
-
#l10n-client form ul,
#l10n-client form li,
#l10n-client form input[type=submit],
#l10n-client form input[type=text] {
display: inline ! important ;
}
+
+#l10n-client form .hidden {
+ display: none;
+}
diff --git a/modules/gallery/helpers/l10n_client.php b/modules/gallery/helpers/l10n_client.php
index d26739f5..4e905c6c 100644
--- a/modules/gallery/helpers/l10n_client.php
+++ b/modules/gallery/helpers/l10n_client.php
@@ -200,4 +200,80 @@ class l10n_client_Core {
// @todo Move messages out of outgoing into incoming, using new rev?
// @todo show which messages have been rejected / are pending?
}
+
+ /**
+ * Plural forms.
+ */
+ static function plural_forms($locale) {
+ $parts = explode('_', $locale);
+ $language = $parts[0];
+
+ // Data from CLDR 1.6 (http://unicode.org/cldr/data/common/supplemental/plurals.xml).
+ // Docs: http://www.unicode.org/cldr/data/charts/supplemental/language_plural_rules.html
+ switch ($language) {
+ case 'az':
+ case 'fa':
+ case 'hu':
+ case 'ja':
+ case 'ko':
+ case 'my':
+ case 'to':
+ case 'tr':
+ case 'vi':
+ case 'yo':
+ case 'zh':
+ case 'bo':
+ case 'dz':
+ case 'id':
+ case 'jv':
+ case 'ka':
+ case 'km':
+ case 'kn':
+ case 'ms':
+ case 'th':
+ return array('other');
+
+ case 'ar':
+ return array('zero', 'one', 'two', 'few', 'many', 'other');
+
+ case 'lv':
+ return array('zero', 'one', 'other');
+
+ case 'ga':
+ case 'se':
+ case 'sma':
+ case 'smi':
+ case 'smj':
+ case 'smn':
+ case 'sms':
+ return array('one', 'two', 'other');
+
+ case 'ro':
+ case 'mo':
+ case 'lt':
+ case 'cs':
+ case 'sk':
+ case 'pl':
+ return array('one', 'few', 'other');
+
+ case 'hr':
+ case 'ru':
+ case 'sr':
+ case 'uk':
+ case 'be':
+ case 'bs':
+ case 'sh':
+ case 'mt':
+ return array('one', 'few', 'many', 'other');
+
+ case 'sl':
+ return array('one', 'two', 'few', 'other');
+
+ case 'cy':
+ return array('one', 'two', 'many', 'other');
+
+ default: // en, de, etc.
+ return array('one', 'other');
+ }
+ }
} \ No newline at end of file
diff --git a/modules/gallery/helpers/p.php b/modules/gallery/helpers/p.php
index c3074c23..0a6210dc 100644
--- a/modules/gallery/helpers/p.php
+++ b/modules/gallery/helpers/p.php
@@ -18,7 +18,7 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class p_Core {
- function clean($dirty_html) {
+ static function clean($dirty_html) {
return html::specialchars($dirty_html);
}
}
diff --git a/modules/gallery/js/l10n_client.js b/modules/gallery/js/l10n_client.js
index f43671f1..efd956e2 100644
--- a/modules/gallery/js/l10n_client.js
+++ b/modules/gallery/js/l10n_client.js
@@ -90,6 +90,40 @@ jQuery.extend(Gallery, {
this.setString = function(index, data) {
l10n_client_data[index]['translation'] = data;
}
+ // Display the source message
+ this.showSourceMessage = function(source, is_plural) {
+ if (is_plural) {
+ var pretty_source = '[one] - ' + source['one'] + "\n";
+ pretty_source += '[other] - ' + source['other'];
+ } else {
+ var pretty_source = source;
+ }
+ $('#l10n-client-string-editor .source-text').text(pretty_source);
+ }
+ this.isPluralMessage = function(message) {
+ return typeof(message) == 'object';
+ }
+ this.updateTranslationForm = function(translation, is_plural) {
+ $('.translationField').addClass('hidden');
+ if (is_plural) {
+ if (typeof(translation) != 'object') {
+ translation = {};
+ }
+ var num_plural_forms = plural_forms.length;
+ for (var i = 0; i < num_plural_forms; i++) {
+ var form = plural_forms[i];
+ if (translation[form] == undefined) {
+ translation[form] = '';
+ }
+ $('#l10n-edit-plural-translation-' + form)
+ .attr('value', translation[form]);
+ $('#plural-' + form).removeClass('hidden');
+ }
+ } else {
+ $('#l10n-edit-translation').attr('value', translation);
+ $('#l10n-edit-translation').removeClass('hidden');
+ }
+ }
// Filter the the string list by a search string
this.filter = function(search) {
if(search == false || search == '') {
@@ -126,11 +160,12 @@ Gallery.behaviors.l10nClient = function(context) {
$('#l10n-client-string-select li').removeClass('active');
$(this).addClass('active');
var index = $('#l10n-client-string-select li').index(this);
-
- $('#l10n-client-string-editor .source-text').text(Gallery.l10nClient.getString(index, 'source'));
- $("#gL10nClientSaveForm input[name='l10n-message-source']").val(Gallery.l10nClient.getString(index, 'source'));
- $('#gL10nClientSaveForm #l10n-edit-target').val(Gallery.l10nClient.getString(index, 'translation'));
-
+ var source = Gallery.l10nClient.getString(index, 'source');
+ var key = Gallery.l10nClient.getString(index, 'key');
+ var is_plural = Gallery.l10nClient.isPluralMessage(source);
+ Gallery.l10nClient.showSourceMessage(source, is_plural);
+ Gallery.l10nClient.updateTranslationForm(Gallery.l10nClient.getString(index, 'translation'), is_plural);
+ $("#gL10nClientSaveForm input[name='l10n-message-key']").val(key);
Gallery.l10nClient.selected = index;
});
@@ -165,23 +200,46 @@ Gallery.behaviors.l10nClient = function(context) {
$('#gL10nClientSaveForm').ajaxForm({
dataType: "json",
success: function(data) {
- // Store string in local js
- Gallery.l10nClient.setString(Gallery.l10nClient.selected, $('#gL10nClientSaveForm #l10n-edit-target').val());
-
- // Mark string as translated.
- $('#l10n-client-string-select li').eq(Gallery.l10nClient.selected).removeClass('untranslated').removeClass('active').addClass('translated').text($('#gL10nClientSaveForm #l10n-edit-target').val());
-
- // Empty input fields.
- $('#l10n-client-string-editor .source-text').html('');
- $('#gL10nClientSaveForm #l10n-edit-target').val('');
- $("#gL10nClientSaveForm input[name='l10n-message-source']").val('');
- },
- error: function(xmlhttp) {
- // TODO: Localize this message
- alert('An HTTP error @status occured (or empty response).'.replace('@status', xmlhttp.status));
- }
- });
+ var source = Gallery.l10nClient.getString(Gallery.l10nClient.selected, 'source');
+ var is_plural = Gallery.l10nClient.isPluralMessage(source);
+ var num_plural_forms = plural_forms.length;
+
+ // Store translation in local js
+ if (is_plural) {
+ var translation = {};
+ for (var i = 0; i < num_plural_forms; i++) {
+ var form = plural_forms[i];
+ translation[form] = $('#gL10nClientSaveForm #l10n-edit-plural-translation-' + form).attr('value');
+ }
+ } else {
+ translation = $('#l10n-edit-translation').attr('value');
+ }
+ Gallery.l10nClient.setString(Gallery.l10nClient.selected, translation);
+
+ // Mark message as translated.
+ $('#l10n-client-string-select li').eq(Gallery.l10nClient.selected).removeClass('untranslated').removeClass('active').addClass('translated');
+
+ // Clear the translation form fields
+ Gallery.l10nClient.showSourceMessage('', false);
+ $('#gL10nClientSaveForm #l10n-edit-translation').val('');
+
+ for (var i = 0; i < num_plural_forms; i++) {
+ var form = plural_forms[i];
+ $('#gL10nClientSaveForm #l10n-edit-plural-translation-' + form).val('');
+ }
+ $("#gL10nClientSaveForm input[name='l10n-message-key']").val('');
+ },
+ error: function(xmlhttp) {
+ // TODO: Localize this message
+ alert('An HTTP error @status occured (or empty response).'.replace('@status', xmlhttp.status));
+ }
+ });
+ // TODO: Add copy/clear buttons (without ajax behavior)
+ /* <input type="submit" name="l10n-edit-copy" value="<?= t("Copy source") ?>"/>
+ <input type="submit" name="l10n-edit-clear" value="<?= t("Clear") ?>"/>
+ */
+ // TODO: Handle plurals in copy button
// Copy source text to translation field on button click.
$('#gL10nClientSaveForm #l10n-edit-copy').click(function() {
diff --git a/modules/gallery/libraries/I18n.php b/modules/gallery/libraries/I18n.php
index f2801169..03a6d8f6 100644
--- a/modules/gallery/libraries/I18n.php
+++ b/modules/gallery/libraries/I18n.php
@@ -148,30 +148,37 @@ class I18n_Core {
public function has_translation($message, $options=null) {
$locale = empty($options['locale']) ? $this->_config['default_locale'] : $options['locale'];
- $count = empty($options['count']) ? null : $options['count'];
- $values = $options;
- unset($values['locale']);
- $this->log($message, $options);
$entry = $this->lookup($locale, $message);
if (null === $entry) {
return false;
- } else if (!is_array($entry)) {
+ } else if (!is_array($message)) {
return $entry !== '';
} else {
- $plural_key = self::get_plural_key($locale, $count);
- return isset($entry[$plural_key])
- && $entry[$plural_key] !== null
- && $entry[$plural_key] !== '';
+ if (!is_array($entry) || empty($entry)) {
+ return false;
+ }
+ // It would be better to verify that all the locale's plural forms have a non-empty
+ // translation, but this is fine for now.
+ foreach ($entry as $value) {
+ if ($value === '') {
+ return false;
+ }
+ }
+ return true;
}
}
- public static function get_message_key($message) {
+ static function get_message_key($message) {
$as_string = is_array($message) ? implode('|', $message) : $message;
return md5($as_string);
}
+ static function is_plural_message($message) {
+ return is_array($message);
+ }
+
private function interpolate($locale, $string, $values) {
// TODO: Handle locale specific number formatting.
diff --git a/modules/gallery/models/item.php b/modules/gallery/models/item.php
index 9406f5d9..10bad0b2 100644
--- a/modules/gallery/models/item.php
+++ b/modules/gallery/models/item.php
@@ -395,7 +395,7 @@ class Item_Model extends ORM_MPTT {
* @param boolean (optional) $center_vertically Center vertically (default: false)
* @return string
*/
- public function thumb_tag($extra_attrs=array(), $max=null, $center_vertically=false) {
+ public function thumb_img($extra_attrs=array(), $max=null, $center_vertically=false) {
list ($height, $width) = $this->scale_dimensions($max);
if ($center_vertically && $max) {
// The constant is divide by 2 to calculate the file and 10 to convert to em
@@ -448,7 +448,7 @@ class Item_Model extends ORM_MPTT {
* @param array $extra_attrs Extra attributes to add to the img tag
* @return string
*/
- public function resize_tag($extra_attrs) {
+ public function resize_img($extra_attrs) {
$attrs = array_merge($extra_attrs,
array("src" => $this->resize_url(),
"alt" => $this->title,
@@ -464,7 +464,7 @@ class Item_Model extends ORM_MPTT {
* @param array $extra_attrs
* @return string
*/
- public function movie_tag($extra_attrs) {
+ public function movie_img($extra_attrs) {
$attrs = array_merge($extra_attrs,
array("id" => "player",
"style" => "display:block;width:400px;height:300px")
diff --git a/modules/gallery/tests/xss_data.txt b/modules/gallery/tests/xss_data.txt
index 4aaa520d..67f293dd 100644
--- a/modules/gallery/tests/xss_data.txt
+++ b/modules/gallery/tests/xss_data.txt
@@ -195,14 +195,14 @@ modules/gallery/views/l10n_client.html.php 29 DIRTY $string_l
modules/gallery/views/move_browse.html.php 4 DIRTY $source->id
modules/gallery/views/move_browse.html.php 39 DIRTY $tree
modules/gallery/views/move_browse.html.php 42 DIRTY $source->id
-modules/gallery/views/move_tree.html.php 2 DIRTY $parent->thumb_tag(array(), 25)
+modules/gallery/views/move_tree.html.php 2 DIRTY $parent->thumb_img(array(), 25)
modules/gallery/views/move_tree.html.php 4 DIRTY $parent->id
modules/gallery/views/move_tree.html.php 4 CLEAN $parent->title
modules/gallery/views/move_tree.html.php 6 DIRTY $parent->id
modules/gallery/views/move_tree.html.php 6 CLEAN $parent->title
modules/gallery/views/move_tree.html.php 8 DIRTY $parent->id
modules/gallery/views/move_tree.html.php 10 DIRTY $child->id
-modules/gallery/views/move_tree.html.php 11 DIRTY $child->thumb_tag(array(), 25)
+modules/gallery/views/move_tree.html.php 11 DIRTY $child->thumb_img(array(), 25)
modules/gallery/views/move_tree.html.php 13 DIRTY $child->id
modules/gallery/views/move_tree.html.php 13 CLEAN $child->title
modules/gallery/views/move_tree.html.php 15 DIRTY $child->id
@@ -335,7 +335,7 @@ modules/organize/views/organize_thumb_grid.html.php 7 DIRTY $child->i
modules/organize/views/organize_thumb_grid.html.php 7 DIRTY $child->id
modules/organize/views/organize_thumb_grid.html.php 8 DIRTY $child->id
modules/organize/views/organize_thumb_grid.html.php 8 DIRTY $item_class
-modules/organize/views/organize_thumb_grid.html.php 9 DIRTY $child->thumb_tag(array("class" => "gThumbnail"), $thumbsize, true)
+modules/organize/views/organize_thumb_grid.html.php 9 DIRTY $child->thumb_img(array("class" => "gThumbnail"), $thumbsize, true)
modules/recaptcha/views/admin_recaptcha.html.php 5 DIRTY $form->get_key_url
modules/recaptcha/views/admin_recaptcha.html.php 8 DIRTY $form
modules/recaptcha/views/admin_recaptcha.html.php 21 DIRTY $public_key
@@ -406,7 +406,7 @@ modules/rss/views/rss_block.html.php 8 DIRTY $title
modules/search/views/search.html.php 11 CLEAN $q
modules/search/views/search.html.php 30 DIRTY $item_class
modules/search/views/search.html.php 31 DIRTY $item->id
-modules/search/views/search.html.php 32 DIRTY $item->thumb_tag()
+modules/search/views/search.html.php 32 DIRTY $item->thumb_img()
modules/search/views/search.html.php 34 CLEAN $item->title
modules/search/views/search.html.php 37 CLEAN $item->description
modules/search/views/search.html.php 43 DIRTY $theme->pager()
@@ -518,7 +518,7 @@ themes/default/views/album.html.php 15 DIRTY $child->i
themes/default/views/album.html.php 15 DIRTY $item_class
themes/default/views/album.html.php 16 DIRTY $theme->thumb_top($child)
themes/default/views/album.html.php 17 DIRTY $child->url()
-themes/default/views/album.html.php 18 DIRTY $child->thumb_tag(array("class" => "gThumbnail"))
+themes/default/views/album.html.php 18 DIRTY $child->thumb_img(array("class" => "gThumbnail"))
themes/default/views/album.html.php 20 DIRTY $theme->thumb_bottom($child)
themes/default/views/album.html.php 21 DIRTY $child->url()
themes/default/views/album.html.php 21 CLEAN $child->title
@@ -607,7 +607,7 @@ themes/default/views/photo.html.php 15 DIRTY $position
themes/default/views/photo.html.php 15 DIRTY $sibling_count
themes/default/views/photo.html.php 18 DIRTY $next_item->url()
themes/default/views/photo.html.php 28 DIRTY $theme->resize_top($item)
-themes/default/views/photo.html.php 32 DIRTY $item->resize_tag(array("id" => "gPhotoId-{$item->id}", "class" => "gResize"))
+themes/default/views/photo.html.php 32 DIRTY $item->resize_img(array("id" => "gPhotoId-{$item->id}", "class" => "gResize"))
themes/default/views/photo.html.php 36 DIRTY $theme->resize_bottom($item)
themes/default/views/photo.html.php 40 CLEAN $item->title
themes/default/views/photo.html.php 41 CLEAN $item->description
diff --git a/modules/gallery/views/l10n_client.html.php b/modules/gallery/views/l10n_client.html.php
index 8f4092c7..faa6e939 100644
--- a/modules/gallery/views/l10n_client.html.php
+++ b/modules/gallery/views/l10n_client.html.php
@@ -11,21 +11,58 @@
<ul class="string-list">
<? foreach ($string_list as $string): ?>
<li class="<?= $string["translation"] === "" ? "untranslated" : "translated" ?>">
+ <? if (is_array($string["source"])): ?>
+ [one] - <?= $string["source"]["one"] ?><br/>
+ [other] - <?= $string["source"]["other"] ?>
+ <? else: ?>
<?= $string["source"] ?>
+ <? endif; ?>
</li>
<? endforeach; ?>
</ul>
+
<?= $l10n_search_form ?>
</div>
<div id="l10n-client-string-editor">
<div class="source">
- <div class="source-text"></div>
+ <pre class="source-text"></pre>
</div>
<div class="translation">
- <?= $l10n_form ?>
+ <form method="post" action="<?= url::site("l10n_client/save") ?>" id="gL10nClientSaveForm">
+ <?= access::csrf_form_field() ?>
+ <?= form::hidden("l10n-message-key") ?>
+ <?= form::textarea("l10n-edit-translation", "", ' rows="5" class="translationField"') ?>
+ <div id="plural-zero" class="translationField hidden">
+ <label for="l10n-edit-plural-translation-zero">[zero]</label>
+ <?= form::textarea("l10n-edit-plural-translation-zero", "", ' rows="2"') ?>
+ </div>
+ <div id="plural-one" class="translationField hidden">
+ <label for="l10n-edit-plural-translation-one">[one]</label>
+ <?= form::textarea("l10n-edit-plural-translation-one", "", ' rows="2"') ?>
+ </div>
+ <div id="plural-two" class="translationField hidden">
+ <label for="l10n-edit-plural-translation-two">[two]</label>
+ <?= form::textarea("l10n-edit-plural-translation-two", "", ' rows="2"') ?>
+ </div>
+ <div id="plural-few" class="translationField hidden">
+ <label for="l10n-edit-plural-translation-few">[few]</label>
+ <?= form::textarea("l10n-edit-plural-translation-few", "", ' rows="2"') ?>
+ </div>
+ <div id="plural-many" class="translationField hidden">
+ <label for="l10n-edit-plural-translation-many">[many]</label>
+ <?= form::textarea("l10n-edit-plural-translation-many", "", ' rows="2"') ?>
+ </div>
+ <div id="plural-other" class="translationField hidden">
+ <label for="l10n-edit-plural-translation-other">[other]</label>
+ (<a href="http://www.unicode.org/cldr/data/charts/supplemental/language_plural_rules.html"><?= t("learn more about plural forms") ?></a>)
+ <?= form::textarea("l10n-edit-plural-translation-other", "", ' rows="2"') ?>
+ </div>
+ <input type="submit" name="l10n-edit-save" value="<?= t("Save translation") ?>"/>
+ </form>
</div>
</div>
<script type="text/javascript">
var l10n_client_data = <?= json_encode($string_list) ?>;
+ var plural_forms = <?= json_encode($plural_forms) ?>;
</script>
</div>
diff --git a/modules/gallery/views/move_tree.html.php b/modules/gallery/views/move_tree.html.php
index 91a2f9da..5f70cf67 100644
--- a/modules/gallery/views/move_tree.html.php
+++ b/modules/gallery/views/move_tree.html.php
@@ -1,5 +1,5 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
-<?= $parent->thumb_tag(array(), 25); ?>
+<?= $parent->thumb_img(array(), 25); ?>
<? if (!access::can("edit", $parent) || $source->is_descendant($parent)): ?>
<a href="javascript:load_tree('<?= $parent->id ?>',1)"> <?= p::clean($parent->title) ?> <?= t("(locked)") ?> </a>
<? else: ?>
@@ -8,7 +8,7 @@
<ul id="tree_<?= $parent->id ?>">
<? foreach ($children as $child): ?>
<li id="node_<?= $child->id ?>" class="node">
- <?= $child->thumb_tag(array(), 25); ?>
+ <?= $child->thumb_img(array(), 25); ?>
<? if (!access::can("edit", $child) || $source->is_descendant($child)): ?>
<a href="javascript:load_tree('<?= $child->id ?>',1)"> <?= p::clean($child->title) ?> <?= t("(locked)") ?></a>
<? else: ?>
diff --git a/modules/image_block/views/image_block_block.html.php b/modules/image_block/views/image_block_block.html.php
index 0ba9915e..48a3c912 100644
--- a/modules/image_block/views/image_block_block.html.php
+++ b/modules/image_block/views/image_block_block.html.php
@@ -1,6 +1,6 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<div class="gImageBlock">
<a href="<?= $item->url() ?>">
- <?= $item->thumb_tag(array("class" => "gThumbnail")) ?>
+ <?= $item->thumb_image(array("class" => "gThumbnail")) ?>
</a>
</div>
diff --git a/modules/organize/views/organize_thumb_grid.html.php b/modules/organize/views/organize_thumb_grid.html.php
index 64d8aaf3..c80696ad 100644
--- a/modules/organize/views/organize_thumb_grid.html.php
+++ b/modules/organize/views/organize_thumb_grid.html.php
@@ -6,7 +6,7 @@
<? endif ?>
<li id="thumb_<?= $child->id ?>" class="gMicroThumbContainer" ref="<?= $child->id ?>">
<div id="gMicroThumb-<?= $child->id ?>" class="gMicroThumb <?= $item_class ?>">
- <?= $child->thumb_tag(array("class" => "gThumbnail"), $thumbsize, true) ?>
+ <?= $child->thumb_img(array("class" => "gThumbnail"), $thumbsize, true) ?>
</div>
</li>
<? endforeach ?>
diff --git a/modules/recaptcha/views/form_recaptcha.html.php b/modules/recaptcha/views/form_recaptcha.html.php
index f5b36335..abdf8428 100644
--- a/modules/recaptcha/views/form_recaptcha.html.php
+++ b/modules/recaptcha/views/form_recaptcha.html.php
@@ -1,3 +1,4 @@
+<?php defined("SYSPATH") or die("No direct script access.") ?>
<div id="gRecaptcha"></div>
<script type="text/javascript" src="http://api.recaptcha.net/js/recaptcha_ajax.js"></script>
<script type="text/javascript">
diff --git a/modules/search/views/search.html.php b/modules/search/views/search.html.php
index de4343ae..5db07bad 100644
--- a/modules/search/views/search.html.php
+++ b/modules/search/views/search.html.php
@@ -29,7 +29,7 @@
<? endif ?>
<li class="gItem <?= $item_class ?>">
<a href="<?= url::site("items/$item->id") ?>">
- <?= $item->thumb_tag() ?>
+ <?= $item->thumb_img() ?>
<p>
<?= p::clean($item->title) ?>
</p>
diff --git a/themes/default/views/album.html.php b/themes/default/views/album.html.php
index 6e17696d..7d4a6f54 100644
--- a/themes/default/views/album.html.php
+++ b/themes/default/views/album.html.php
@@ -15,7 +15,7 @@
<li id="gItemId-<?= $child->id ?>" class="gItem <?= $item_class ?>">
<?= $theme->thumb_top($child) ?>
<a href="<?= $child->url() ?>">
- <?= $child->thumb_tag(array("class" => "gThumbnail")) ?>
+ <?= $child->thumb_img(array("class" => "gThumbnail")) ?>
</a>
<?= $theme->thumb_bottom($child) ?>
<h2><span></span><a href="<?= $child->url() ?>"><?= p::clean($child->title) ?></a></h2>
diff --git a/themes/default/views/photo.html.php b/themes/default/views/photo.html.php
index cc069158..85143da8 100644
--- a/themes/default/views/photo.html.php
+++ b/themes/default/views/photo.html.php
@@ -29,7 +29,7 @@
<? if (access::can("view_full", $item)): ?>
<a href="#" class="gFullSizeLink" title="<?= t("View full size") ?>">
<? endif ?>
- <?= $item->resize_tag(array("id" => "gPhotoId-{$item->id}", "class" => "gResize")) ?>
+ <?= $item->resize_img(array("id" => "gPhotoId-{$item->id}", "class" => "gResize")) ?>
<? if (access::can("view_full", $item)): ?>
</a>
<? endif ?>