Closes #143: Select the default language for new documents from browser language

This commit is contained in:
Benjamin Gamard 2017-11-05 22:28:23 +01:00
parent 614c8a1d13
commit cf9101d157

View File

@ -48,12 +48,21 @@ angular.module('docs').controller('DocumentEdit', function($rootScope, $scope, $
* Reset the form to add a new document.
*/
$scope.resetForm = function() {
var languages = {
en: 'eng',
fr: 'fra',
zh_CN: 'chi_sim'
};
var language = languages[$translate.use()];
$scope.document = {
tags: [],
relations: [],
language: 'fra'
language: language ? language : 'eng'
};
$scope.newFiles = [];
if ($scope.form) {
$scope.form.$setPristine();
}