Tcl Source Code

View Ticket
Login
Ticket UUID: 402874
Title: localization - czech locale support for Tcl/Tk 8.3.2
Type: Patch Version: None
Submitter: haf Created on: 2000-12-16 15:14:26
Subsystem: 17. Commands I-L Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2016-08-23 09:39:05
Resolution: Out of Date Closed By: dkf
    Closed on: 2016-08-23 09:39:05
User Comments: hobbs added on 2002-08-08 14:47:18:
Logged In: YES 
user_id=72656

Note that 8.4 has improved locale detection, so I believe most 
of this patch is mitigated there.  The other parts really need 
proper -locale options.

hobbs added on 2001-03-29 08:56:07:
Logged In: YES 
user_id=72656

While some parts of this look OK, others look like they 
might adversely affect users in other locales, especially 
if they are relying on i18n standard behavior (please note 
that i18n != l10n).  In the places where it might be good, 
I believe it would be better to add -locale options, or 
some other capability to switch this on and off.

haf added on 2000-12-17 00:48:31:
DESC: Correct bug in patch for file tcl/generic/tclCmdIL.c

diff -urw ../tclCmdIL.c.original tclCmdIL.c
--- ../tclCmdIL.c.originalTue Apr  4 10:04:41 2000
+++ tclCmdIL.cThu Dec  9 16:17:57 2000
@@ -2823,6 +2823,10 @@
     Tcl_Obj *objPtr;
     char buffer[TCL_INTEGER_SPACE];
 
+    /* * */
+    /* Variables which we need to locale sorting support. */
+    Tcl_DString ds1, ds2;
+    /* * */    
     order = 0;
     if (infoPtr->resultCode != TCL_OK) {
 /*
@@ -2889,7 +2893,10 @@
 objPtr2 = objPtr;
     }
     if (infoPtr->sortMode == SORTMODE_ASCII) {
-order = strcmp(Tcl_GetString(objPtr1), Tcl_GetString(objPtr2));
+/* * */
+/* Apply locale dependent sorting rules - patch by Roman Vasicek */
+order = strcoll(Tcl_UtfToExternalDString(NULL, Tcl_GetString(objPtr1), -1, &ds1), Tcl_UtfToExternalDString(NULL, Tcl_GetString(objPtr2), -1, &ds2));
+/* * */
     } else if (infoPtr->sortMode == SORTMODE_DICTIONARY) {
 order = DictionaryCompare(
 Tcl_GetString(objPtr1),Tcl_GetString(objPtr2));
@@ -2963,6 +2970,10 @@
     if (!infoPtr->isIncreasing) {
 order = -order;
     }
+    /* * */
+    Tcl_DStringFree(&ds1);
+    Tcl_DStringFree(&ds2);
+    /* * */
     return order;
 }

Attachments: