Changeset 13860 in project
- Timestamp:
- 03/22/09 20:58:55 (11 years ago)
- Location:
- release/3/locale/trunk
- Files:
-
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
release/3/locale/trunk/locale-categories.scm
r13852 r13860 14 14 locale-dictionary-category 15 15 ; 16 current-locale-dictionary 16 17 locale-category-ref 17 18 set-locale-category!) ) 18 19 19 (require-extension srfi-9 lookup-table locale-components locale-errors)20 (require-extension srfi-9 miscmacros lookup-table locale-components locale-errors) 20 21 21 22 ;; … … 24 25 (unless (symbol? obj) 25 26 (type-error loc "symbol" obj) ) ) 26 27 27 28 28 ;;; … … 36 36 (%make-locale-dictionary (make-dict)) ) 37 37 38 (define (check-locale-dictionary loc obj) 39 (unless (locale-dictionary? obj) 40 (type-error loc "locale-dictionary" obj) ) ) 38 41 ;; 39 42 … … 41 44 (check-locale-dictionary 'set-locale-dictionary-category! rec) 42 45 (check-symbol 'set-locale-dictionary-category! key) 43 (if (not val) (dict-delete! (locale-dictionary-table rec) key) 44 (begin 45 (check-locale-components 'set-locale-dictionary-category! val) 46 (dict-set! (locale-dictionary-table rec) key val) ) ) ) 46 (let ((tbl (locale-dictionary-table rec))) 47 (if (not val) (dict-delete! tbl key) 48 (begin 49 (check-locale-components 'set-locale-dictionary-category! val) 50 (dict-set! tbl key val) ) ) ) ) 47 51 48 52 ;; A locale-component or #f … … 57 61 ;; 58 62 63 (define-parameter current-locale-dictionary (make-locale-dictionary) 64 (lambda (obj) 65 (cond ((locale-dictionary? obj) 66 obj) 67 (else 68 (warning 'current-locale-dictionary (make-type-error-message "locale-dictionary") obj) 69 (current-locale-dictionary) ) ) ) ) 70 71 ;; 72 59 73 (define (set-locale-category! what value) 60 74 (set-locale-dictionary-category! (current-locale-dictionary) what value) ) -
release/3/locale/trunk/locale-components.scm
r13852 r13860 20 20 locale-components? 21 21 locale-component-ref 22 locale-component-exists? 22 23 set-locale-component! 23 24 update-locale-components! … … 42 43 timezone-dst-rule-week) ) 43 44 44 (require-extension srfi-1 local -errors)45 (require-extension srfi-1 locale-errors) 45 46 46 47 ;;; -
release/3/locale/trunk/locale-errors.scm
r13852 r13860 1 ;;;; locale- components.scm2 ;;;; Kon Lovett, Ma y '061 ;;;; locale-errors.scm 2 ;;;; Kon Lovett, Mar '09 3 3 4 4 (declare … … 9 9 (no-bound-checks) 10 10 (export 11 make-type-error-message 11 12 type-error) ) 12 13 -
release/3/locale/trunk/locale-posix.scm
r13852 r13860 257 257 (string-split str ":")))) 258 258 (let ((lc (make-locale-components str src tag))) 259 ( set-locale-components! lc 'locales lst)259 (update-locale-components! lc 'locales lst) 260 260 lc ) ) ) ) 261 261 -
release/3/locale/trunk/locale.html
r13852 r13860 1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 2 <!-- Generated by eggdoc Revision: 1.20 --> 3 <html> 4 <head> 5 <title>Eggs Unlimited - locale</title><style type="text/css"> <!-- 6 CODE { 7 color: #666666; 8 } 9 /* DT.definition EM { font-weight: bold; font-style: normal; } */ 10 11 DT.definition { 12 background: #eee; 13 color: black; 14 padding: 0.2em 1em 0.2em 0.7em; 15 margin-left: 0.2em; 16 border: 1px solid #bbc; 17 font-family: "Andale Mono", monospace; 18 /* font-size: 1.2em; */ 19 20 } 21 DD { 22 margin-top: 0.8em; 23 margin-bottom: 0.8em; 24 } 25 DIV.subsection { 26 border-top: 1px solid #448; 27 padding-left: 1em; 28 margin-bottom: 1.2em; 29 } 30 DIV.subsubsection { 31 border-top: 1px dotted #99c; 32 /* border-left: 1px solid #99c; */ 33 padding-left: 1em; 34 margin-bottom: 1.2em; 35 } 36 DIV.subsubsubsection { 37 border-top: 1px solid #ddf; 38 padding-left: 1em; 39 margin-bottom: 1.2em; 40 } 41 42 DIV.section { 43 margin-bottom: 1.5em; 44 } 45 a:link { 46 color: #336; 47 } 48 a:visited { color: #666; } 49 a:active { color: #966; } 50 a:hover { color: #669; } 51 body { margin: 0; padding: 0; background: #fff; color: #000; font: 9pt "Lucida Grande", "Verdana", sans-serif; } 52 H2 { 53 background: #336; 54 color: #fff; 55 padding-top: 0.5em; 56 padding-bottom: 0.5em; 57 padding-left: 16px; 58 margin: 0 0 1em 0; 59 } 60 UL LI { 61 list-style: none; 62 } 63 TT { 64 font-family: "Andale Mono", monospace; 65 /* font-size: 1.2em; */ 66 } 67 H3 { 68 color: #113; 69 margin-bottom: 0.5em; 70 } 71 H4, H5, H6 { 72 color: #113; 73 margin-bottom: 1.0em; 74 } 75 H5 { 76 font-weight: normal; 77 font-style: italic; 78 font-size: 100%; 79 margin-top: 1.2em; 80 } 81 H6 { 82 font-weight: bold; 83 font-size: 85%; 84 margin-top: 1.2em; 85 } 86 DIV#eggheader { 87 text-align: center; 88 float: right; 89 margin-right: 2em; 90 } 91 DIV#header IMG { 92 /* display: block; margin-left: auto; margin-right: auto; */ 93 /* float: right; */ 94 border: none; /* firefox */ 95 } 96 DIV#footer { 97 background: #bbd; 98 padding: 0.7em ; 99 border-top: 1px solid #cce; 100 } 101 DIV#footer hr { 102 display: none; 103 } 104 DIV#footer a { 105 float: left; 106 } 107 DIV#revision-history { 108 float: right; 109 } 110 111 DIV#body { 112 margin: 1em 1em 1em 16px; 113 } 114 115 DIV#examples PRE { 116 background: #eef; 117 padding: 0.1em; 118 border: 1px solid #aac; 119 } 120 PRE#license, DIV#examples PRE { 121 padding: 0.5em; 122 } 123 DIV#examples PRE { 124 /* font-size: 85%; */ 125 } 126 PRE { font-family: "Andale Mono", monospace; } 127 TABLE { 128 background: #eef; 129 padding: 0.2em; 130 border: 1px solid #aac; 131 border-collapse: collapse; 132 width: 100%; 133 } 134 TABLE.symbol-table TD.symbol { 135 width: 15em; 136 font-family: "Andale Mono", monospace; 137 /* font-size: 1.2em; */ 138 } 139 TH { 140 text-align: left; 141 border-bottom: 1px solid #aac; 142 padding: 0.25em 0.5em 0.25em 0.5em; 143 } 144 TD { padding: 0.25em 0.5em 0.25em 0.5em; } 145 --></style></head> 146 <body> 147 <div id="header"> 148 <h2>locale</h2> 149 <div id="eggheader"><a href="index.html"> 150 <img src="egg.jpg" alt="[Picture of an egg]" /></a></div></div> 151 <div id="body"> 152 <div class="section"> 153 <h3>Description</h3> 154 <p>Provides locale operations.</p></div> 155 <div class="section"> 156 <h3>Author</h3><a href="mailto:klovett@pacbell.net">Kon Lovett</a></div> 157 <div class="section"> 158 <h3>Usage</h3><tt>(require-extension locale)</tt></div> 159 <div class="section"> 160 <h3>Download</h3><a href="locale.egg">locale.egg</a></div> 161 <div class="section"> 162 <h3>Requires</h3> 163 <ul> 164 <li><a href="miscmacros.html">miscmacros</a></li></ul></div> 165 <div class="section"> 166 <h3>Documentation</h3> 167 <p>locale is a set of routines supporting locale query operations. The environment locale information is determined upon module load and the corresponding parameters are set.</p> 168 <div class="subsection"> 169 <h4>Locale Components</h4> 170 <p>The major data structure is the <code>locale-components</code> type, portrayed as an extensible <tt>key+value</tt> pairing. The <tt>key</tt> is a <code>symbol</code>. The <tt>value</tt> is usually a <code>string</code>.</p> 171 <p>A <code>locale-components</code> object will have more properties but the following are provided for every instance:</p><table class="symbol-table">Common Component Keys 172 <tr> 173 <td class="symbol">tag</td> 174 <td>What kind.</td></tr> 175 <tr> 176 <td class="symbol">name</td> 177 <td>The composite information object, source specific.</td></tr> 178 <tr> 179 <td class="symbol">source</td> 180 <td>The origin for the information.</td></tr></table> 181 <p>The <code>source</code> property is one of the following (others are possible):</p><table class="symbol-table">Source Values 182 <tr> 183 <td class="symbol">POSIX</td> 184 <td>Information from POSIX environment. The "name" is a string.</td></tr> 185 <tr> 186 <td class="symbol">PLATFORM</td> 187 <td>Information from the system.</td></tr> 188 <tr> 189 <td class="symbol">BUILTIN</td> 190 <td>Information from system defaults.</td></tr></table> 191 <p>The <code>PLATFORM</code> source is used for information first. Then the <code>POSIX</code> source is attempted. When all have failed the <code>BUILTIN</code> source is used. The point being locale information will be available, but without an accuracy guarantee.</p> 192 <p>The <code>BUILTIN</code> source creates a POSIX-style string "name" constructed using constants and library procedures.</p></div> 193 <div class="subsection"> 194 <h4>Generic Locale Components Property Access</h4> 195 <dt class="definition"><strong>procedure:</strong> (locale-components? OBJECT)</dt> 196 <dd> 197 <p>Is the <tt>OBJECT</tt> a <code>locale-compenents</code> object?</p></dd> 198 <dt class="definition"><strong>procedure:</strong> (locale-component-ref LOCALE-COMPONENTS KEY [DEFAULT #f])</dt> 199 <dd> 200 <p>Returns the <tt>KEY</tt> property of <tt>LOCALE-COMPONENTS</tt> or the <tt>DEFAULT</tt> when not found.</p></dd> 201 <dt class="definition"><strong>procedure:</strong> (set-locale-component! LOCALE-COMPONENTS KEY VALUE)</dt> 202 <dd> 203 <p>Updates or creates the <tt>KEY</tt> property of <tt>LOCALE-COMPONENTS</tt> with the <tt>VALUE</tt>.</p></dd></div> 204 <div class="subsection"> 205 <h4>Timezone</h4> 206 <p>Access to timezone information. A timezone object is a <code>locale-components</code> object with properties for Standard Time Name and Offset, and an optional Summer or Daylight Saving Time Name and Offset. The offset is seconds west (positive) or east (negative) of UTC. The name is some locally accepted timezone name, such as "PST". A Daylight Saving Time start rule and end rule are optional properties.</p><table class="symbol-table">Timezone Component Properties 207 <tr> 208 <td class="symbol">std-name</td> 209 <td>The Standard timezone name.</td></tr> 210 <tr> 211 <td class="symbol">std-offset</td> 212 <td>Seconds +/- UTC.</td></tr> 213 <tr> 214 <td class="symbol">dst-name</td> 215 <td>The Daylight Saving Time timezone name.</td></tr> 216 <tr> 217 <td class="symbol">dst-offset</td> 218 <td>Seconds +/- UTC.</td></tr> 219 <tr> 220 <td class="symbol">dst-start</td> 221 <td>The start of Daylight Saving Time; a timezone-dst-rule.</td></tr> 222 <tr> 223 <td class="symbol">dst-end</td> 224 <td>The end of Daylight Saving Time; a timezone-dst-rule.</td></tr></table> 225 <dl> 226 <dt class="definition"><strong>parameter:</strong> (current-timezone [VALUE])</dt> 227 <dd> 228 <p>The currently defined timezone. The specified <tt>VALUE</tt> is either a timezone string value, or <code>#f</code>, indicating no timezone. When no timezone value is set the default timezone is UTC.</p></dd> 229 <dt class="definition"><strong>procedure:</strong> (current-timezone-components)</dt> 230 <dd> 231 <p>Returns the timezone-components object corresponding to the current-timezone.</p></dd> 232 <dt class="definition"><strong>procedure:</strong> (timezone-components? TIMEZONE-COMPONENTS)</dt> 233 <dd> 234 <p>Is the specified <tt>TIMEZONE-COMPONENTS</tt> object actually a timezone-components object?</p></dd> 235 <dt class="definition"><strong>procedure:</strong> (timezone-component-ref TIMEZONE-COMPONENTS KEY [DEFAULT #f])</dt> 236 <dd> 237 <p>Returns the timezone-component <tt>KEY</tt> of the <tt>TIMEZONE-COMPONENTS</tt> object, or the <tt>DEFAULT</tt> for a missing component.</p></dd> 238 <dt class="definition"><strong>procedure:</strong> (set-timezone-component! TIMEZONE-COMPONENTS KEY VALUE)</dt> 239 <dd> 240 <p>Sets the timezone-component <tt>KEY</tt> of the <tt>TIMEZONE-COMPONENTS</tt> object to <tt>VALUE</tt>.</p></dd> 241 <dt class="definition"><strong>procedure:</strong> (timezone-dst-rule-julian-noleap? TIMEZONE-DST-RULE)</dt> 242 <dd> 243 <p>Is the specified <tt>TIMEZONE-DST-RULE</tt> object actually a daylight saving time julian day without leap seconds object?</p></dd> 244 <dt class="definition"><strong>procedure:</strong> (timezone-dst-rule-julian-leap? TIMEZONE-DST-RULE)</dt> 245 <dd> 246 <p>Is the specified <tt>TIMEZONE-DST-RULE</tt> object actually a daylight saving time julian day assuming leap seconds object?</p></dd> 247 <dt class="definition"><strong>procedure:</strong> (timezone-dst-rule-mwd? TIMEZONE-DST-RULE)</dt> 248 <dd> 249 <p>Is the specified <tt>TIMEZONE-DST-RULE</tt> object actually a daylight saving time month+week+day object?</p></dd> 250 <dt class="definition"><strong>procedure:</strong> (timezone-dst-rule-offset TIMEZONE-DST-RULE)</dt> 251 <dd> 252 <p>Returns the seconds within day offset component of the specified <tt>TIMEZONE-DST-RULE</tt> object.</p></dd> 253 <dt class="definition"><strong>procedure:</strong> (timezone-dst-rule-julian TIMEZONE-DST-RULE)</dt> 254 <dd> 255 <p>Returns the julian day component of the specified <tt>TIMEZONE-DST-RULE</tt> object.</p></dd> 256 <dt class="definition"><strong>procedure:</strong> (timezone-dst-rule-month TIMEZONE-DST-RULE)</dt> 257 <dd> 258 <p>Returns the month of year component of the specified <tt>TIMEZONE-DST-RULE</tt> object.</p></dd> 259 <dt class="definition"><strong>procedure:</strong> (timezone-dst-rule-week TIMEZONE-DST-RULE)</dt> 260 <dd> 261 <p>Returns the week of month component of the specified <tt>TIMEZONE-DST-RULE</tt> object.</p></dd> 262 <dt class="definition"><strong>procedure:</strong> (timezone-dst-rule-day TIMEZONE-DST-RULE)</dt> 263 <dd> 264 <p>Returns the day of week component of the specified <tt>TIMEZONE-DST-RULE</tt> object.</p></dd> 265 <dt class="definition"><strong>procedure:</strong> (make-timezone-dst-rule-julian-leap JULIAN-DAY OFFSET)</dt> 266 <dd> 267 <p>Returns a daylight saving time julian day assuming leap seconds rule object.</p></dd> 268 <dt class="definition"><strong>procedure:</strong> (make-timezone-dst-rule-julian-noleap JULIAN-DAY OFFSET)</dt> 269 <dd> 270 <p>Returns a daylight saving time julian day without leap seconds rule object.</p></dd> 271 <dt class="definition"><strong>procedure:</strong> (make-timezone-dst-rule-mwd MONTH WEEK DAY OFFSET)</dt> 272 <dd> 273 <p>Returns a daylight saving time month.week.day rule object.</p></dd> 274 <dt class="definition"><strong>procedure:</strong> (posix-timezone-string->timezone-components STRING [SOURCE "POSIX"])</dt> 275 <dd> 276 <p>Parses a POSIX timezone string specification, <tt>STRING</tt>, and returns the corresponding timezone-components object, or <code>#f</code> when a parse error occurs. A <code>#f</code> or empty string value is mapped to the default timezone. The optional <tt>SOURCE</tt> indicates what locale system supplied the string.</p></dd> 277 <dt class="definition"><strong>procedure:</strong> (posix-load-timezone)</dt> 278 <dd> 279 <p>Initialize the current-timezone from the TZ environment variable.</p></dd></dl></div> 280 <div class="subsection"> 281 <h4>Locale</h4> 282 <p>Access to locale information. A locale object is composed of a Language, an optional Script, an optional Region, an optional Codeset, and an optional Modifier. The language should be an ISO 639-1 or ISO 639-2 name. The Script should be a RFC 3066bis name. The region should be an ISO 3166-1 name. The codeset and modifier forms are locale dependent.</p><table class="symbol-table">Locale Properties 283 <tr> 284 <td class="symbol">language</td> 285 <td>ISO 639-1 or ISO 639-2 name string. Default "en".</td></tr> 286 <tr> 287 <td class="symbol">script</td> 288 <td>RFC 3066bis name string.</td></tr> 289 <tr> 290 <td class="symbol">region</td> 291 <td>ISO 3166-1 name string. Default "US".</td></tr> 292 <tr> 293 <td class="symbol">codeset</td> 294 <td>The character code to character mapping system.</td></tr> 295 <tr> 296 <td class="symbol">modifier</td> 297 <td>Instance data, if any.</td></tr></table> 298 <dl> 299 <dt class="definition"><strong>parameter:</strong> (current-locale [VALUE])</dt> 300 <dd> 301 <p>The currently defined locale. The specified <tt>VALUE</tt> is either a locale string value, or <code>#f</code>, indicating locale independence. When no locale value is set the default locale is <code>#f</code>.</p></dd> 302 <dt class="definition"><strong>procedure:</strong> (current-locale-components)</dt> 303 <dd> 304 <p>Returns the locale-components object corresponding to the current-locale.</p></dd> 305 <dt class="definition"><strong>procedure:</strong> (locale-components? LOCALE-COMPONENTS)</dt> 306 <dd> 307 <p>Is the specified <tt>LOCALE-COMPONENTS</tt> object actually a locale-components object?</p></dd> 308 <dt class="definition"><strong>procedure:</strong> (locale-component-ref LOCALE-COMPONENTS KEY [DEFAULT #f])</dt> 309 <dd> 310 <p>Returns the locale-component <tt>KEY</tt> of the <tt>LOCALE-COMPONENTS</tt> object, or the <tt>DEFAULT</tt> for a missing component.</p></dd> 311 <dt class="definition"><strong>procedure:</strong> (set-locale-component! LOCALE-COMPONENTS KEY VALUE)</dt> 312 <dd> 313 <p>Sets the locale-component <tt>KEY</tt> of the <tt>LOCALE-COMPONENTS</tt> object to <tt>VALUE</tt>.</p></dd> 314 <dt class="definition"><strong>procedure:</strong> (posix-locale-string->locale-components STRING [SOURCE "POSIX"])</dt> 315 <dd> 316 <p>Parses a POSIX locale string specification, <tt>STRING</tt>, and returns the corresponding locale-components object, or <code>#f</code> when a parse error occurs. A <code>#f</code> or empty string value is mapped to the default locale. The optional <tt>SOURCE</tt> indicates what locale system supplied the string.</p></dd> 317 <dt class="definition"><strong>procedure:</strong> (posix-load-locale)</dt> 318 <dd> 319 <p>Sets up the locale using POSIX rules. Initializes the <code>current-locale</code> from the <tt>MESSAGES</tt>category.</p></dd></dl></div> 320 <div class="subsection"> 321 <h4>Locale Category</h4> 322 <p>Access to the locale information by category.</p><table class="symbol-table">Locale Category Keys 323 <tr> 324 <td class="symbol">ADDRESS</td> 325 <td></td></tr> 326 <tr> 327 <td class="symbol">COLLATE</td> 328 <td></td></tr> 329 <tr> 330 <td class="symbol">CTYPE</td> 331 <td></td></tr> 332 <tr> 333 <td class="symbol">IDENTIFICATION</td> 334 <td></td></tr> 335 <tr> 336 <td class="symbol">LANGUAGE</td> 337 <td></td></tr> 338 <tr> 339 <td class="symbol">MEASUREMENT</td> 340 <td></td></tr> 341 <tr> 342 <td class="symbol">MESSAGES</td> 343 <td></td></tr> 344 <tr> 345 <td class="symbol">MONETARY</td> 346 <td></td></tr> 347 <tr> 348 <td class="symbol">NAME</td> 349 <td></td></tr> 350 <tr> 351 <td class="symbol">NUMERIC</td> 352 <td></td></tr> 353 <tr> 354 <td class="symbol">PAPER</td> 355 <td></td></tr> 356 <tr> 357 <td class="symbol">TELEPHONE</td> 358 <td></td></tr> 359 <tr> 360 <td class="symbol">TIME</td> 361 <td></td></tr></table> 362 <dl> 363 <dt class="definition"><strong>procedure:</strong> (set-locale-category! CATEGORY LOCALE-COMPONENTS)</dt> 364 <dd> 365 <p>Sets the specified <tt>CATEGORY</tt> to the specified <tt>LOCALE-COMPONENTS</tt> object.</p></dd> 366 <dt class="definition"><strong>procedure:</strong> (locale-category-ref CATEGORY)</dt> 367 <dd> 368 <p>Returns the specified <tt>CATEGORY</tt> locale-components object, or <code>#f</code> if the category is not valued.</p></dd></dl></div></div> 369 <div class="section"> 370 <h3>Issues</h3> 371 <p>NOTE: This is a work in progress. Currently only the Posix locale information is supported. Plans are to support the native MacOS X and Windows locale APIs. Changes to this API are almost certain.</p></div> 372 <div class="section"> 373 <h3>Version</h3> 374 <ul> 375 <li>0.4.0 Added "default" timezone & locale</li> 376 <li>0.3.3 Removed use of 'critical-section'</li> 377 <li>0.3.2 Dropped :optional</li> 378 <li>0.3.1 Bug fix for default dst offset</li> 379 <li>0.3 Reverts to defaults for timezone & locale when parse errors</li> 380 <li>0.2 Exports</li> 381 <li>0.1 Initial release</li></ul></div> 382 <div class="section"> 383 <h3>License</h3> 384 <pre>Copyright (c) 2005, Kon Lovett. All rights reserved. 385 386 Permission is hereby granted, free of charge, to any person obtaining a 387 copy of this software and associated documentation files (the Software), 388 to deal in the Software without restriction, including without limitation 389 the rights to use, copy, modify, merge, publish, distribute, sublicense, 390 and/or sell copies of the Software, and to permit persons to whom the 391 Software is furnished to do so, subject to the following conditions: 392 393 The above copyright notice and this permission notice shall be included 394 in all copies or substantial portions of the Software. 395 396 THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 397 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 398 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 399 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 400 OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 401 ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 402 OTHER DEALINGS IN THE SOFTWARE.</pre></div></div> 403 <div id="footer"> 404 <hr /><a href="index.html">< Egg index</a> 405 <div id="revision-history">$Revision$ $Date$</div> </div></body></html> -
release/3/locale/trunk/locale.meta
r13852 r13860 8 8 (license "BSD") 9 9 (needs miscmacros lookup-table) 10 (doc-from-wiki) 10 11 (files 11 12 "tests" 12 13 "setup-header.scm" 13 14 "locale.scm" 14 "locale-parameters.scm"15 15 "locale-categories.scm" 16 16 "locale-components.scm" 17 17 "locale-posix.scm" 18 18 "locale-errors.scm" 19 "locale.html"20 19 "locale.setup")) -
release/3/locale/trunk/locale.scm
r13852 r13860 13 13 (export 14 14 UNKNOWN-LOCAL-TZ-NAME 15 BUILTIN-SOURCE) ) 15 BUILTIN-SOURCE 16 current-timezone 17 current-locale 18 current-timezone-components 19 current-locale-components) ) 16 20 17 (require-extension posix locale-posix locale-components locale-parameters) 21 (require-extension posix miscmacros locale-posix locale-components locale-categories locale-errors) 22 23 ;;; 24 25 (define (check-string-or-false loc obj) 26 (unless (or (not obj) (string? obj)) 27 (type-error loc "string or #f" obj) ) ) 28 29 ;; 30 31 (define (current-timezone . args) 32 (cond ((null? args) 33 (and-let* ((lc (locale-category-ref 'timezone))) 34 (locale-component-ref lc 'name) ) ) 35 (else 36 (let-optionals args ((str #f) (src "USER")) 37 (check-string-or-false 'current-timezone str) 38 (let ((lc (and str (posix-timezone-string->locale-components str src)))) 39 (set-locale-category! 'timezone lc) ) ) ) ) ) 40 41 ;; A'la MzScheme 42 ;; Treat locale as messages category 43 44 (define (current-locale . args) 45 (cond ((null? args) 46 (and-let* ((lc (locale-category-ref 'messages))) 47 (locale-component-ref lc 'name) ) ) 48 (else 49 (let-optionals args ((str #f) (src "USER")) 50 (check-string-or-false 'current-locale str) 51 (let ((lc (and str (posix-locale-string->locale-components str src)))) 52 (set-locale-category! 'messages lc) ) ) ) ) ) 53 54 ;; 55 56 (define (current-timezone-components) (locale-category-ref 'timezone)) 57 58 (define (current-locale-components) (locale-category-ref 'messages)) 18 59 19 60 ;;; When no environment info use Plan B … … 68 109 (and-let* ((msglc (locale-category-ref 'messages))) 69 110 (let ((lc (make-locale-components (locale-component-ref msglc 'name) BUILTIN-SOURCE 'language))) 70 ( set-locale-components! lc 'locales (list msglc))111 (update-locale-components! lc 'locales (list msglc)) 71 112 (set-locale-category! 'language lc) ) ) ) 72 113 -
release/3/locale/trunk/locale.setup
r8924 r13860 1 1 (include "setup-header") 2 2 3 (required-extension-version ' miscmacros "2.4")3 (required-extension-version 'lookup-table "1.7.0" 'miscmacros "2.4") 4 4 5 (compile-dynld "locale-parameters") 5 (compile-dynld "locale-errors") 6 (compile-dynld "locale-components") 6 7 (compile-dynld "locale-categories") 7 (compile-dynld "locale-components")8 8 (compile-dynld "locale-posix") 9 9 (compile-dynld "locale") 10 10 11 11 (install-extension 'locale 12 `(,(make-docu-filename 'locale) 13 ,(make-dynld-filename 'locale) 14 ,(make-dynld-filename 'locale-parameters) 12 `(,(make-dynld-filename 'locale) 13 ,(make-dynld-filename 'locale-errors) 15 14 ,(make-dynld-filename 'locale-categories) 16 15 ,(make-dynld-filename 'locale-components) … … 20 19 (exports 21 20 ,(make-exports-filename 'locale) 22 ,(make-exports-filename 'locale- parameters)21 ,(make-exports-filename 'locale-errors) 23 22 ,(make-exports-filename 'locale-categories) 24 23 ,(make-exports-filename 'locale-components)
Note: See TracChangeset
for help on using the changeset viewer.