/[js_locale]/trunk/locale.js
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/locale.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/sort.html revision 1 by dpavlin, Sun Oct 24 19:16:22 2004 UTC trunk/locale.js revision 2 by dpavlin, Sun Oct 24 20:01:27 2004 UTC
# Line 1  Line 1 
 <html>  
 <head>  
  <title>JavaScript sort which honors static locale settings</title>  
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">  
 </head>  
 <body bgcolor="white">  
   
 <p>  
 This is a demo of JavaScript sort which honors static locale LC_COLLATE  
 settings, embedded in one JavaScript variable which can be created from  
 local system using attached perl script.  
 </p><p>  
 Script by Dobrica Pavlinu¹iæ, &lt;dpavlin@rot13.org&gt; 2004-10-24  
 </p>  
   
 <tt>  
   
 <script type="text/javascript">  
1    
2  // locale in which to sort (basically a alphabet in correct dictionary sort order)  // locale in which to sort (basically a alphabet in correct dictionary sort order)
3  var _lc_locale = '_0123456789aAáÁãÃâÂäı¡bBcCçÇèÈæÆdDïÏðÐeEéÉìÌëËêÊfFgGhHiIíÍîÎjJkKlLåŵ¥³£mMnNñÑòÒoOóÓôÔöÖõÕpPqQrRàÀøØsS¶¦ºªß¹©tT»«þÞuUúÚùÙüÜûÛvVwWxXyYýÝzZ¼¬¿¯¾®';  var _lc_locale = '_0123456789aAáÁãÃâÂäı¡bBcCçÇèÈæÆdDïÏðÐeEéÉìÌëËêÊfFgGhHiIíÍîÎjJkKlLåŵ¥³£mMnNñÑòÒoOóÓôÔöÖõÕpPqQrRàÀøØsS¶¦ºªß¹©tT»«þÞuUúÚùÙüÜûÛvVwWxXyYýÝzZ¼¬¿¯¾®';
# Line 83  function _lc_sort(a,b) { Line 65  function _lc_sort(a,b) {
65          }          }
66  }  }
67    
 // test string array of Croatian words  
 var test = [  
         'abrakadabra',  
         'èevap',  
         'ðak',  
         'd¾amija',  
         'æuk',  
         'pero',  
         '¾aba',  
         'Ðakovo',  
         'Zagreb'  
 ];  
   
 // create some output  
 document.write(  
         "<br>original: ",test.join(" * "),  
         "<br>native: ",test.sort().join(" * "),  
         "<br>locale: ",test.sort(_lc_sort).join(" * ")  
 );  
   
 </script>  
   
 </tt>  
   
 <br>  
 <p>Sorting finished.</p>  
   
 </body>  
 </html>  

Legend:
Removed from v.1  
changed lines
  Added in v.2

  ViewVC Help
Powered by ViewVC 1.1.26