.
D 2000-10-26T01:09:57
J assignee nobody
J cmimetype text/plain
J comment OriginalBugID:\s4158\sBug\nVersion:\s8.3\nSubmitDate:\s'2000-02-11'\nLastModified:\s'2000-04-11'\nSeverity:\sCRIT\nStatus:\sReleased\nSubmitter:\ssven\nChangedBy:\sericm\nRelatedBugIDs:\s2211\nOS:\sAll\nFixedDate:\s'2000-04-11'\nFixedInVersion:\s8.3.1\nClosedDate:\s'2000-10-25'\n\n\nWhen\susing\s::msgcat::mc,\sstrings\sare\sonly\sresolved\sby\slooking\sat\scatalog\sfiles\sthat\shave\sbeen\sloaded\sfrom\sinside\sthe\scurrent\snamespace.\sThis\smeans\sthat\swe\sneed\sa\smessage\scatalog\sdirectory\sfor\seach\snamespace\s(or\shave\sa\slot\sof\sredundancy\sby\sloading\sthe\sshared\scatalog\sfile\sinto\seach\snamespace).\n\nExpected\sbehavior:\nIt\swould\sbe\snice\sif\swe\scould\smake\sthe\s::msgcat::mc\scommand\sreslove\sthe\sstring\sby\slooking\sat\salternative\snamespaces\stoo.\sOne\spossibility\swould\sbe\sto\scheck\sthe\sroot\snamespace\s::\sif\sthe\sstring\scan\snot\sbe\sresolved\slocally,\sanother\sapproach\swould\sbe\sto\sgo\sup\sthe\snamespace\schain,\sand\scheck\son\seach\slevel.\n\n\n\nIf\swe\sare\sto\sdo\sthis,\sit\sshould\scheck\sthe\slocal\snamespace\sand\sthen\nthe\sglobal\snamespace,\smaking\sit\sthe\ssame\sas\sproc\sand\svariable\sname\nresolution.\s\n--\s04/03/2000\shobbs\n\nI\shave\sa\ssolution\sthat\schecks\sall\sthe\sparent\snamespaces\sand\sthen\sthe\sglobal\snamespace.\s\sIt\sis\snot\sthat\soften\sthat\speople\shave\snamespaces\sdeeper\sthan\s2\sor\s3,\sso\sI\sdon't\sthink\sit's\sa\sbig\sdeal\sto\scheck\sall\sof\sthem,\sbut\swe\scan\stake\sthat\sout\sif\speople\swant...\s\sMy\ssolution\salso\senables\smsgcat\sto\sdo\sstring\sformatting\srather\sfor\syou.\s\sFor\sexample,\n\n::msgcat::mcset\sen\sbadUserGroupCombo\s\s{Expected\s\\"%1$s\\"\sto\sbe\sa\suser\sand\s\\"%2$s\\"\sto\sbe\sa\sgroup.}\n\n::msgcat::mc\sbadUserGroupCombo\suserA\suserB\n==>\sExpected\s"userA"\sto\sbe\sa\suser\sand\s"userB"\sto\sbe\sa\sgroup.\n\n#\smsgcat::mc\s--\n#\n#Find\sthe\stranslation\sfor\sthe\sgiven\sstring\sbased\son\sthe\scurrent\n#locale\ssetting.\s\sCheck\sthe\slocal\snamespace\sfirst,\sthen\slook\sin\seach\n#parent\snamespace\suntil\sthe\ssource\sis\sfound.\s\sIf\sadditional\sargs\sare\n#specified,\suse\sthe\sformat\scommand\sto\swork\sthem\sinto\sthe\straslated\n#string.\n#\n#\sArguments:\n#srcThe\sstring\sto\stranslate.\n#argsArgs\spassed\sthe\sformat\scommand.\n#\n#\sResults:\n#Returns\sthe\stranslated\sstring.\n#Propages\serrors\sthrown\sby\sthe\sformat\scommand.\n\nproc\smsgcat::mc\s{src\sargs}\s{\n\s\s\s\s#\sCheck\sfor\sthe\ssrc\sin\seach\snamespace\sstarting\sfrom\sthe\slocal\sand\sending\n\s\s\s\s#\sin\sthe\sglobal.\n\n\s\s\s\sset\sns\s[uplevel\s{namespace\scurrent}]\n\n\s\s\s\swhile\s{![string\sequal\s$ns\s""]}\s{\nforeach\sloc\s$::msgcat::loclist\s{\n\s\s\s\sif\s{[info\sexists\s::msgcat::msgs($loc,$ns,$src)]}\s{\nif\s{[llength\s$args]\s==\s0}\s{\n\s\s\s\sreturn\s$::msgcat::msgs($loc,$ns,$src)\n}\selse\s{\n\s\s\s\sreturn\s[eval\sformat\s\s[list\s$::msgcat::msgs($loc,$ns,$src)]\s$args]\n}\n\s\s\s\s}\n}\nset\sns\s[namespace\sparent\s$ns]\n\s\s\s\s}\n\n\s\s\s\s#\swe\shave\snot\sfound\sthe\stranslation\n\s\s\s\sreturn\s[uplevel\s1\s[list\s[namespace\sorigin\smcunknown]\s\s$::msgcat::locale\s$src]]\n}\n\n--\s04/07/2000\shershey\n\nI\sapplied\sthis\spatch\sand\sadded\stests\sand\sdocs\sfor\sit\s(shame\son\syou\sfor\snot\ssubmitting\stests\sand\sdocs\syourself!).\s\sThe\sfix\sis\sin\sCVS\snow\sand\swill\sgo\sout\swith\s8.3.1.\n\n-\seric\n\n--\s04/11/2000\sericm\n\n
J foundin obsolete:\s8.3
J priority 5\sMedium
J resolution None
J status Open
J submitter nobody
J subsystem 81.\sBundled\sPackages
J title ::msgcat::mc\sonly\schecks\sthe\scurrent\snamespace\sfor\sresolving
J type RFE
K 219053ffffffffffffffffffffffffffffffffff
U nobody
Z 94c6ae586b3e2fc9471bf16e683208ee