Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
== Outdated egg! This is an egg for CHICKEN 3, the unsupported old release. You're almost certainly looking for [[/eggref/4/srfi-29|the CHICKEN 4 version of this egg]], if it exists. If it does not exist, there may be equivalent functionality provided by another egg; have a look at the [[https://wiki.call-cc.org/chicken-projects/egg-index-4.html|egg index]]. Otherwise, please consider porting this egg to the current version of CHICKEN. [[tags: egg]] == srfi-29 Localization [[toc:]] == Documentation A Chicken implementation of [[http://srfi.schemers.org/srfi-29/srfi-29.html|SRFI 29]]. Bundles are assumed stored in the system bundle directory, {{(repository-path) "srfi-29-bundles"}}. Within a bundle directory the structure is ({{[LANGUAGE [COUNTRY [SCRIPT [CODESET [MODIFIER]]]]] PACKAGE-NAME}}. Any object which can be returned by {{(read)}} and tested for equality with {{equal?}} is acceptable as a {{TEMPLATE-NAME}}. So strings are a valid {{TEMPLATE-NAME}}. Further, {{(localized-template...)}} will return any object which can be returned by {{(read)}}, not just a string. === Parameters ==== current-language <parameter>(current-language [LANGUAGE])</parameter> Gets or sets the {{LANGUAGE}} symbol. ==== current-country <parameter>(current-country [COUNTRY])</parameter> Gets or sets the {{COUNTRY}} symbol. ==== current-locale-details <parameter>(current-locale-details [LOCALE-DETAILS])</parameter> Gets or sets the {{LOCALE-DETAILS}} list. ==== current-locale-format-function <parameter>(current-locale-format-function [FORMAT-PROCEDURE]) Gets or sets the {{FORMAT-PROCEDURE}}. This procedure must have the signature {{(port | string | boolean string [object]...)}}. ==== reset-locale-parameter <procedure>(reset-locale-parameters)</procedure> When the {{current-locale}} is changed, (see the [[eggs/locale.html|locale egg]]), the {{current-*}} parameters need not be set individually. This will update those parameters to the values in the new locale. (Reset as in set anew.) === Procedures ==== most-specific-bundle-specifier <procedure>(most-specific-bundle-specifier PACKAGE-NAME)</procedure> Returns the most specific bundle specifier for the current language, country, and locale details. ==== declare-bundle! <procedure>(declare-bundle! BUNDLE-SPECIFIER BUNDLE-ALIST)</procedure> Creates a bundle. ==== undeclare-bundle! <procedure>(undeclare-bundle! BUNDLE-SPECIFIER)</procedure> Removes the bundle specified by {{BUNDLE-SPECIFIER}} from the active bundles. ==== store-bundle! <procedure>(store-bundle! BUNDLE-SPECIFIER [ALTERNATE-DIRECTORY])</procedure> Writes the bundle. Uses the {{ALTERNATE-DIRECTORY}} if specified. ==== load-bundle! <procedure>(load-bundle! BUNDLE-SPECIFIER [ALTERNATE-DIRECTORY])</procedure> Reads the bundle. Uses the {{ALTERNATE-DIRECTORY}} if specified. ==== load-best-available-bundle! <procedure>(load-best-available-bundle! BUNDLE-SPECIFIER [ALTERNATE-DIRECTORY])</procedure> Attempts {{(load-bundle! BUNDLE-SPECIFIER [ALTERNATE-DIRECTORY])}}, from most to least specific. ==== remove-bundle! <procedure>(remove-bundle! BUNDLE-SPECIFIER [ALTERNATE-DIRECTORY])</procedure> Removes the bundle specified by {{BUNDLE-SPECIFIER}} from the active bundles, and from the filesystem. The bundle directory is {{ALTERNATE-DIRECTORY}}, unless missing. Then the system bundle directory is used. Will not remove the locale directory hierarchy created by {{(store-bundle!...)}}. ==== remove-bundle-directory! <procedure>(remove-bundle-directory! BUNDLE-SPECIFIER [ALTERNATE-DIRECTORY])</procedure> Removes the bundle directory hierarchy created by {{(store-bundle!...)}}. Will only remove empty directories. Returns {{#t}} if operation succeeded, {{#f}} when a non-empty directory encountered. Does not remove the bundle, if any, from the active bundles. A filesystem only operation. This procedure should be used with caution. ==== localized-template <procedure>(localized-template PACKAGE-NAME TEMPLATE-NAME [NOT-FOUND #f])</procedure> Returns the object for the {{TEMPLATE-NAME}} in {{PACKAGE-NAME}}, when found, otherwise the {{NOT-FOUND}} value. ==== localized-template-set! <procedure>(localized-template-set! PACKAGE-NAME TEMPLATE-NAME VALUE)</procedure> Creates or updates the {{VALUE}} for the {{TEMPLATE-NAME}} in {{PACKAGE-NAME}} and returns {{#t}}, when the package exists. Otherwise returns {{#f}}. This can be used to extend the meaning of a package template at runtime. For example: caching the actual closure for a named procedure. ==== localized-template/default <procedure>(localized-template/default PACKAGE-NAME TEMPLATE-NAME [NOT-FOUND TEMPLATE-NAME])</procedure> Returns {{(localized-template PACKAGE-NAME TEMPLATE-NAME NOT-FOUND)}}. Somewhat like the Posix 'gettext' routine. ==== localized-format <procedure>(localized-format PACKAGE-NAME TEMPLATE-NAME PORT ARG0...)</procedure> Formats the arguments {{ARG0...}} to the {{PORT}} using the {{(current-locale-format-function)}} and the format string {{(localized-template PACKAGE-NAME TEMPLATE-NAME)}}. When a localized-template is not found and the {{TEMPLATE-NAME}} is a {{string}} then it is used a the format-string. A representation is always displayed, even when no template is found. Just not a localized one. === Exceptions Extension error conditions are signaled with a composite condition of {{(exn srfi-29)}}. The property-condition {{exn}} has properties {{location}}, {{message}}, and, optionally, {{arguments}}. An invalid bundle-specification raises the composite-condition {{(exn srfi-29 insufficient)}}. An unknown bundle-specification raises the composite-condition {{(exn srfi-29 undefined)}}. == Usage <enscript language=scheme> (require-extension srfi-29 </enscript> == Examples == Notes Possible race condition creating a bundle file or directory. 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. {{(current-locale-details)}} is ill-defined by SRFI 29. Which symbol means what? This implementation defines locale details as a 3 element list {{(SCRIPT CODESET MODIFIER)}} where the elements are symbols or {{#f}}. The SRFI 29 document uses the term "country" for what the locale extension knows as "region". == Requirements [[lookup-table|lookup-table]] [[miscmacros|miscmacros]] [[locale|locale]] == Bugs and Limitations == Author [[/users/kon lovett|kon lovett]] == Version history ; 1.14.0 : Pushed defaults to locale egg. ; 1.13.0 : Needs newer Egg lookup-table. ; 1.12.0 : Needs Unit files. Procedure 'localized-format' did not follow specification. ; 1.9.0 : Version increased to force egg update [by Ivan Raikov]. ; 1.8.0 : Added 'localized-template-set!'. ; 1.7.0 : Cached template lookup. 'localized-template' takes default parameter. Added 'localized-format', 'current-locale-format-function'. ; 1.6.0 : Support for missing locale component stated as {{#f}}. ; 1.501 : Dropped :optional ; 1.5 : Fixed nasty locale-details handling bug ; 1.4 : Added more extensions ; 1.3 : Exports ; 1.2 : Faster lookup ; 1.1 : Added deletion procedures ; 1.0 : Initial release == License Copyright (C) 2009 Kon Lovett. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Software), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED ASIS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you multiply 3 by 1?