diff options
author | Tim Almdal <tnalmdal@shaw.ca> | 2010-02-07 13:55:17 -0800 |
---|---|---|
committer | Tim Almdal <tnalmdal@shaw.ca> | 2010-02-07 13:55:17 -0800 |
commit | b6c0d3a48ca4fa9296b23a1c4d73fb0573f1b92f (patch) | |
tree | 9fb87920831d65ec21bf31c76973e5f51edcd28e /modules/gallery/libraries | |
parent | 7df4d795e8c5d4b100637f0fea0ad8ef7f6aeabb (diff) |
Refactor the is_rtl() helper into the Gallery_I18n class. This allows checking
for a config value "force_rtl" which will layout the gallery pages in rtl mode
without having to change to an language that is no longer understandable to the
developer.
Adding the line "$config['force_rtl'] = true;" to the config/locales.php file
will make it happen.
Diffstat (limited to 'modules/gallery/libraries')
-rw-r--r-- | modules/gallery/libraries/Gallery_I18n.php | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/gallery/libraries/Gallery_I18n.php b/modules/gallery/libraries/Gallery_I18n.php index 4e0c1f82..1eacad5b 100644 --- a/modules/gallery/libraries/Gallery_I18n.php +++ b/modules/gallery/libraries/Gallery_I18n.php @@ -87,6 +87,16 @@ class Gallery_I18n_Core { return $this->_config['default_locale']; } + public function is_rtl($locale=null) { + $is_rtl = !empty($this->_config["force_rtl"]) and $this->_config["force_rtl"]; + if (empty($is_rtl)) { + $locale or $locale = $this->locale(); + list ($language, $territory) = explode('_', $locale . "_"); + $is_rtl = in_array($language, array("he", "fa", "ar")); + } + return $is_rtl; + } + /** * Translates a localizable message. * |