/*

This file is part of Ext JS 4

Copyright (c) 2011 Sencha Inc

Contact:  http://www.sencha.com/contact

GNU General Public License Usage
This file may be used under the terms of the GNU General Public License version 3.0 as published by the Free Software Foundation and appearing in the file LICENSE included in the packaging of this file.  Please review the following information to ensure the GNU General Public License version 3.0 requirements will be met: http://www.gnu.org/copyleft/gpl.html.

If you are unsure which license is appropriate for your use, please contact the sales department at http://www.sencha.com/contact.

*/

Ext.onReady(function() {
    if(Ext.Updater) {
        Ext.Updater.defaults.indicatorText = '<div class="loading-indicator">En cours de chargement...</div>';
    }
    if(Ext.view.View){
        Ext.view.View.prototype.emptyText = "";
    }

    if(Ext.grid.Panel){
        Ext.grid.Panel.prototype.ddText = "{0} ligne{1} s&eacute;lectionn&eacute;e{1}";
    }

    if(Ext.LoadMask){
        Ext.LoadMask.prototype.msg = "En cours de chargement...";
    }

    if(Ext.Date){
        Ext.Date.shortMonthNames = [
        "Janv",
        "F&eacute;vr",
        "Mars",
        "Avr",
        "Mai",
        "Juin",
        "Juil",
        "Aout",
        "Sept",
        "Oct",
        "Nov",
        "D&eacute;c"
        ];

        Ext.Date.getShortMonthName = function(month) {
            return Ext.Date.shortMonthNames[month];
        };

        Ext.Date.monthNames = [
        "Janvier",
        "F&eacute;vrier",
        "Mars",
        "Avril",
        "Mai",
        "Juin",
        "Juillet",
        "Aout",
        "Septembre",
        "Octobre",
        "Novembre",
        "D&eacute;cembre"
        ];

        Ext.Date.monthNumbers = {
            "Janvier" : 0,
            "F&eacute;vrier" : 1,
            "Mars" : 2,
            "Avril" : 3,
            "Mai" : 4,
            "Juin" : 5,
            "Juillet" : 6,
            "Aout" : 7,
            "Septembre" : 8,
            "Octobre" : 9,
            "Novembre" : 10,
            "D&eacute;cembre" : 11
        };

        Ext.Date.getMonthNumber = function(name) {
            return Ext.Date.monthNumbers[Ext.util.Format.capitalize(name)];
        };

        Ext.Date.dayNames = [
        "Dimanche",
        "Lundi",
        "Mardi",
        "Mercredi",
        "Jeudi",
        "Vendredi",
        "Samedi"
        ];

        Ext.Date.getShortDayName = function(day) {
            return Ext.Date.dayNames[day].substring(0, 3);
        };

        Ext.Date.parseCodes.S.s = "(?:er)";

        Ext.override(Date, {
            getSuffix : function() {
                return (this.getDate() == 1) ? "er" : "";
            }
        });
    }
    if(Ext.MessageBox){
        Ext.MessageBox.buttonText = {
            ok     : "OK",
            cancel : "Annuler",
            yes    : "Oui",
            no     : "Non"
        };
    }

    if(Ext.util.Format){
        Ext.apply(Ext.util.Format, {
            thousandSeparator: '.',
            decimalSeparator: ',',
            currencySign: '\u20ac',  // French Euro
            dateFormat: 'd/m/Y'
        });
    }

    if(Ext.picker.Date){
        Ext.apply(Ext.picker.Date.prototype, {
            todayText         : "Aujourd'hui",
            minText           : "Cette date est ant&eacute;rieure à la date minimum",
            maxText           : "Cette date est post&eacute;rieure à la date maximum",
            disabledDaysText  : "",
            disabledDatesText : "",
            monthNames        : Ext.Date.monthNames,
            dayNames          : Ext.Date.dayNames,
            nextText          : 'Mois suivant (CTRL+Flèche droite)',
            prevText          : "Mois pr&eacute;c&eacute;dent (CTRL+Flèche gauche)",
            monthYearText     : "Choisissez un mois (CTRL+Flèche haut ou bas pour changer d'ann&eacute;e.)",
            todayTip          : "{0} (Barre d'espace)",
            format            : "d/m/y",
            startDay          : 1
        });
    }

    if(Ext.picker.Month) {
        Ext.apply(Ext.picker.Month.prototype, {
            okText            : "&#160;OK&#160;",
            cancelText        : "Annuler"
        });
    }

    if(Ext.toolbar.Paging){
        Ext.apply(Ext.PagingToolbar.prototype, {
            beforePageText : "Page",
            afterPageText  : "sur {0}",
            firstText      : "Première page",
            prevText       : "Page pr&eacute;c&eacute;dente",
            nextText       : "Page suivante",
            lastText       : "Dernière page",
            refreshText    : "Actualiser la page",
            displayMsg     : "Page courante {0} - {1} sur {2}",
            emptyMsg       : 'Aucune donn&eacute;e à afficher'
        });
    }

    if(Ext.form.Basic){
        Ext.form.Basic.prototype.waitTitle = "Veuillez patienter...";
    }

    if(Ext.form.field.Base){
        Ext.form.field.Base.prototype.invalidText = "La valeur de ce champ est invalide";
    }

    if(Ext.form.field.Text){
        Ext.apply(Ext.form.field.Text.prototype, {
            minLengthText : "La longueur minimum de ce champ est de {0} caractère(s)",
            maxLengthText : "La longueur maximum de ce champ est de {0} caractère(s)",
            blankText     : "Ce champ est obligatoire",
            regexText     : "",
            emptyText     : null
        });
    }

    if(Ext.form.field.Number){
        Ext.apply(Ext.form.field.Number.prototype, {
            decimalSeparator : ",",
            decimalPrecision : 2,
            minText : "La valeur minimum de ce champ doit être de {0}",
            maxText : "La valeur maximum de ce champ doit être de {0}",
            nanText : "{0} n'est pas un nombre valide"
        });
    }

    if(Ext.form.field.Date){
        Ext.apply(Ext.form.field.Date.prototype, {
            disabledDaysText  : "D&eacute;sactiv&eacute;",
            disabledDatesText : "D&eacute;sactiv&eacute;",
            minText           : "La date de ce champ ne peut être ant&eacute;rieure au {0}",
            maxText           : "La date de ce champ ne peut être post&eacute;rieure au {0}",
            invalidText       : "{0} n'est pas une date valide - elle doit être au format suivant: {1}",
            format            : "d/m/y",
            altFormats        : "d/m/Y|d-m-y|d-m-Y|d/m|d-m|dm|dmy|dmY|d|Y-m-d"
        });
    }

    if(Ext.form.field.ComboBox){
        Ext.apply(Ext.form.field.ComboBox.prototype, {
            valueNotFoundText : undefined
        });
        Ext.apply(Ext.form.field.ComboBox.prototype.defaultListConfig, {
            loadingText       : "En cours de chargement..."
        });
    }

    if(Ext.form.field.VTypes){
        Ext.apply(Ext.form.field.VTypes, {
            emailText    : 'Ce champ doit contenir une adresse email au format: "usager@example.com"',
            urlText      : 'Ce champ doit contenir une URL au format suivant: "http:/'+'/www.example.com"',
            alphaText    : 'Ce champ ne peut contenir que des lettres et le caractère soulign&eacute; (_)',
            alphanumText : 'Ce champ ne peut contenir que des caractères alphanum&eacute;riques ainsi que le caractère soulign&eacute; (_)'
        });
    }

    if(Ext.form.field.HtmlEditor){
        Ext.apply(Ext.form.field.HtmlEditor.prototype, {
            createLinkText : "Veuillez entrer l'URL pour ce lien:",
            buttonTips : {
                bold : {
                    title: 'Gras (Ctrl+B)',
                    text: 'Met le texte s&eacute;lectionn&eacute; en gras.',
                    cls: Ext.baseCSSPrefix + 'html-editor-tip'
                },
                italic : {
                    title: 'Italique (Ctrl+I)',
                    text: 'Met le texte s&eacute;lectionn&eacute; en italique.',
                    cls: Ext.baseCSSPrefix + 'html-editor-tip'
                },
                underline : {
                    title: 'Soulign&eacute; (Ctrl+U)',
                    text: 'Souligne le texte s&eacute;lectionn&eacute;.',
                    cls: Ext.baseCSSPrefix + 'html-editor-tip'
                },
                increasefontsize : {
                    title: 'Agrandir la police',
                    text: 'Augmente la taille de la police.',
                    cls: Ext.baseCSSPrefix + 'html-editor-tip'
                },
                decreasefontsize : {
                    title: 'R&eacute;duire la police',
                    text: 'R&eacute;duit la taille de la police.',
                    cls: Ext.baseCSSPrefix + 'html-editor-tip'
                },
                backcolor : {
                    title: 'Couleur de surbrillance',
                    text: 'Modifie la couleur de fond du texte s&eacute;lectionn&eacute;.',
                    cls: Ext.baseCSSPrefix + 'html-editor-tip'
                },
                forecolor : {
                    title: 'Couleur de police',
                    text: 'Modifie la couleur du texte s&eacute;lectionn&eacute;.',
                    cls: Ext.baseCSSPrefix + 'html-editor-tip'
                },
                justifyleft : {
                    title: 'Aligner à gauche',
                    text: 'Aligne le texte à gauche.',
                    cls: Ext.baseCSSPrefix + 'html-editor-tip'
                },
                justifycenter : {
                    title: 'Centrer',
                    text: 'Centre le texte.',
                    cls: Ext.baseCSSPrefix + 'html-editor-tip'
                },
                justifyright : {
                    title: 'Aligner à droite',
                    text: 'Aligner le texte à droite.',
                    cls: Ext.baseCSSPrefix + 'html-editor-tip'
                },
                insertunorderedlist : {
                    title: 'Liste à puce',
                    text: 'D&eacute;marre une liste à puce.',
                    cls: Ext.baseCSSPrefix + 'html-editor-tip'
                },
                insertorderedlist : {
                    title: 'Liste num&eacute;rot&eacute;e',
                    text: 'D&eacute;marre une liste num&eacute;rot&eacute;e.',
                    cls: Ext.baseCSSPrefix + 'html-editor-tip'
                },
                createlink : {
                    title: 'Lien hypertexte',
                    text: 'Transforme en lien hypertexte.',
                    cls: Ext.baseCSSPrefix + 'html-editor-tip'
                },
                sourceedit : {
                    title: 'Code source',
                    text: 'Basculer en mode &eacute;dition du code source.',
                    cls: Ext.baseCSSPrefix + 'html-editor-tip'
                }
            }
        });
    }

    if(Ext.grid.header.Container){
        Ext.apply(Ext.grid.header.Container.prototype, {
            sortAscText  : "Tri croissant",
            sortDescText : "Tri d&eacute;croissant",
            columnsText  : "Colonnes"
        });
    }

    if(Ext.grid.GroupingFeature){
        Ext.apply(Ext.grid.GroupingFeature.prototype, {
            emptyGroupText : '(Aucun)',
            groupByText    : 'Grouper par ce champ',
            showGroupsText : 'Afficher par groupes'
        });
    }

    if(Ext.grid.PropertyColumnModel){
        Ext.apply(Ext.grid.PropertyColumnModel.prototype, {
            nameText   : "Propri&eacute;t&eacute;",
            valueText  : "Valeur",
            dateFormat : "d/m/Y",
            trueText   : "vrai",
            falseText  : "faux"
        });
    }

    if(Ext.layout.BorderLayout && Ext.layout.BorderLayout.SplitRegion){
        Ext.apply(Ext.layout.BorderLayout.SplitRegion.prototype, {
            splitTip            : "Cliquer et glisser pour redimensionner le panneau.",
            collapsibleSplitTip : "Cliquer et glisser pour redimensionner le panneau. Double-cliquer pour le cacher."
        });
    }

    if(Ext.form.field.Time){
        Ext.apply(Ext.form.field.Time.prototype, {
            minText     : "L'heure de ce champ ne peut être ant&eacute;rieure à {0}",
            maxText     : "L'heure de ce champ ne peut être post&eacute;rieure à {0}",
            invalidText : "{0} n'est pas une heure valide",
            format      : "H:i",
            altFormats  : "g:ia|g:iA|g:i a|g:i A|h:i|g:i|H:i|ga|h a|g a|g A|gi|hi|Hi|gia|hia|g|H"
        });
    }

    if(Ext.form.CheckboxGroup){
        Ext.apply(Ext.form.CheckboxGroup.prototype, {
            blankText : "Vous devez s&eacute;lectionner au moins un &eacute;l&eacute;ment dans ce groupe"
        });
    }

    if(Ext.form.RadioGroup){
        Ext.apply(Ext.form.RadioGroup.prototype, {
            blankText : "Vous devez s&eacute;lectionner au moins un &eacute;l&eacute;ment dans ce groupe"
        });
    }

});

