Skip to content
This repository was archived by the owner on Jul 1, 2020. It is now read-only.

Commit 050f9e5

Browse files
committed
Added Spanish option on main page
- Added Spanish option on main page - Fixed couple of typos - Fixed a delay problem on the validation summary display
1 parent 634ace6 commit 050f9e5

File tree

6 files changed

+21
-17
lines changed

6 files changed

+21
-17
lines changed

app.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,9 @@ myApp.controller('CtrlValidationDirective', ['$scope', 'validationService', func
5050
}
5151
}
5252
$scope.showValidationSummary = function () {
53-
$scope.displayValidationSummary = true;
53+
$translate.then(function() {
54+
$scope.displayValidationSummary = true;
55+
});
5456
}
5557
}]);
5658

@@ -104,7 +106,9 @@ myApp.controller('CtrlValidationService', ['$scope', '$translate', 'validationSe
104106
};
105107

106108
$scope.showValidationSummary = function () {
107-
$scope.displayValidationSummary = true;
109+
$translate.then(function() {
110+
$scope.displayValidationSummary = true;
111+
});
108112
}
109113

110114
$scope.submitForm = function() {

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ <h1>Angular-Validation Directive|Service (ghiscoding)</h1>
1919
<div class="btn-group btn-group-sm">
2020
<button type="button" class="btn btn-default" ng-click="switchLanguage('fr')">Français</button>
2121
<button type="button" class="btn btn-default" ng-click="switchLanguage('en')">English</button>
22+
<button type="button" class="btn btn-default" ng-click="switchLanguage('es')">Español</button>
2223
</div>
2324

2425
<span class="text-info" style="margin-left: 20px"><strong>Type: </strong></span>

locales/validation/en.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,9 @@
5252
"INVALID_URL": "Must be a valid URL. ",
5353
"INVALID_TIME": "Must be a valid time format (hh:mm) OR (hh:mm:ss). ",
5454

55-
5655
"AREA1": "TextArea: Alphanumeric + Minimum(15) + Required",
5756
"ERRORS": "Errors",
58-
"CHANGE_LANGUAGE": "Change language.",
57+
"CHANGE_LANGUAGE": "Change language",
5958
"INPUT2": "Number positive or negative -- input type=\"number\" -- Error on non-numeric characters ",
6059
"INPUT3": "Floating number range (integer excluded) -- between_num:x,y OR min_num:x|max_num:y ",
6160
"INPUT4": "Multiple Validations + Custom Regex of Date Code (YYWW)",

locales/validation/es.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@
1212
"INVALID_DATE_EURO_LONG": "Debe contener una fecha valida con formato (dd-mm-yyyy) ó (dd/mm/yyyy). ",
1313
"INVALID_DATE_EURO_LONG_BETWEEN": "Debe contener una fecha valida entre :param y :param con formato (dd-mm-yyyy) ó (dd/mm/yyyy). ",
1414
"INVALID_DATE_EURO_LONG_MAX": "Debe contener una fecha valida igual ó menor que :param con formato (dd-mm-yyyy) ó (dd/mm/yyyy). ",
15-
"INVALID_DATE_EURO_LONG_MIN": "Debe contener una fecha valida igual ó mayor que :param con formato (dd-mm-yyyy) ó (dd/mm/yyyy). ",
15+
"INVALID_DATE_EURO_LONG_MIN": "Debe contener una fecha valida igual ó mayor que :param con formato (dd-mm-yyyy) ó (dd/mm/yyyy). ",
1616
"INVALID_DATE_EURO_SHORT": "Debe contener una fecha valida con formato (dd-mm-yy) o (dd/mm/yy). ",
1717
"INVALID_DATE_EURO_SHORT_BETWEEN": "Debe contener una fecha valida entre :param y :param con formato (dd-mm-yy) o (dd/mm/yy). ",
1818
"INVALID_DATE_EURO_SHORT_MAX": "Debe contener una fecha valida igual ó menor que :param con formato (dd-mm-yy) ó (dd/mm/yy). ",
1919
"INVALID_DATE_EURO_SHORT_MIN": "Debe contener una fecha valida igual ó mayor que :param con formato (dd-mm-yy) ó (dd/mm/yy). ",
2020
"INVALID_DATE_ISO": "Debe contener una fecha valida con formato (yyyy-mm-dd). ",
2121
"INVALID_DATE_ISO_BETWEEN": "Debe contener una fecha valida entre :param y :param con formato (yyyy-mm-dd). ",
2222
"INVALID_DATE_ISO_MAX": "Debe contener una fecha valida igual ó menor que :param con formato (yyyy-mm-dd). ",
23-
"INVALID_DATE_ISO_MIN": "Debe contener una fecha valida igual ó mayor que :param con formato (yyyy-mm-dd). ",
23+
"INVALID_DATE_ISO_MIN": "Debe contener una fecha valida igual ó mayor que :param con formato (yyyy-mm-dd). ",
2424
"INVALID_DATE_US_LONG": "Debe contener una fecha valida con formato (mm/dd/yyyy) ó (mm-dd-yyyy). ",
2525
"INVALID_DATE_US_LONG_BETWEEN": "Debe contener una fecha valida entre :param y :param con formato (mm/dd/yyyy) ó (mm/dd/yyyy). ",
2626
"INVALID_DATE_US_LONG_MAX": "Debe contener una fecha valida igual ó menor que :param con formato (mm/dd/yyyy) ó (mm/dd/yyyy). ",
27-
"INVALID_DATE_US_LONG_MIN": "Debe contener una fecha valida igual ó mayor que :param con formato (mm/dd/yyyy) ó (mm/dd/yyyy). ",
27+
"INVALID_DATE_US_LONG_MIN": "Debe contener una fecha valida igual ó mayor que :param con formato (mm/dd/yyyy) ó (mm/dd/yyyy). ",
2828
"INVALID_DATE_US_SHORT": "Debe contener una fecha valida con formato (mm/dd/yy) ó (mm-dd-yy). ",
2929
"INVALID_DATE_US_SHORT_BETWEEN": "Debe contener una fecha valida entre :param y :param con formato (mm/dd/yy) ó (mm/dd/yy). ",
3030
"INVALID_DATE_US_SHORT_MAX": "Debe contener una fecha valida igual ó menor que :param con formato (mm/dd/yy) ó (mm/dd/yy). ",
31-
"INVALID_DATE_US_SHORT_MIN": "Debe contener una fecha valida igual ó mayor que :param con formato (mm/dd/yy) ó (mm/dd/yy). ",
31+
"INVALID_DATE_US_SHORT_MIN": "Debe contener una fecha valida igual ó mayor que :param con formato (mm/dd/yy) ó (mm/dd/yy). ",
3232
"INVALID_EMAIL": "Debe contener una dirección de correo electronico valida. ",
3333
"INVALID_EXACT_LEN": "Debe contener exactamente :param caracteres. ",
3434
"INVALID_FLOAT": "Debe contener un número decimal positivo (Los números enteros no son validos). ",
@@ -51,9 +51,10 @@
5151
"INVALID_REQUIRED": "El campo es requerido. ",
5252
"INVALID_URL": "Debe contener una dirección URL valida. ",
5353
"INVALID_TIME": "Debe contener un formato de tiempo valido (hh:mm) ó (hh:mm:ss). ",
54+
5455
"AREA1": "Area de texto: Alfanúmerica + Minimo(15) + Requerido",
5556
"ERRORS": "Errores",
56-
"CHANGE_LANGUAGE": "Cambiar idioma.",
57+
"CHANGE_LANGUAGE": "Cambiar idioma",
5758
"INPUT2": "Número positivo o negativo -- input type=\"number\" -- Error o caracteres no númericos ",
5859
"INPUT3": "Rango decimal (Los números enteros no son validos) -- between_num:x,y ó min_num:x|max_num:y ",
5960
"INPUT4": "Multiples validaciones + Código de fecha personalizado (YYWW)",

locales/validation/fr.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,9 @@
5252
"INVALID_URL": "Doit être un URL valide. ",
5353
"INVALID_TIME": "Doit être un format de date valide (hh:mm) OU (hh:mm:ss). ",
5454

55-
5655
"AREA1": "TextArea: Alphanumérique + Minimum(15) + Required",
5756
"ERRORS": "Erreurs",
58-
"CHANGE_LANGUAGE": "Changer de langue.",
57+
"CHANGE_LANGUAGE": "Changer de langue",
5958
"INPUT2": "Nombre positif ou négatif -- input type=\"number\" -- Erreur sur caractères non-numérique",
6059
"INPUT3": "Intervalle de Nombre Flottant (entier exclu) -- between_num:x,y OU min_num:x|max_num:y",
6160
"INPUT4": "Multiple Validations + Regex Personnalisé d'un Code Date (AASS)",

readme.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ myApp.config(function ($translateProvider) {
5454
```
5555

5656
```html
57-
<!-- You could also angular-validation with the all in 1 minified file -->
57+
<!-- You could use the minified version of angular-validation (all in 1 minified file) -->
5858
<script type="text/javascript" src="dist/angular-validation.min.js"></script>
5959

60-
<!-- OR uncompressed files for development, which are angular-validation, the directive and service are totally independent -->
60+
<!-- OR use uncompressed files for development, which are angular-validation, the directive and service are totally independent -->
6161
<!-- you can load one or the other or use them in parallel. But `-common.js` and `-rules.js` are mandatory. -->
6262
<script type="text/javascript" src="src/validation-directive.js"></script>
6363
<script type="text/javascript" src="src/validation-service.js"></script>
@@ -162,7 +162,7 @@ P.S. For real live sample, see the [live demo](#plunker) or download the Github
162162
```
163163

164164
<a name="submit"></a>
165-
## Form Submitting and Validation
165+
## Form Submit and Validation
166166
The Angular-Validation concept was first introduced with the use `ngDisabled` on the submit button, but this might not always be the best option so as a another feature we could simply leave the submit button available but run an extra function to check the form validation before proceeding with our submit (that function is available through the ValidationService).
167167

168168
*You could also use the [Validation summary](#validation-summary) for displaying all errors as a header or even a footer*
@@ -266,9 +266,9 @@ Final code (without spaces): `regex:YYWW:=^(0[9]|1[0-9]|2[0-9]|3[0-9])(5[0-2]|[0
266266

267267
Locales (languages)
268268
--------------------
269-
Locales are simply sets of language defined in external JSON files, we can easily add any new language as extra files without affecting the behaviour of the angular directive. You could even change displayed language on the fly, well of course the error message will be reflected only after field value is re-evaluated. You of course have to include the `angular-translate` library and configure it, see section [Include it in your Project](#project)
269+
Locales are simple sets of language defined in external JSON files, we can easily add any new language as extra files without affecting the behaviour of the angular directive. You could even change displayed language on the fly (note that the error message will be reflected only after field value is re-evaluated). Make sure to include the `angular-translate` library and configure it, see section [Include it in your Project](#project)
270270

271-
NOTE: To be fully localized, I should add the country code at the end of my JSON filename and then change the suffix on the `angular-translate` `loader` method, but then this would add an overhead and I prefer to keep it simple as validation messages often looks the same anyway. If you do want to be fully localized, then see the example in [Include it in your Project](#project)
271+
NOTE: To be fully localized, I should add the country code at the end of my JSON filename and then change the suffix on the `angular-translate` `loader` method, but this would add an overhead and I prefer to keep it simple as validation messages often looks the same anyway (for example English from UK or US would most probably give similar error messages). If you really do want to be fully localized, then see the example in [Include it in your Project](#project)
272272

273273
```javascript
274274
// define a key, could be on the fly with a button or a menu link
@@ -383,6 +383,6 @@ License
383383
* [1.3.5](https://github.com/ghiscoding/angular-validation/commit/679b24ca4daee8419731c45d1d65d63cb5ca74a5) `2015-01-26` Throw an error message when user did not provide a `name=""` property inside the element to validate.
384384
* [1.3.6](https://github.com/ghiscoding/angular-validation/commit/e47e91f45f93a3f191ab6849d06163563674e9e2) `2015-02-09` Added `ng-strict-di` for minification, renamed some files and folder lib to `/vendors`, moved directive into new `/src` folder for better separation.
385385
* [1.3.7](https://github.com/ghiscoding/angular-validation/commit/86c16f720d6687d3b5ca93e49a0a37824027e583) `2015-03-08` Complete rewrite (but same functionality) so that I could add an Angular-Validation Service which is similar implementation as the Directive. Also added `debounce` attribute which is an alias to `typingLimit`, validation rules are now defined as an external service for better maintainability and also created a common file for shared functions by both Validation Directive and Service.
386-
* [1.3.8](https://github.com/ghiscoding/angular-validation/commit/492d1060a91fb8b49fc70a0c7a1a581d904e0db0) `2015-03-15` Added between/min/max conditional validators on all Date types (ISO, EURO_LONG, EURO_SHORT, US_LONG, US_SHORT)
386+
* [1.3.8](https://github.com/ghiscoding/angular-validation/commit/492d1060a91fb8b49fc70a0c7a1a581d904e0db0) `2015-03-15` Added between/min/max conditional validators on all Date types (iso, euro_long, euro_short, us_long, us_short)
387387
* [1.3.9](https://github.com/ghiscoding/angular-validation/commit/931d3b04a00f0583612aefe28ad0bfcac326a38c) `2015-03-21` Added validation summary through 2 new and equivalent properties `$scope.$validationSummary` and `$scope.formName.$validationSummary`. Also added `bower` and `gulp` support, the Gulp script gives minified files.
388388
* [1.3.10](https://github.com/ghiscoding/angular-validation/commit/18765a8dd986856a9fa176fc4835d90d25f663b2) `2015-03-29` Added new function of `checkFormValidity()` before submitting the form. Now use only 1 minified script instead of multiples.

0 commit comments

Comments
 (0)