diff --git a/www/config.json b/www/config.json
index ca0174a..158800b 100644
--- a/www/config.json
+++ b/www/config.json
@@ -5,6 +5,7 @@
     "cache_expiration_time" : 300000,
     "default_lang" : "en",
     "languages": {"ar": "عربي", "bg": "Български", "ca": "Català", "cs": "Čeština", "da": "Dansk", "de": "Deutsch","en": "English", "es": "Español", "es-mx": "Español - México", "eu": "Euskara", "fa": "فارسی", "fr" : "Français", "he" : "עברית", "hu": "magyar", "it": "Italiano", "ja": "日本語","nl": "Nederlands", "pl": "Polski", "pt-br": "Português - Brasil", "pt": "Português - Portugal", "ro": "Română", "ru": "Русский", "sv": "Svenska", "tr" : "Türkçe", "zh-cn" : "简体中文", "zh-tw" : "正體中文"},
+    "rtlLanguages": ["fa"],
     "wsservice" : "moodle_mobile_app",
     "wsextservice" : "local_mobile",
     "demo_sites": {"student": {"url": "http://school.demo.moodle.net", "username": "student", "password": "moodle"}, "teacher": {"url": "http://school.demo.moodle.net", "username": "teacher", "password": "moodle"}, "cva": {"url": "http://mm.cvaconsulting.com/moodle", "username": "student", "password": "student"}},
diff --git a/www/core/lib/lang.js b/www/core/lib/lang.js
index 9981818..00139b3 100644
--- a/www/core/lib/lang.js
+++ b/www/core/lib/lang.js
@@ -21,7 +21,7 @@ angular.module('mm.core')
  * @description
  * This service allows to add new languages strings.
  */
-.factory('$mmLang', function($translate, $translatePartialLoader, $mmConfig, $cordovaGlobalization, $q, mmCoreConfigConstants) {
+.factory('$mmLang', function($translate, $translatePartialLoader, $mmConfig, $cordovaGlobalization, $q, mmCoreConfigConstants, $ionicPlatform, $ionicHistory) {
 
     var self = {},
         fallbackLanguage = 'en',
@@ -108,6 +108,13 @@ angular.module('mm.core')
             p2 = $mmConfig.set('current_language', language);
         moment.locale(language);
         currentLanguage = language;
+console.log(currentLanguage, self.isRTL(currentLanguage));
+        if (self.isRTL(currentLanguage)) {
+            $ionicPlatform.setDir('rtl');
+        } else {
+            $ionicPlatform.setDir('ltr');
+        }
+        $ionicHistory.switchDirection();
         return $q.all([p1, p2]);
     };
 
@@ -145,6 +152,15 @@ angular.module('mm.core')
         });
     };
 
+    self.isRTL = function(language) {
+        if (mmCoreConfigConstants.rtlLanguages) {
+            for (var i=0; i<mmCoreConfigConstants.rtlLanguages.length; i+=1) {
+                if (language.indexOf(mmCoreConfigConstants.rtlLanguages[i])>-1) 
+                    return true;
+            }
+        }
+        return false;
+    }
     return self;
 })
 
@@ -162,11 +178,17 @@ angular.module('mm.core')
     $translateProvider.preferredLanguage('en'); // Set English until we know which language to use.
 })
 
-.run(function($ionicPlatform, $translate, $mmLang) {
+.run(function($ionicPlatform, $translate, $mmLang, $ionicHistory) {
     $ionicPlatform.ready(function() {
         $mmLang.getCurrentLanguage().then(function(language) {
             $translate.use(language);
             moment.locale(language);
-        });
+            if ($mmLang.isRTL(language)) {
+                $ionicPlatform.setDir('rtl');
+            } else {
+                $ionicPlatform.setDir('ltr');
+            }
+            $ionicHistory.switchDirection();
+       });
     });
-});
\ No newline at end of file
+});
diff --git a/www/core/lib/sitesmanager.js b/www/core/lib/sitesmanager.js
index d382d4f..2cff0f0 100644
--- a/www/core/lib/sitesmanager.js
+++ b/www/core/lib/sitesmanager.js
@@ -221,7 +221,7 @@ angular.module('mm.core')
                     candidateSite.setInfo(infos);
                     currentSite = candidateSite;
                     // Store session.
-                    self.login(siteid);
+                    self.login(siteid, infos);
                     $mmEvents.trigger(mmCoreEventSiteAdded, siteid);
                 } else {
                     return $translate(validation.error, validation.params).then(function(error) {
@@ -362,7 +362,9 @@ angular.module('mm.core')
 
         return self.getSite(siteid).then(function(site) {
             currentSite = site;
-            self.login(siteid);
+            site.fetchSiteInfo().then(function(infos) {
+                self.login(siteid, infos);
+            });
 
             // Check if local_mobile was installed to Moodle.
             return site.checkIfLocalMobileInstalledAndNotUsed().then(function() {
@@ -556,11 +558,12 @@ angular.module('mm.core')
      * @param  {String} siteid ID of the site the user is accessing.
      * @return {Promise}       Promise resolved when current site is stored.
      */
-    self.login = function(siteid) {
+    self.login = function(siteid, infos) {
         return $mmApp.getDB().insert(mmCoreCurrentSiteStore, {
             id: 1,
             siteid: siteid
         }).then(function() {
+            self.setCurrentLanguage(infos);
             $mmEvents.trigger(mmCoreEventLogin);
         });
     };
@@ -738,6 +741,21 @@ angular.module('mm.core')
         });
     };
 
+    /**
+     * As soon as user logs in, set current language based on what he set
+     * default language in his profile.
+     *
+     * @module mm.core
+     * @ngdoc method
+     * @name $mmSiteManager#setCurrentLanguage
+     */
+    self.setCurrentLanguage = function(infos) {
+        $mmLang.changeCurrentLanguage(infos.lang).finally(function() {
+            // Clear cached views.
+            $ionicHistory.clearCache();
+        });
+    }
+
     return self;
 
 });
diff --git a/www/index.html b/www/index.html
index 789e2ea..0839633 100644
--- a/www/index.html
+++ b/www/index.html
@@ -1,5 +1,5 @@
 <!DOCTYPE html>
-<html>
+<html ng-app="mm" dir="ltr">
   <head>
     <meta charset="utf-8">
     <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
@@ -17,10 +17,17 @@
     <script src="lib/moment/min/moment-with-locales.js"></script>
     <script src="lib/jszip/dist/jszip.js"></script>
     <script src="lib/oclazyload/dist/ocLazyLoad.js"></script>
+    <script src="lib/jquery/dist/jquery.min.js"></script>
+    <script src="lib/flot/jquery.flot.js"></script>
+    <script src="lib/flot/jquery.flot.time.js"></script>
+    <script src="lib/flot/jquery.flot.symbol.js"></script>
     <script src="build/mm.bundle.js"></script>
     <style></style> <!-- Empty style to make easier to test styles using Inspector. -->
   </head>
-  <body ng-app="mm">
+  <body>
     <ion-nav-view></ion-nav-view>
+    <ion-footer-bar class="ng-cloak bar-indepth">
+      <div>ostadelahi-indepth.com | © 2016 - All rights reserved</div>
+    </ion-footer-bar>
   </body>
 </html>
