translate app + add french translation

This commit is contained in:
Sam 2016-05-05 16:00:58 +03:00
parent 25fffe4ef7
commit d0057c41a9
9 changed files with 60 additions and 19 deletions

View file

@ -4,25 +4,30 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
$translateProvider.translations('english', { $translateProvider.translations('english', {
FORM_SUCCESS: 'Form entry successfully submitted!', FORM_SUCCESS: 'Form entry successfully submitted!',
SUBMIT: 'Submit',
REVIEW: 'Review',
BACK_TO_FORM: 'Go back to Form', BACK_TO_FORM: 'Go back to Form',
EDIT_FORM: 'Edit this TellForm', EDIT_FORM: 'Edit this TellForm',
CREATE_FORM: 'Create this TellForm', CREATE_FORM: 'Create this TellForm',
ADVANCEMENT: '{{done}} out of {{total}} answered', ADVANCEMENT: '{{done}} out of {{total}} answered',
CONTINUE_FORM: 'Continue to Form', CONTINUE_FORM: 'Continue to Form',
REQUIRED: 'required', REQUIRED: 'required',
COMPLETING_NEEDED: '{{answers_not_completed}} answer(s) need completing',
OPTIONAL: 'optional', OPTIONAL: 'optional',
ERROR_EMAIL_INVALID: 'Please enter a valid email address', ERROR_EMAIL_INVALID: 'Please enter a valid email address',
ERROR_NOT_A_NUMBER: 'Please enter valid numbers only', ERROR_NOT_A_NUMBER: 'Please enter valid numbers only',
ERROR_URL_INVALID: 'Please a valid url', ERROR_URL_INVALID: 'Please a valid url',
OK: 'OK', OK: 'OK',
ENTER: 'press ENTER', ENTER: 'press ENTER',
YES: 'Yes',
NO: 'No',
NEWLINE: 'press SHIFT+ENTER to create a newline',
CONTINUE: 'Continue', CONTINUE: 'Continue',
LEGAL_ACCEPT: 'I accept', LEGAL_ACCEPT: 'I accept',
LEGAL_NO_ACCEPT: 'I dont accept', LEGAL_NO_ACCEPT: 'I dont accept',
DELETE: 'Delete', DELETE: 'Delete',
CANCEL: 'Cancel', CANCEL: 'Cancel',
UPLOAD_FILE: 'Upload your File', UPLOAD_FILE: 'Upload your File',
SUBMIT: 'Submit'
}); });
$translateProvider.preferredLanguage('english') $translateProvider.preferredLanguage('english')

View file

@ -4,25 +4,30 @@ angular.module('forms').config(['$translateProvider', function ($translateProvid
$translateProvider.translations('french', { $translateProvider.translations('french', {
FORM_SUCCESS: 'Votre formulaire a été enregistré!', FORM_SUCCESS: 'Votre formulaire a été enregistré!',
REVIEW: 'Review',
BACK_TO_FORM: 'Retourner au formulaire', BACK_TO_FORM: 'Retourner au formulaire',
EDIT_FORM: 'Éditer le Tellform', EDIT_FORM: 'Éditer le Tellform',
CREATE_FORM: 'Créer un TellForm', CREATE_FORM: 'Créer un TellForm',
ADVANCEMENT: '{{done}} complétés sur {{total}}', ADVANCEMENT: '{{done}} complétés sur {{total}}',
CONTINUE_FORM: 'Aller au formulaire', CONTINUE_FORM: 'Aller au formulaire',
REQUIRED: 'obligatoire', REQUIRED: 'obligatoire',
COMPLETING_NEEDED: '{{answers_not_completed}} réponse(s) doive(nt) être complétée(s)',
OPTIONAL: 'facultatif', OPTIONAL: 'facultatif',
ERROR_EMAIL_INVALID: 'Merci de rentrer une adresse mail valide', ERROR_EMAIL_INVALID: 'Merci de rentrer une adresse mail valide',
ERROR_NOT_A_NUMBER: 'Merce de ne rentrer que des nombres', ERROR_NOT_A_NUMBER: 'Merce de ne rentrer que des nombres',
ERROR_URL_INVALID: 'Merci de rentrer une url valide', ERROR_URL_INVALID: 'Merci de rentrer une url valide',
OK: 'OK', OK: 'OK',
ENTER: 'presser ENTRÉE', ENTER: 'presser ENTRÉE',
YES: 'Oui',
NO: 'Non',
NEWLINE: 'presser SHIFT+ENTER pour créer une nouvelle ligne',
CONTINUE: 'Continuer', CONTINUE: 'Continuer',
LEGAL_ACCEPT: 'Jaccepte', LEGAL_ACCEPT: 'Jaccepte',
LEGAL_NO_ACCEPT: 'Jen naccepte pas', LEGAL_NO_ACCEPT: 'Je naccepte pas',
DELETE: 'Supprimer', DELETE: 'Supprimer',
CANCEL: 'Réinitialiser', CANCEL: 'Réinitialiser',
UPLOAD_FILE: 'Envoyer des fichier', SUBMIT: 'Enregistrer',
SUBMIT: 'Enregistrer' UPLOAD_FILE: 'Envoyer un fichier',
}); });
}]); }]);

View file

@ -8,7 +8,7 @@ angular.module('forms', [
angular.module('NodeForm', [ angular.module('NodeForm', [
'ui.select', 'cgBusy', 'ngSanitize', 'vButton', 'ngResource', 'ui.select', 'cgBusy', 'ngSanitize', 'vButton', 'ngResource',
'ui.router', 'ui.bootstrap', 'ui.utils', 'ngRaven', 'forms', 'ui.router', 'ui.bootstrap', 'ui.utils', 'ngRaven', 'forms',
'ui.select' 'ui.select'
]); ]);
angular.module('forms').factory('Auth', [ angular.module('forms').factory('Auth', [

File diff suppressed because one or more lines are too long

View file

@ -18,9 +18,12 @@ angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter'
} }
return true; return true;
}).length; }).length;
var nb_valid = $filter('formValidity')($scope.myform);
$scope.translateAdvancementData = { $scope.translateAdvancementData = {
done: $filter('formValidity')($scope.myform), done: nb_valid,
total: form_fields_count total: form_fields_count,
answers_not_completed: form_fields_count - nb_valid
}; };
$scope.reloadForm = function(){ $scope.reloadForm = function(){
@ -114,9 +117,11 @@ angular.module('forms').directive('submitFormDirective', ['$http', 'TimeCounter'
$scope.selected._id = field_id; $scope.selected._id = field_id;
$scope.selected.index = field_index; $scope.selected.index = field_index;
var nb_valid = $filter('formValidity')($scope.myform);
$scope.translateAdvancementData = { $scope.translateAdvancementData = {
done: $filter('formValidity')($scope.myform), done: nb_valid,
total: form_fields_count total: form_fields_count,
answers_not_completed: form_fields_count - nb_valid
}; };
if(animateScroll){ if(animateScroll){

View file

@ -31,7 +31,7 @@
<div class="letter" style="float:left"> <div class="letter" style="float:left">
Y Y
</div> </div>
<span> {{ 'LEGAL_ACCEPT' | translate }} </span> <span>{{ 'LEGAL_ACCEPT' | translate }}</span>
</label> </label>
<label class="btn col-md-5 col-md-offset-1 col-xs-12" <label class="btn col-md-5 col-md-offset-1 col-xs-12"
ng-class="{activeBtn: field.fieldValue == 'false'}"> ng-class="{activeBtn: field.fieldValue == 'false'}">
@ -46,7 +46,7 @@
<div class="letter" style="float:left"> <div class="letter" style="float:left">
N N
</div> </div>
<span>{{ 'LEGAL_NO_ACCEPT' | translate }} </span> <span>{{ 'LEGAL_NO_ACCEPT' | translate }}</span>
</label> </label>
</div> </div>

View file

@ -6,11 +6,9 @@
<i class="fa fa-angle-double-right" aria-hidden="true"></i> <i class="fa fa-angle-double-right" aria-hidden="true"></i>
</small> </small>
{{field.title}} {{field.title}}
<span class="required-error" ng-show="!field.required">optional</span> <span class="required-error" ng-show="!field.required">{{ 'OPTIONAL' | translate }}</span>
</h3> </h3>
<p> <small>{{ 'NEWLINE' | translate }}</small>
<small>{{field.description}}</small>
</p>
</div> </div>
<div class="col-xs-12 field-input"> <div class="col-xs-12 field-input">
<small style="font-size:0.6em;">Press SHIFT+ENTER to add a newline</small> <small style="font-size:0.6em;">Press SHIFT+ENTER to add a newline</small>

View file

@ -34,7 +34,7 @@
<div class="letter"> <div class="letter">
Y Y
</div> </div>
<span>Yes</span> <span>{{ 'YES' | translate }}</span>
<i ng-show="field.fieldValue === 'true'" class="fa fa-check" aria-hidden="true"></i> <i ng-show="field.fieldValue === 'true'" class="fa fa-check" aria-hidden="true"></i>
</label> </label>
</div> </div>
@ -61,7 +61,7 @@
<div class="letter"> <div class="letter">
N N
</div> </div>
<span>No</span> <span>{{ 'NO' | translate }}</span>
<i ng-show="field.fieldValue === 'false'" class="fa fa-check" aria-hidden="true"></i> <i ng-show="field.fieldValue === 'false'" class="fa fa-check" aria-hidden="true"></i>
</label> </label>
</div> </div>

View file

@ -71,6 +71,7 @@ ng-style="{'color':button.color}">
<div class="col-xs-12 text-left" <div class="col-xs-12 text-left"
style="background-color:#990000; color:white;" style="background-color:#990000; color:white;"
ng-if="forms.myForm.$invalid"> ng-if="forms.myForm.$invalid">
{{ 'COMPLETING_NEEDED' | translate:translateAdvancementData }}
{{form_fields_count - (myform | formValidity)}} answer(s) need completing {{form_fields_count - (myform | formValidity)}} answer(s) need completing
</div> </div>
@ -93,7 +94,7 @@ ng-style="{'color':button.color}">
on-enter-key="goToInvalid()" on-enter-key="goToInvalid()"
on-enter-key-disabled="!forms.myForm.$invalid" on-enter-key-disabled="!forms.myForm.$invalid"
style="font-size: 1.6em; margin-left: 1em; margin-top: 1em; background-color:#990000; color:white"> style="font-size: 1.6em; margin-left: 1em; margin-top: 1em; background-color:#990000; color:white">
Review {{ 'REVIEW' | translate }}
</button> </button>
<div class="col-sm-2 hidden-xs" style="font-size: 75%; margin-top:3.25em"> <div class="col-sm-2 hidden-xs" style="font-size: 75%; margin-top:3.25em">