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 - srfi-29</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>srfi-29</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>Localization</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>Requires</h3> |
---|
159 | <ul> |
---|
160 | <li>lookup-table</li> |
---|
161 | <li>miscmacros</li> |
---|
162 | <li>locale</li></ul></div> |
---|
163 | <div class="section"> |
---|
164 | <h3>Usage</h3><tt>(require-extension srfi-29)</tt></div> |
---|
165 | <div class="section"> |
---|
166 | <h3>Download</h3><a href="srfi-29.egg">srfi-29.egg</a></div> |
---|
167 | <div class="section"> |
---|
168 | <h3>Documentation</h3> |
---|
169 | <p>A Chicken implementation of <a href="http://srfi.schemers.org/srfi-29/srfi-29.html">SRFI 29</a>.</p> |
---|
170 | <p>Bundles are assumed stored in the system bundle directory, <code>(repository-path) "srfi-29-bundles"</code>.</p> |
---|
171 | <p>Within a bundle directory the structure is <code>[LANGUAGE [COUNTRY [SCRIPT [CODESET [MODIFIER]]]]] PACKAGE-NAME</code>.</p> |
---|
172 | <p>The default language is <code>en</code>. The default country is <code>us</code>. The locale package will override these if a locale is set. Otherwise the user must set the corresponding parameters.</p> |
---|
173 | <p>Any object which can be returned by <code>(read)</code> and tested for equality with <code>equal?</code> is acceptable as a <tt>TEMPLATE-NAME</tt>. So strings are a valid <tt>TEMPLATE-NAME</tt>. Further, <code>(localized-template ...)</code> will return any object which can be returned by <code>(read)</code>, not just a string.</p> |
---|
174 | <p>Aborts with the composite condition <code>(exn srfi-29)</code> and properties <code>location</code>, <code>message</code>, and <code>arguments</code> for errors.</p> |
---|
175 | <div class="subsection"> |
---|
176 | <h4>Parameters</h4> |
---|
177 | <dt class="definition"><strong>parameter:</strong> (current-language [LANGUAGE])</dt> |
---|
178 | <dd> |
---|
179 | <p>Gets or sets the <tt>LANGUAGE</tt>.</p></dd> |
---|
180 | <dt class="definition"><strong>parameter:</strong> (current-country [COUNTRY])</dt> |
---|
181 | <dd> |
---|
182 | <p>Gets or sets the <tt>COUNTRY</tt>.</p></dd> |
---|
183 | <dt class="definition"><strong>parameter:</strong> (current-locale-details [LOCALE-DETAILS])</dt> |
---|
184 | <dd> |
---|
185 | <p>Gets or sets the <tt>LOCALE-DETAILS</tt>.</p></dd> |
---|
186 | <dt class="definition"><strong>parameter:</strong> (current-locale-format-function [FORMAT-PROCEDURE])</dt> |
---|
187 | <dd> |
---|
188 | <p>Gets or sets the <tt>FORMAT-PROCEDURE</tt>.</p></dd></div> |
---|
189 | <div class="subsection"> |
---|
190 | <h4>Procedures</h4> |
---|
191 | <dt class="definition"><strong>procedure:</strong> (reset-locale-parameters)</dt> |
---|
192 | <dd> |
---|
193 | <p>If you change the <code>current-locale</code> (see the <a href="eggs/locale.html">locale</a> egg), you don't have to set all the <code>current-foo</code> parameters. You can simply call this procedure, and it will update those parameters to the values in the new locale. (Reset as in set anew.)</p></dd> |
---|
194 | <dt class="definition"><strong>procedure:</strong> (most-specific-bundle-specifier PACKAGE-NAME)</dt> |
---|
195 | <dd> |
---|
196 | <p>Returns the most specific bundle specifier for the current language, country, and locale details.</p></dd> |
---|
197 | <dt class="definition"><strong>procedure:</strong> (declare-bundle! BUNDLE-SPECIFIER BUNDLE-ALIST)</dt> |
---|
198 | <dd> |
---|
199 | <p>Creates a bundle.</p></dd> |
---|
200 | <dt class="definition"><strong>procedure:</strong> (undeclare-bundle! BUNDLE-SPECIFIER)</dt> |
---|
201 | <dd> |
---|
202 | <p>Removes the bundle specified by <tt>BUNDLE-SPECIFIER</tt> from the active bundles.</p></dd> |
---|
203 | <dt class="definition"><strong>procedure:</strong> (store-bundle! BUNDLE-SPECIFIER [ALTERNATE-DIRECTORY])</dt> |
---|
204 | <dd> |
---|
205 | <p>Writes the bundle.</p> |
---|
206 | <p>Uses the <tt>ALTERNATE-DIRECTORY</tt> if specified.</p></dd> |
---|
207 | <dt class="definition"><strong>procedure:</strong> (load-bundle! BUNDLE-SPECIFIER [ALTERNATE-DIRECTORY])</dt> |
---|
208 | <dd> |
---|
209 | <p>Reads the bundle.</p> |
---|
210 | <p>Uses the <tt>ALTERNATE-DIRECTORY</tt> if specified.</p></dd> |
---|
211 | <dt class="definition"><strong>procedure:</strong> (load-best-available-bundle! BUNDLE-SPECIFIER [ALTERNATE-DIRECTORY])</dt> |
---|
212 | <dd> |
---|
213 | <p>Attempts <code>(load-bundle! BUNDLE-SPECIFIER [ALTERNATE-DIRECTORY])</code>, from most to least specific.</p></dd> |
---|
214 | <dt class="definition"><strong>procedure:</strong> (remove-bundle! BUNDLE-SPECIFIER [ALTERNATE-DIRECTORY])</dt> |
---|
215 | <dd> |
---|
216 | <p>Removes the bundle specified by <tt>BUNDLE-SPECIFIER</tt> from the active bundles, and from the filesystem. The bundle directory is <tt>ALTERNATE-DIRECTORY</tt>, unless missing. Then the system bundle directory is used.</p> |
---|
217 | <p>Will not remove the locale directory hierarchy created by <code>(store-bundle! ...)</code>.</p></dd> |
---|
218 | <dt class="definition"><strong>procedure:</strong> (remove-bundle-directory! BUNDLE-SPECIFIER [ALTERNATE-DIRECTORY])</dt> |
---|
219 | <dd> |
---|
220 | <p>Removes the bundle directory hierarchy created by <code>(store-bundle! ...)</code>. Will only remove empty directories. Returns <code>#t</code> if operation succeeded, <code>#f</code> when a non-empty directory encountered.</p> |
---|
221 | <p>Does not remove the bundle, if any, from the active bundles. A filesystem only operation.</p> |
---|
222 | <p>This procedure should be used with caution.</p></dd> |
---|
223 | <dt class="definition"><strong>procedure:</strong> (localized-template PACKAGE-NAME TEMPLATE-NAME [NOT-FOUND #f])</dt> |
---|
224 | <dd> |
---|
225 | <p>Returns the object for the <tt>TEMPLATE-NAME</tt> in <tt>PACKAGE-NAME</tt>, when found, otherwise the <tt>NOT-FOUND</tt>.</p></dd> |
---|
226 | <dt class="definition"><strong>procedure:</strong> (localized-template-set! PACKAGE-NAME TEMPLATE-NAME VALUE)</dt> |
---|
227 | <dd> |
---|
228 | <p>Creates or updates the <tt>VALUE</tt> for the <tt>TEMPLATE-NAME</tt> in <tt>PACKAGE-NAME</tt> and returns <code>#t</code>, when the package exists. Otherwise returns <code>#f</code>.</p> |
---|
229 | <p>This can be used to extend the meaning of a package template at runtime. For example: caching the actual closure for a named procedure.</p></dd> |
---|
230 | <dt class="definition"><strong>procedure:</strong> (localized-template/default PACKAGE-NAME TEMPLATE-NAME [NOT-FOUND TEMPLATE-NAME])</dt> |
---|
231 | <dd> |
---|
232 | <p>Returns <code>(localized-template PACKAGE-NAME TEMPLATE-NAME NOT-FOUND)</code>.</p> |
---|
233 | <p>Somewhat like the Posix 'gettext' routine.</p></dd> |
---|
234 | <dt class="definition"><strong>procedure:</strong> (localized-format PACKAGE-NAME TEMPLATE-NAME PORT ARG0 ...)</dt> |
---|
235 | <dd> |
---|
236 | <p>Formats the arguments <tt>ARG0 ...</tt> to the <tt>PORT</tt> using the <code>(current-locale-format-function)</code> and the format string <code>(localized-template PACKAGE-NAME TEMPLATE-NAME)</code>.</p> |
---|
237 | <p>When a localized-template is not found and the <tt>TEMPLATE-NAME</tt> is a string then it is used a the format-string.</p> |
---|
238 | <p>A representation is always displayed, even when no template is found. Just not a localized one.</p></dd></div></div> |
---|
239 | <div class="section"> |
---|
240 | <h3>Issues</h3> |
---|
241 | <p>Possible race condition creating a bundle file or directory.</p> |
---|
242 | <p>The locale symbols must have a lowercase printname! As such they do not truly reflect ISO 639-1/2 & ISO 3166-1 standard names. This is a SRFI 29 restriction.</p> |
---|
243 | <p><code>(current-locale-details)</code> is ill-defined by SRFI 29. Which symbol means what? This implementation defines locale details as a 3 element list <code>(SCRIPT CODESET MODIFIER)</code> where the elements are symbols or <code>#f</code>.</p></div> |
---|
244 | <div class="section"> |
---|
245 | <h3>Version</h3> |
---|
246 | <ul> |
---|
247 | <li>1.13.0 Needs new Egg lookup-table.</li> |
---|
248 | <li>1.12.0 Needed Unit files. Procedure 'localized-format' did not follow specification.</li> |
---|
249 | <li>1.9.0 Version increased to force egg update [by Ivan Raikov].</li> |
---|
250 | <li>1.8.0 Added 'localized-template-set!'.</li> |
---|
251 | <li>1.7.0 Cached template lookup. 'localized-template' takes default parameter. Added 'localized-format', 'current-locale-format-function'.</li> |
---|
252 | <li>1.6.0 Support for missing locale component stated as <code>#f</code>.</li> |
---|
253 | <li>1.501 Dropped :optional</li> |
---|
254 | <li>1.5 Fixed nasty locale-details handling bug</li> |
---|
255 | <li>1.4 Added more extensions</li> |
---|
256 | <li>1.3 Exports</li> |
---|
257 | <li>1.2 Faster lookup</li> |
---|
258 | <li>1.1 Added deletion procedures</li> |
---|
259 | <li>1.0 Initial release</li></ul></div> |
---|
260 | <div class="section"> |
---|
261 | <h3>License</h3> |
---|
262 | <pre>"Copyright (c) 2005-2008, Kon Lovett. All rights reserved. |
---|
263 | |
---|
264 | Permission is hereby granted, free of charge, to any person obtaining a |
---|
265 | copy of this software and associated documentation files (the Software), |
---|
266 | to deal in the Software without restriction, including without limitation |
---|
267 | the rights to use, copy, modify, merge, publish, distribute, sublicense, |
---|
268 | and/or sell copies of the Software, and to permit persons to whom the |
---|
269 | Software is furnished to do so, subject to the following conditions: |
---|
270 | |
---|
271 | The above copyright notice and this permission notice shall be included |
---|
272 | in all copies or substantial portions of the Software. |
---|
273 | |
---|
274 | THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
275 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
276 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
---|
277 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
---|
278 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
---|
279 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
---|
280 | OTHER DEALINGS IN THE SOFTWARE.</pre></div></div> |
---|
281 | <div id="footer"> |
---|
282 | <hr /><a href="index.html">< Egg index</a> |
---|
283 | <div id="revision-history">$Revision$ $Date$</div> </div></body></html> |
---|