Permalink
Browse files

no longer translates /dashboard

changed section to pull second element instead of third from path
  • Loading branch information...
1 parent 67895ac commit acffdff08498022e7087b7e05e8a0abda31a95bf @tylerryan tylerryan committed Dec 7, 2011
View
@@ -0,0 +1,5 @@
+# ignore system files
+.DS_Store
+thumbs.db
+__MACOSX
+
@@ -4,7 +4,7 @@ class MultilingualPackage extends Package {
protected $pkgHandle = 'multilingual';
protected $appVersionRequired = '5.4.2';
- protected $pkgVersion = '1.0.4';
+ protected $pkgVersion = '1.1dev';
public function getPackageDescription() {
return t('Translate your site with this free multilingual solution.');
@@ -60,7 +60,11 @@ public function getSessionDefaultLanguage() {
}
public static function setupSiteInterfaceLocalization() {
-
+ // don't translate dashboard pages
+ $c = Page::getCurrentPage();
+ if($c instanceof Page && Loader::helper('section', 'multilingual')->section('dashboard')) {
+ return;
+ }
// site translations
if (is_dir(DIR_LANGUAGES_SITE_INTERFACE)) {
@@ -7,11 +7,18 @@ class SectionHelper {
protected $lang = false;
protected $section = false;
+ /**
+ * if no argument is specified, returns the first portion of the current page's path
+ * ex: path is /en/about/contact-us this function would return 'en'
+ * if $s argument (a string page path) is specified this function tests to see if the current page is within the path
+ * @param string $s
+ * @return string | boolean
+ */
public function section($s = false) {
if (!$this->section) {
$c = Page::getCurrentPage();
$cparts = explode('/', $c->getCollectionPath());
- $this->section = $cparts[2];
+ $this->section = $cparts[1];
}
if ($s == false) {
return $this->section;
@@ -20,6 +27,10 @@ public function section($s = false) {
}
}
+ /**
+ * returns the current language
+ * @return string
+ */
public function getLanguage() {
$ms = MultilingualSection::getCurrentSection();
if (is_object($ms)) {
@@ -41,7 +41,9 @@ public static function getCurrentSection() {
static $lang;
if (!isset($lang)) {
$c = Page::getCurrentPage();
- $lang = self::getBySectionOfSite($c);
+ if($c instanceof Page) {
+ $lang = self::getBySectionOfSite($c);
+ }
}
return $lang;
}

0 comments on commit acffdff

Please sign in to comment.