+define('langSelector/ctrl', [
    'text!langSelector/langs.json',
    'text!langSelector/tpl.html'
], function(
    langs,
    tpl
){
    return function(ngModule){
        ngModule
            .controller('langSelectorCtrl', [ '$scope', 'i18n', function($scope, i18n){
                $scope.langs = JSON.parse(langs);
                $scope.change = function(){
                        if($scope.selected && $scope.selected.code)
                                i18n.setLang($scope.selected.code);
                        else
                            i18n.setLang(null);
                    };
            }])
            .directive('cpLangSelector', function(){
                return {restrict: 'E', template: tpl};
            });
    };
});
@@ -264,16 +264,249 @@
  i18n)%7B%0A
+                var prefLang = window.navigator.languages ? window.navigator.languages%5B0%5D : null;%0A                prefLang = prefLang %7C%7C window.navigator.language %7C%7C window.navigator.browserLanguage %7C%7C window.navigator.userLanguage;%0A
         
@@ -547,16 +547,16 @@
 langs);%0A
-
         
@@ -797,20 +797,24 @@
 setLang(
-null
+prefLang
 );%0A     
@@ -831,16 +831,56 @@
      %7D;%0A
+                i18n.setLang(prefLang);%0A
         

add initial preffered language setting