summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorChad Kieffer <ckieffer@gmail.com>2010-02-18 19:32:57 -0700
committerChad Kieffer <ckieffer@gmail.com>2010-02-18 19:32:57 -0700
commit934cc8d7eebf926fb6c1cc8f27a611a41e915dc6 (patch)
treea079bc02c9d85c17bab2375d5af0d436b5f4114d /modules
parent63ec1c5e48ef480c8bf6a6138e541fe1ad4fdb44 (diff)
parentf116af5287f7809e907ee56dbfa582f474738ae6 (diff)
Merge branch 'master' of github.com:gallery/gallery3
Diffstat (limited to 'modules')
-rw-r--r--modules/gallery/libraries/Gallery_I18n.php26
-rw-r--r--modules/organize/views/organize_tree.html.php11
2 files changed, 27 insertions, 10 deletions
diff --git a/modules/gallery/libraries/Gallery_I18n.php b/modules/gallery/libraries/Gallery_I18n.php
index 160543c9..26d1de2c 100644
--- a/modules/gallery/libraries/Gallery_I18n.php
+++ b/modules/gallery/libraries/Gallery_I18n.php
@@ -73,12 +73,26 @@ class Gallery_I18n_Core {
public function locale($locale=null) {
if ($locale) {
$this->_config['default_locale'] = $locale;
- // Attempt to set PHP's locale as well (for number formatting, collation, etc.)
- // TODO: See G2 for better fallack code.
- $locale_prefs = array($locale);
- $locale_prefs[] = 'en_US';
- $new_locale = setlocale(LC_ALL, $locale_prefs);
- if (is_string($new_locale) && strpos($new_locale, 'tr') === 0) {
+ $php_locale = setlocale(LC_ALL, 0);
+ list ($php_locale, $unused) = explode('.', $php_locale . '.');
+ if ($php_locale != $locale) {
+ // Attempt to set PHP's locale as well (for number formatting, collation, etc.)
+ $locale_prefs = array($locale);
+ // Try appending some character set names; some systems (like FreeBSD) need this.
+ // Some systems require a format with hyphen (eg. Gentoo) and others without (eg. FreeBSD).
+ $charsets = array('utf8', 'UTF-8', 'UTF8', 'ISO8859-1', 'ISO-8859-1');
+ if (substr($locale, 0, 2) != 'en') {
+ $charsets = array_merge($charsets, array(
+ 'EUC', 'Big5', 'euc', 'ISO8859-2', 'ISO8859-5', 'ISO8859-7',
+ 'ISO8859-9', 'ISO-8859-2', 'ISO-8859-5', 'ISO-8859-7', 'ISO-8859-9'));
+ }
+ foreach ($charsets as $charset) {
+ $locale_prefs[] = $locale . '.' . $charset;
+ }
+ $locale_prefs[] = 'en_US';
+ $php_locale = setlocale(LC_ALL, $locale_prefs);
+ }
+ if (is_string($php_locale) && substr($php_locale, 0, 2) == 'tr') {
// Make PHP 5 work with Turkish (the localization results are mixed though).
// Hack for http://bugs.php.net/18556
setlocale(LC_CTYPE, 'C');
diff --git a/modules/organize/views/organize_tree.html.php b/modules/organize/views/organize_tree.html.php
index 33d7b4c9..044b6858 100644
--- a/modules/organize/views/organize_tree.html.php
+++ b/modules/organize/views/organize_tree.html.php
@@ -3,24 +3,27 @@
ref="<?= $album->id ?>">
<span class="ui-icon ui-icon-minus g-left">
</span>
- <span class="g-organize-album-text g-left <?= $selected && $album->id == $selected->id ? "ui-state-focus" : "" ?>"
+ <span class="g-organize-album-text <?= $selected && $album->id == $selected->id ? "ui-state-focus" : "" ?>"
ref="<?= $album->id ?>">
<?= html::clean($album->title) ?>
</span>
- <ul class="g-left">
- <? foreach ($album->children(null, null, array(array("type", "=", "album"))) as $child): ?>
+ <? $child_albums = $album->viewable()->children(null, null, array(array("type", "=", "album"))); ?>
+ <? if (!empty($child_albums)): ?>
+ <ul>
+ <? foreach ($child_albums as $child): ?>
<? if ($selected && $child->contains($selected)): ?>
<?= View::factory("organize_tree.html", array("selected" => $selected, "album" => $child)); ?>
<? else: ?>
<li class="g-organize-album ui-icon-left <?= access::can("edit", $child) ? "" : "g-view-only" ?>"
ref="<?= $child->id ?>">
<span class="ui-icon ui-icon-plus g-left"></span>
- <span class="g-organize-album-text g-left <?= $selected && $child->id == $selected->id ? "ui-state-focus" : "" ?>" ref="<?= $child->id ?>">
+ <span class="g-organize-album-text <?= $selected && $child->id == $selected->id ? "ui-state-focus" : "" ?>" ref="<?= $child->id ?>">
<?= html::clean($child->title) ?>
</span>
</li>
<? endif ?>
<? endforeach ?>
</ul>
+ <? endif ?>
</li>