Localization and require.js

4 posts, 1 answers
  1. Marcin
    Marcin avatar
    165 posts
    Member since:
    Jan 2011

    Posted 22 Dec 2015 Link to this post

    Could you please guide me how to use localization together with require js.

     Following code produces error:

     window.require(
                [
                "kendo/kendo.menu.min",
                "kendo/kendo.router.min",
                "kendo/kendo.notification.min",
                "kendo/kendo.window.min",
                "kendo/cultures/kendo.culture.en-GB.min",
                "kendo/messages/kendo.messages.en-GB.min"
                ], function() {
                   
                    window.kendo.culture("en-GB");

                    console.log("culture", window.kendo.culture());              
                });

     The error is:

    TypeError: kendo.ui is undefined Scripts/Kendo/messages/kendo.messages.en-GB.min.js?ver=1450788192741

    Rest of config is working.

     

     

  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 24 Dec 2015 Link to this post

    Hello Marcin,

    There is no kendo.messages.en-GB file. We do generate the cultures files from external resources which is why we have file for each culture. The same however is not possible for localization files - the localization files are community effort, Kendo Team keeps up to date only the en-US file which clients use as a reference to create their own localization files.

    Regards,
    Alexander Valchev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  3. Kendo UI is VS 2017 Ready
  4. Marcin
    Marcin avatar
    165 posts
    Member since:
    Jan 2011

    Posted 24 Dec 2015 in reply to Alexander Valchev Link to this post

    Hi, lets I know there is no such original file. But my question was how to use messages file together with requirejs. It can be any messages file. Jus would like to know how to use it. 

     Regards

    Marcin

  5. Answer
    Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 24 Dec 2015 Link to this post

    Hi Marcin,

    In order to get this working you have to use nested RequireJS callbacks:

    require.config({
        baseUrl: "../",
        paths: {
            // Specify the location of the jQuery JS file since it is loaded from the jQuery CDN
            "jquery": "http://code.jquery.com/jquery-1.9.1.min",
        }
    });
     
    require([ "src/kendo.binder", "src/kendo.combobox", "src/kendo.virtuallist" ], function(){
        require([ "src/cultures/kendo.culture.bg-BG", "src/messages/kendo.messages.bg-BG" ], function() {
            kendo.culture("bg-BG");
            console.log(kendo.culture());
        })
    });


    Regards,
    Alexander Valchev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready