From: Harald O. <har...@el...> - 2012-09-08 08:33:45
|
Am 07.09.2012 21:39, schrieb Kevin Kenny: > Could you give me the "elevator speech" about what's needed with the > [clock] command? I thought that '-locale current' was already doing > The Right Thing, and dynamic locale changes would be transparent to > it. Did I err? (Remember that the default locale for [clock] is {} - > by design.) I only did a small scan what clock does and my conclusions are not complete. When a user gives the argument "-locale <locale>" to the clock command, clock issues a: set oldLocale [mclocale] ... mclocale <locale> In future, this would have the following consequences: C1) those locales are loaded for all packages using msgcat C2) the callback "changecmd" would be called and an eventual gui would change its language After the clock command has processed the request, it issues a mclocale $oldLocale which will again call the callback. I see currently the following solutions: S1) clock does not use msgcat and uses its own solution instead. S2) introduce a per-package locale state. In consequence, the properties *"mclocale" "loadedlocales*" and "*removeobsoletelocale"* should be present globally as default and per package. The callback "changecmd" shoud wether not be called on package local change (my favorite) or should have an additional field "package" (eg namespace). S3) As S2, but no locale "locale" state Eventually, "mclocale" should not be per package. Instead, a command "mcl <locale> <key> <args>" may be introduced to get message catalog data from different locales without changing the locale. Or maybee both are helpful. S4) Simple solution accepting C1: - only introduce mcl command as in S2.1) "clock -locale <locale>" does the following: - check if "<locale>" is in "loadedlocales". If yes, use "mcl" to get the locale entries. - if no, store *removeobsoletelocale and *set it to 0 - add <locale> to "loadedlocales". This will load the locale for all packages but will not cause fire the callback - use mcl to get the locales - restore *removeobsoletelocale if it was 1. This may remove the just loaded locale* I am in favor of S3 currently. Any comments and ideas welcome, Harald |