Translate datepicker Kendo UI with AngularJS

5

I need to translate the kendo date picker into Portuguese, I've already inserted the i18n file into my html but it did not work, I did the same in angle and ran angled

My html

<head>
<script src="angular-locale_pt-br.js"></script>
<script src="kendo.culture.pt-BR.js"></script>

</head>
<body>
   <input kendo-date-picker>
</body>

kendo.culture.pt-BR.js

(function( window, undefined ) {
kendo.cultures["pt-BR"] = {
    name: "pt-BR",
    numberFormat: {
        pattern: ["-n"],
        decimals: 2,
        ",": ".",
        ".": ",",
        groupSize: [3],
        percent: {
            pattern: ["-n%","n%"],
            decimals: 2,
            ",": ".",
            ".": ",",
            groupSize: [3],
            symbol: "%"
        },
        currency: {
            pattern: ["-$ n","$ n"],
            decimals: 2,
            ",": ".",
            ".": ",",
            groupSize: [3],
            symbol: "R$"
        }
    },
    calendars: {
        standard: {
            days: {
                names: ["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"],
                namesAbbr: ["dom","seg","ter","qua","qui","sex","sáb"],
                namesShort: ["D","S","T","Q","Q","S","S"]
            },
            months: {
                names: ["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro",""],
                namesAbbr: ["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez",""]
            },
            AM: [""],
            PM: [""],
            patterns: {
                d: "dd/MM/yyyy",
                D: "dddd, d' de 'MMMM' de 'yyyy",
                F: "dddd, d' de 'MMMM' de 'yyyy HH:mm:ss",
                g: "dd/MM/yyyy HH:mm",
                G: "dd/MM/yyyy HH:mm:ss",
                m: "d' de 'MMMM",
                M: "d' de 'MMMM",
                s: "yyyy'-'MM'-'dd'T'HH':'mm':'ss",
                t: "HH:mm",
                T: "HH:mm:ss",
                u: "yyyy'-'MM'-'dd HH':'mm':'ss'Z'",
                y: "MMMM' de 'yyyy",
                Y: "MMMM' de 'yyyy"
            },
            "/": "/",
            ":": ":",
            firstDay: 0
        }
    }
 }
})(this);

What's missing?

    
asked by anonymous 14.08.2014 / 14:29

1 answer

3

To solve, just set the culture in its scope that the components that will be on the page will be translated

example:

var app = angular.module('teste', [ 'kendo.directives' ]);

 app.controller('testeController',
     [ '$scope', function ($scope) {

    kendo.culture("pt-BR"); 
   ...

Translation files can be found at the following links

link translation to the grid

The translation for the DateTimePicker and DatePicker components follows below, then save to a file and import into your page as I did above.

(function( window, undefined ) {
kendo.cultures["pt-BR"] = {
    name: "pt-BR",
    numberFormat: {
        pattern: ["-n"],
        decimals: 2,
        ",": ".",
        ".": ",",
        groupSize: [3],
        percent: {
            pattern: ["-n%","n%"],
            decimals: 2,
            ",": ".",
            ".": ",",
            groupSize: [3],
            symbol: "%"
        },
        currency: {
            pattern: ["-$ n","$ n"],
            decimals: 2,
            ",": ".",
            ".": ",",
            groupSize: [3],
            symbol: "R$"
        }
    },
    calendars: {
        standard: {
            days: {
                names: ["domingo","segunda-feira","terça-feira","quarta-feira","quinta-feira","sexta-feira","sábado"],
                namesAbbr: ["dom","seg","ter","qua","qui","sex","sáb"],
                namesShort: ["D","S","T","Q","Q","S","S"]
            },
            months: {
                names: ["janeiro","fevereiro","março","abril","maio","junho","julho","agosto","setembro","outubro","novembro","dezembro",""],
                namesAbbr: ["jan","fev","mar","abr","mai","jun","jul","ago","set","out","nov","dez",""]
            },
            AM: [""],
            PM: [""],
            patterns: {
                d: "dd/MM/yyyy",
                D: "dddd, d' de 'MMMM' de 'yyyy",
                F: "dddd, d' de 'MMMM' de 'yyyy HH:mm:ss",
                g: "dd/MM/yyyy HH:mm",
                G: "dd/MM/yyyy HH:mm:ss",
                m: "d' de 'MMMM",
                M: "d' de 'MMMM",
                s: "yyyy'-'MM'-'dd'T'HH':'mm':'ss",
                t: "HH:mm",
                T: "HH:mm:ss",
                u: "yyyy'-'MM'-'dd HH':'mm':'ss'Z'",
                y: "MMMM' de 'yyyy",
                Y: "MMMM' de 'yyyy"
            },
            "/": "/",
            ":": ":",
            firstDay: 0
        }
    }
}
})(this);
    
15.08.2014 / 21:07