aboutsummaryrefslogtreecommitdiff
path: root/doc/ref/text/numbers.texi
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-09-11 20:45:45 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-09-11 20:45:45 +0200
commite9d6798e9cf79d54f64171eda6fa9102fffe1f30 (patch)
tree19945d7681d075a6ee070eeb70f141d7f9262f8d /doc/ref/text/numbers.texi
parentIntroduce stream-split-by. (diff)
downloadcalp-e9d6798e9cf79d54f64171eda6fa9102fffe1f30.tar.gz
calp-e9d6798e9cf79d54f64171eda6fa9102fffe1f30.tar.xz
Document text modules.
Diffstat (limited to 'doc/ref/text/numbers.texi')
-rw-r--r--doc/ref/text/numbers.texi42
1 files changed, 42 insertions, 0 deletions
diff --git a/doc/ref/text/numbers.texi b/doc/ref/text/numbers.texi
new file mode 100644
index 00000000..fce5c9fa
--- /dev/null
+++ b/doc/ref/text/numbers.texi
@@ -0,0 +1,42 @@
+@node Spelled out Numbers
+@section Spelled out Numbers
+
+Numbers writtens as word. The usual interface is through
+@code{(text numbers)} which uses the current locale for translations.
+However, @code{(text numbers @var{<lang-code>})} can also be imported
+directly with the exact same interface. Language codes should be two
+letter ISO language codes (e.g. ``se'', ``en'', ...)
+
+When resolving the current language, first the environment variable
+@env{LC_MESSAGES} is checked, followed by @env{LC_ALL}, and finaly
+falls back to ``en''.
+
+English is also chosen if no implementation for the chosen language
+exists.
+
+Note that English uses the term cardinal and ordinal @emph{numeral},
+rather than @emph{number}.
+
+
+@defun number->string-ordinal n [language=(resolve-language)]
+Convert a string into an ordinal number. These are the ``ranking''
+numbers, e.g. ``first'', ``second'', ...
+@end defun
+
+@defun number->string-cardinal n [language=(resolve-language)]
+Convert a string into a cardinal number. These are the ``ordinary''
+counting numbers, e.g. ``one'', ``two'', ...
+@end defun
+
+@defun resolve-language
+Return the current language.
+@end defun
+
+@defun each-string count args ...
+Return a (locale dependant) string indicating which elements of a set
+are targeted, such as ``each'', ``every other'', ...
+
+@var{args} is reserved for locale specific extensions, such as in
+Swedish where both ``var tredje'' and ``vart tredje'' (meaning ``every
+third'') exists, and is chosen depending on the following noun.
+@end defun