1 | ;;;; srfi-29-eggdoc.scm |
---|
2 | |
---|
3 | (use eggdoc) |
---|
4 | |
---|
5 | (define license |
---|
6 | #<<EOS |
---|
7 | "Copyright (c) 2005-2008, Kon Lovett. All rights reserved. |
---|
8 | |
---|
9 | Permission is hereby granted, free of charge, to any person obtaining a |
---|
10 | copy of this software and associated documentation files (the Software), |
---|
11 | to deal in the Software without restriction, including without limitation |
---|
12 | the rights to use, copy, modify, merge, publish, distribute, sublicense, |
---|
13 | and/or sell copies of the Software, and to permit persons to whom the |
---|
14 | Software is furnished to do so, subject to the following conditions: |
---|
15 | |
---|
16 | The above copyright notice and this permission notice shall be included |
---|
17 | in all copies or substantial portions of the Software. |
---|
18 | |
---|
19 | THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
---|
20 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
---|
21 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL |
---|
22 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR |
---|
23 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
---|
24 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
---|
25 | OTHER DEALINGS IN THE SOFTWARE. |
---|
26 | EOS |
---|
27 | ) |
---|
28 | |
---|
29 | #; |
---|
30 | (define examples |
---|
31 | '((pre #<<EOS |
---|
32 | EOS |
---|
33 | ))) |
---|
34 | |
---|
35 | (define doc `( |
---|
36 | (eggdoc:begin |
---|
37 | (name "srfi-29") |
---|
38 | (description (p "Localization")) |
---|
39 | (author |
---|
40 | (url "mailto:klovett@pacbell.net" "Kon Lovett")) |
---|
41 | |
---|
42 | (requires |
---|
43 | lookup-table |
---|
44 | miscmacros |
---|
45 | locale ) |
---|
46 | |
---|
47 | (usage) |
---|
48 | (download "srfi-29.egg") |
---|
49 | |
---|
50 | (documentation |
---|
51 | |
---|
52 | (p "A Chicken implementation of " |
---|
53 | (url "http://srfi.schemers.org/srfi-29/srfi-29.html" "SRFI 29") ".") |
---|
54 | |
---|
55 | (p "Bundles are assumed stored in the system bundle directory, " |
---|
56 | (code "(repository-path) \"srfi-29-bundles\"") ".") |
---|
57 | |
---|
58 | (p "Within a bundle directory the structure is " |
---|
59 | (code "[LANGUAGE [COUNTRY [SCRIPT [CODESET [MODIFIER]]]]] PACKAGE-NAME") ".") |
---|
60 | |
---|
61 | (p "The default language is " (code "en") ". The default country is " (code "us") ". " |
---|
62 | "The locale package will override these if a locale is set. Otherwise " |
---|
63 | "the user must set the corresponding parameters.") |
---|
64 | |
---|
65 | (p "Any object which can be returned by " (code "(read)") " and tested for equality " |
---|
66 | "with " (code "equal?") " is acceptable as a " (tt "TEMPLATE-NAME") ". " |
---|
67 | "So strings are a valid " (tt "TEMPLATE-NAME") ". Further, " |
---|
68 | (code "(localized-template ...)") " will return any object which can be returned by " |
---|
69 | (code "(read)") ", not just a string.") |
---|
70 | |
---|
71 | (p "Aborts with the composite condition " (code "(exn srfi-29)") " and properties " |
---|
72 | (code "location") ", " (code "message") ", and " (code "arguments") " for errors.") |
---|
73 | |
---|
74 | (subsection "Parameters" |
---|
75 | |
---|
76 | (parameter "(current-language [LANGUAGE])" |
---|
77 | (p "Gets or sets the " (tt "LANGUAGE") ".") ) |
---|
78 | |
---|
79 | (parameter "(current-country [COUNTRY])" |
---|
80 | (p "Gets or sets the " (tt "COUNTRY") ".") ) |
---|
81 | |
---|
82 | (parameter "(current-locale-details [LOCALE-DETAILS])" |
---|
83 | (p "Gets or sets the " (tt "LOCALE-DETAILS") ".") ) |
---|
84 | |
---|
85 | (parameter "(current-locale-format-function [FORMAT-PROCEDURE])" |
---|
86 | (p "Gets or sets the " (tt "FORMAT-PROCEDURE") ".") ) |
---|
87 | ) |
---|
88 | |
---|
89 | (subsection "Procedures" |
---|
90 | |
---|
91 | (procedure "(reset-locale-parameters)" |
---|
92 | (p "If you change the " (code "current-locale") " " |
---|
93 | "(see the " (url "eggs/locale.html" "locale") " egg), " |
---|
94 | "you don't have to set all the " (code "current-foo") " " |
---|
95 | "parameters. You can simply call this " |
---|
96 | "procedure, and it will update those parameters to the values " |
---|
97 | "in the new locale. (Reset as in set anew.)") ) |
---|
98 | |
---|
99 | (procedure "(most-specific-bundle-specifier PACKAGE-NAME)" |
---|
100 | (p "Returns the most specific bundle specifier for the " |
---|
101 | "current language, country, and locale details.") ) |
---|
102 | |
---|
103 | (procedure "(declare-bundle! BUNDLE-SPECIFIER BUNDLE-ALIST)" |
---|
104 | (p "Creates a bundle.") ) |
---|
105 | |
---|
106 | (procedure "(undeclare-bundle! BUNDLE-SPECIFIER)" |
---|
107 | (p "Removes the bundle specified by " (tt "BUNDLE-SPECIFIER") " " |
---|
108 | "from the active bundles.") ) |
---|
109 | |
---|
110 | (procedure "(store-bundle! BUNDLE-SPECIFIER [ALTERNATE-DIRECTORY])" |
---|
111 | (p "Writes the bundle.") |
---|
112 | |
---|
113 | (p "Uses the " (tt "ALTERNATE-DIRECTORY") " if specified.") ) |
---|
114 | |
---|
115 | (procedure "(load-bundle! BUNDLE-SPECIFIER [ALTERNATE-DIRECTORY])" |
---|
116 | (p "Reads the bundle.") |
---|
117 | |
---|
118 | (p "Uses the " (tt "ALTERNATE-DIRECTORY") " if specified.") ) |
---|
119 | |
---|
120 | (procedure "(load-best-available-bundle! BUNDLE-SPECIFIER [ALTERNATE-DIRECTORY])" |
---|
121 | (p "Attempts " (code "(load-bundle! BUNDLE-SPECIFIER [ALTERNATE-DIRECTORY])") ", " |
---|
122 | "from most to least specific.") ) |
---|
123 | |
---|
124 | (procedure "(remove-bundle! BUNDLE-SPECIFIER [ALTERNATE-DIRECTORY])" |
---|
125 | (p "Removes the bundle specified by " (tt "BUNDLE-SPECIFIER") " " |
---|
126 | "from the active bundles, and from the filesystem. The bundle " |
---|
127 | "directory is " (tt "ALTERNATE-DIRECTORY") ", unless missing. " |
---|
128 | "Then the system bundle directory is used.") |
---|
129 | |
---|
130 | (p "Will not remove the locale directory hierarchy created by " |
---|
131 | (code "(store-bundle! ...)") ".") ) |
---|
132 | |
---|
133 | (procedure "(remove-bundle-directory! BUNDLE-SPECIFIER [ALTERNATE-DIRECTORY])" |
---|
134 | (p "Removes the bundle directory hierarchy created by " (code "(store-bundle! ...)") ". " |
---|
135 | "Will only remove empty directories. Returns " (code "#t") " if operation " |
---|
136 | "succeeded, " (code "#f") " when a non-empty directory encountered.") |
---|
137 | |
---|
138 | (p "Does not remove the bundle, if any, from the active bundles. " |
---|
139 | "A filesystem only operation.") |
---|
140 | |
---|
141 | (p "This procedure should be used with caution.") ) |
---|
142 | |
---|
143 | (procedure "(localized-template PACKAGE-NAME TEMPLATE-NAME [NOT-FOUND #f])" |
---|
144 | (p "Returns the object for the " (tt "TEMPLATE-NAME") " in " (tt "PACKAGE-NAME") ", " |
---|
145 | "when found, otherwise the " (tt "NOT-FOUND") ".") ) |
---|
146 | |
---|
147 | (procedure "(localized-template-set! PACKAGE-NAME TEMPLATE-NAME VALUE)" |
---|
148 | (p "Creates or updates the " (tt "VALUE") " for the " (tt "TEMPLATE-NAME") " " |
---|
149 | "in " (tt "PACKAGE-NAME") " and returns " (code "#t") ", when the package exists. " |
---|
150 | "Otherwise returns " (code "#f") ".") |
---|
151 | |
---|
152 | (p "This can be used to extend the meaning of a package template at " |
---|
153 | "runtime. For example: caching the actual closure for a named procedure.") ) |
---|
154 | |
---|
155 | (procedure "(localized-template/default PACKAGE-NAME TEMPLATE-NAME [NOT-FOUND TEMPLATE-NAME])" |
---|
156 | (p "Returns " (code "(localized-template PACKAGE-NAME TEMPLATE-NAME NOT-FOUND)") ".") |
---|
157 | |
---|
158 | (p "Somewhat like the Posix 'gettext' routine.") ) |
---|
159 | |
---|
160 | (procedure "(localized-format PACKAGE-NAME TEMPLATE-NAME PORT ARG0 ...)" |
---|
161 | (p "Formats the arguments " (tt "ARG0 ...") " to the " (tt "PORT") " " |
---|
162 | "using the " (code "(current-locale-format-function)") " and the " |
---|
163 | "format string " (code "(localized-template PACKAGE-NAME TEMPLATE-NAME)") ".") |
---|
164 | |
---|
165 | (p "When a localized-template is not found and the " (tt "TEMPLATE-NAME") " " |
---|
166 | "is a string then it is used a the format-string.") |
---|
167 | |
---|
168 | (p "A representation is always displayed, even when no template is found. " |
---|
169 | "Just not a localized one.") ) |
---|
170 | ) |
---|
171 | ) |
---|
172 | |
---|
173 | (section "Issues" |
---|
174 | |
---|
175 | (p "Possible race condition creating a bundle file or directory.") |
---|
176 | |
---|
177 | (p "The locale symbols must have a lowercase printname! As such " |
---|
178 | "they do not truly reflect ISO 639-1/2 & ISO 3166-1 standard " |
---|
179 | "names. This is a SRFI 29 restriction.") |
---|
180 | |
---|
181 | (p (code "(current-locale-details)") " is ill-defined by SRFI 29. " |
---|
182 | "Which symbol means what? This implementation defines locale details as a " |
---|
183 | "3 element list " (code "(SCRIPT CODESET MODIFIER)") " where the " |
---|
184 | "elements are symbols or " (code "#f") ".") |
---|
185 | ) |
---|
186 | |
---|
187 | #; |
---|
188 | (examples ,examples) |
---|
189 | |
---|
190 | (history |
---|
191 | (version "1.12.0" "Needed Unit files. Procedure 'localized-format' did not follow specification.") |
---|
192 | (version "1.9.0" "Version increased to force egg update [by Ivan Raikov].") |
---|
193 | (version "1.8.0" "Added 'localized-template-set!'.") |
---|
194 | (version "1.7.0" "Cached template lookup. 'localized-template' takes default parameter. Added 'localized-format', 'current-locale-format-function'.") |
---|
195 | (version "1.6.0" "Support for missing locale component stated as " (code "#f") ".") |
---|
196 | (version "1.501" "Dropped :optional") |
---|
197 | (version "1.5" "Fixed nasty locale-details handling bug") |
---|
198 | (version "1.4" "Added more extensions") |
---|
199 | (version "1.3" "Exports") |
---|
200 | (version "1.2" "Faster lookup") |
---|
201 | (version "1.1" "Added deletion procedures") |
---|
202 | (version "1.0" "Initial release")) |
---|
203 | |
---|
204 | (section "License" (pre ,license)) |
---|
205 | ) |
---|
206 | ) ) |
---|
207 | |
---|
208 | (eggdoc->html doc) |
---|