Basics

jqGrid for PHP comes with a large number of predefined language packs and settings for almost all popular languages. They are located in the installation package, in the /js/i18n folder. Language packs are in the form of javascript files, containing definitions for all strings in the grid that can be localized - this includes messages, captions, paging information, search/add/delete dialog labels, etc.

In order to use a particular language pack, you need to include the javascript language pack to the head section of your page, after the jQuery library reference (since language packs depend on jQuery) and before referencing the jqGrid javascript file (since it is dependent on the language pack). A typical setup for English localization would look like this:

... <head> <!-- The jQuery UI theme that will be used by the grid --> <link rel="stylesheet" type="text/css" media="screen" href="/themes/redmond/jquery-ui-1.7.1.custom.css" /> <!-- The jQuery UI theme extension jqGrid needs --> <link rel="stylesheet" type="text/css" media="screen" href="/themes/ui.jqgrid.css" /> <!-- jQuery runtime minified --> <script src="/js/jquery-1.3.2.min.js" type="text/javascript"></script> <!-- The localization file we need, English in this case --> <script src="/js/i18n/grid.locale-en.js" type="text/javascript"></script> <!-- The jqGrid client-side javascript --> <script src="/js/jquery.jqGrid.min.js" type="text/javascript"></script> ... </head> ...

Note: The order in which the javascript files are included is very important, because of the dependencies described above.

If you want to use the Norwegian localization of jqGrid, just use something along the lines of:

... <head> <!-- The jQuery UI theme that will be used by the grid --> <link rel="stylesheet" type="text/css" media="screen" href="/themes/redmond/jquery-ui-1.7.1.custom.css" /> <!-- The jQuery UI theme extension jqGrid needs --> <link rel="stylesheet" type="text/css" media="screen" href="/themes/ui.jqgrid.css" /> <!-- jQuery runtime minified --> <script src="/js/jquery-1.3.2.min.js" type="text/javascript"></script> <!-- The localization file we need, Norwegian in this case --> <script src="/js/i18n/grid.locale-no.js" type="text/javascript"></script> <!-- The jqGrid client-side javascript --> <script src="/js/jquery.jqGrid.min.js" type="text/javascript"></script> ... </head> ...