Skip to content

Commit

Permalink
seamless localization + FR locale
Browse files Browse the repository at this point in the history
  • Loading branch information
elclanrs committed Oct 10, 2013
1 parent 622bca2 commit ca575cb
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 38 deletions.
21 changes: 7 additions & 14 deletions README.md
Expand Up @@ -366,7 +366,7 @@ $('form').idealforms({
});
```

### Extension: Dynamic Fields
### Extension - Dynamic Fields

**Name:** `dynamicFields`

Expand Down Expand Up @@ -497,7 +497,7 @@ $('form').idealforms('toggleFields', 'username password hobbies[]');

Dynamic Fields adds injection points for `addFields`, `removeFields` and `toggleFields`. Read about [custom extensions](#custom-extensions) for more info.

### Extension: Steps
### Extension - Steps

**Name:** `steps`

Expand Down Expand Up @@ -597,15 +597,15 @@ Steps adds the `appendToStep:index` option to `addFields`:
$('form').addFields({ 'field': { type: 'text', label: 'Field', appendToStep: 1 }});
```

### Extension: Custom Inputs
### Extension - Custom Inputs

Adds custom checkboxes, radios and file inputs (yes!) seamlessly. The custom select menu has been dropped from Ideal Forms 3; it was proving to be a pain to maintain, and there are much better alternatives, such as [Select2](http://ivaynberg.github.io/select2/) if you need them.

**Note:** File inputs must have an `id` as well as a `name` to work on IE.

This extension has no additional options or methods.

### Extension: Ajax
### Extension - Ajax

**Name:** `ajax`

Expand Down Expand Up @@ -640,7 +640,7 @@ echo json_encode(true);

If the response gets delayed the field will switch into "ajax mode" by showing a loading icon until the response comes back.

### Extension: Datepicker
### Extension - Datepicker

**Name:** `datepicker`

Expand Down Expand Up @@ -671,7 +671,7 @@ $('form').idealforms({

$('.datepicker').datepicker('option', 'dateFormat', 'yy-mm-dd');
```
### Extension: Adaptive
### Extension - Adaptive

**Name:** `adaptive`

Expand Down Expand Up @@ -772,18 +772,11 @@ _init: function() {

## Localization

To localize Ideal Forms load the corresponding i18n file from `js/i18n` **after** the plugin and pass the `i18n` option:
To localize Ideal Forms load the corresponding i18n file from `js/i18n` **after** the plugin:

```html
<script src="jquery.idealforms.js"></script>
<script src="jquery.idealforms.i18n.es.js"></script>

<script>
$('form').idealforms({
i18n: 'es',
...
});
</script>
```

Creating your own locale file:
Expand Down
10 changes: 5 additions & 5 deletions index.php
Expand Up @@ -201,7 +201,7 @@
<!--<script src="js/out/jquery.idealforms.min.js"></script>-->
<script>
$('form').idealforms({
$('form.idealforms').idealforms({
rules: {
'username': 'required username ajax',
Expand All @@ -228,21 +228,21 @@
}
});
$('form').find('input, select, textarea').on('change keyup', function() {
$('form.idealforms').find('input, select, textarea').on('change keyup', function() {
$('#invalid').hide();
});
$('form').idealforms('addRules', {
$('form.idealforms').idealforms('addRules', {
'comments': 'required minmax:50:200'
});
$('.prev').click(function(){
$('.prev').show();
$('form').idealforms('prevStep');
$('form.idealforms').idealforms('prevStep');
});
$('.next').click(function(){
$('.next').show();
$('form').idealforms('nextStep');
$('form.idealforms').idealforms('nextStep');
});
</script>
Expand Down
2 changes: 1 addition & 1 deletion js/i18n/jquery.idealforms.i18n.es.js
Expand Up @@ -30,7 +30,7 @@ $.idealforms.i18n.es = {
maxoption: 'No puede haber más de {0} opciones seleccionadas',
minmax: 'Debe contener al menos {0} pero no más de {1} caracteres',
select: 'Selecciona una option',
extension: 'Los ficheros deben tener una extensión válida',
extension: 'Los ficheros deben tener una extensión válida ({*})',
equalto: 'Debe ser idéntico a <strong>"{0}"</strong>',
date: 'Debe ser una fecha válida {0}',
ajax: 'Cargando...'
Expand Down
20 changes: 11 additions & 9 deletions js/out/jquery.idealforms.js

Large diffs are not rendered by default.

0 comments on commit ca575cb

Please sign in to comment.