Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | tip490 oo for msgcat: re-changed "option" to "extension" |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
016afc2026cb29ea05499244dcbf1097 |
User & Date: | oehhar 2018-03-09 10:05:54.492 |
Context
2018-03-10
| ||
13:45 | Allow filtering of more TIP states (inadvertently forgotten previously) check-in: 87d94d7d82 user: dkf tags: trunk | |
2018-03-09
| ||
10:05 | tip490 oo for msgcat: re-changed "option" to "extension" check-in: 016afc2026 user: oehhar tags: trunk | |
2018-03-08
| ||
14:24 | More formatting tweaking check-in: 072c7a281d user: dkf tags: trunk | |
Changes
Changes to tip/490.md.
︙ | ︙ | |||
125 126 127 128 129 130 131 | -> Servus! </pre> This should still work with the new extension for compatibility reasons. # Proposal | | | | | 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 | -> Servus! </pre> This should still work with the new extension for compatibility reasons. # Proposal The following 4 extensions are proposed and covered by the TIP. ## Extension 1: Extend all msgcat commands to support all 4 use-cases. So any **msgcat** command will detect the scenario on its own and extract the package namespace automatically. The commands which are packet-namespace related are: **mc**, **mcexists**, **mcpackagelocale**, **mcforgetpackage**, **mcpackagenamespaceget** (new command, see below), **mcpackageconfig**, **mcset** and **mcmset**. This has the following advantages (compared to the alternatives): |
︙ | ︙ | |||
154 155 156 157 158 159 160 | ... set message [uplevel 1 {::msgcat::mc $message}] } </pre> This will work in all use-cases, e.g. if `tooltip::tooltip` is called by a method following use-case 1 to 4. | | | 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | ... set message [uplevel 1 {::msgcat::mc $message}] } </pre> This will work in all use-cases, e.g. if `tooltip::tooltip` is called by a method following use-case 1 to 4. ## Extension 2: new command to get package namespace The "magic" to extract the package namespace is exposed by the command: <pre> mcpackagenamespaceget </pre> |
︙ | ︙ | |||
184 185 186 187 188 189 190 | proc ::tooltip::show {widget messagenamespace message} { ... set message [namespace eval $messagenamespace [list ::msgcat::mc $message]] ... } </pre> | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | > > > | 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 | proc ::tooltip::show {widget messagenamespace message} { ... set message [namespace eval $messagenamespace [list ::msgcat::mc $message]] ... } </pre> ## Extension 3: new command to get a translation with a package namespace as argument A new command is proposed to get a translation with an explicit namespace: <pre> mcn ns src args... </pre> with the arguments: * ns: package namespace to do the translation for * src: the translation source string (like mc command) * args: eventual arguments to contained format patterns (like mc command) This command is identical to the `mc` command, with the difference, that the package namespace is not found by an implicit call to `mcpackagenamespaceget`, but may be explicitly specified as first argument Then, the `mc` command may be expressed like: |
︙ | ︙ | |||
300 301 302 303 304 305 306 | proc ::tooltip::show {widget messagenamespace message} { ... set message [::msgcat::mcn $messagenamespace $message] } </pre> | | | 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 | proc ::tooltip::show {widget messagenamespace message} { ... set message [::msgcat::mcn $messagenamespace $message] } </pre> ## Extension 4: Command "mcexists" should get a parameter -namespace to explicitly specify the namespace The command `mcexists` has currently the syntax: <pre> mcexists ?-exactnamespace? ?-exactlocale? src </pre> |
︙ | ︙ |