|
2025-03-04
| ||
| 15:57 | • Closed ticket [2c0f49e26c]: Tcl 9 clock format -locale does not look up locale c... artifact: 6c702c5bdb user: sebres | |
| 15:51 | merge 9.0 / clock.tcl: fixes [2c0f49e26c27847a] - ensure cache remain consistent when deriving from ... check-in: e6e0dec9aa user: sebres tags: trunk, main | |
| 15:50 | merge 8.7 / clock.tcl: fixes [2c0f49e26c27847a] - ensure cache remain consistent when deriving from ... check-in: 862db0fdd2 user: sebres tags: core-9-0-branch | |
| 15:47 | clock.tcl: fixes [2c0f49e26c27847a] - ensure cache remain consistent when deriving from parent (don'... check-in: dc5c5857c1 user: sebres tags: core-8-branch | |
| 15:45 | tests/clock.test: added test illustrating bug [2c0f49e26c27847a] - cache becomes inconsist when deri... check-in: a91fabc1b0 user: sebres tags: core-8-branch | |
| 15:04 | • Ticket [2c0f49e26c] Tcl 9 clock format -locale does not look up locale children ... artifact: 24ceb700bf user: sebres | |
| 08:07 | • New ticket [2c0f49e26c]. artifact: 116f74a77b user: apnadkarni | |
Tcl 9 clock format -locale does not look up locale children if parent locale used first
Running the following script in Tcl 8.6 and Tcl 9 gives different results, Tcl 8.6 seems correct behavior.
package require msgcat
namespace eval ::tcl::clock {
::msgcat::mcset fr_xx DATE_FORMAT "%e|%B|%Y"
}
puts [package require Tcl]
puts [clock format 0 -format %x -locale fr]
puts [clock format 0 -format %x -locale fr_xx]
Output from Tcl 8.6:
8.6.16
1 janvier 1970
1|janvier|1970 <- Note pipe separator
Output from 9.0.1:
9.0.1
1 janvier 1970
1 janvier 1970 <- fr_xx format seemingly ignored
If the line for the fr locale is commented, Tcl 9 correctly prints the fr_xx format.
Good catch, Ashok!
The reason for that is that new clock-engine caching the msgcat dictionary internally in merged catalog (from parent to child locale), but more important here is that "%x" is so called "localized" format (since it expanding in ::tcl::clock::LocalizeFormat) and its result becomes also cached in merged catalog with keys FMT_* (here by FMT_%x), but (because it is not overwritten), the value remains as the value from parent catalog (after merge in ::tcl::clock::mcMerge).
The fix is simple, so I'll fix it now (and cover by a test).
Fixed in [dc5c5857c146c665] and merged to all derived branches.