Regenerated documentation - had failed to upversion README!
This commit is contained in:
parent
04780bfc02
commit
2d17d0b83b
3 changed files with 46 additions and 20 deletions
37
doc/intro.md
37
doc/intro.md
|
|
@ -6,7 +6,7 @@ A Clojure library designed to provide simple interationalisation of user-facing
|
|||
|
||||
To use this library in your project, add the following leiningen dependency:
|
||||
|
||||
[org.clojars.simon_brooke/internationalisation "1.0.4"]
|
||||
[org.clojars.simon_brooke/internationalisation "1.0.5"]
|
||||
|
||||
To use it in your namespace, require:
|
||||
|
||||
|
|
@ -62,21 +62,21 @@ For example:
|
|||
(get-message :pipe "de-DE" "i18n" "ru")
|
||||
```
|
||||
|
||||
So how does this work? When one calls `(get-message token accept-language-header)`, how does it know where to find resources? The answer is that there are two dynamic variables:
|
||||
So how does this work? When one calls
|
||||
`(get-message token accept-language-header)`, how does it know where to find resources? The answer is that there is a `*config*` map, with (currently) two significant keys:
|
||||
|
||||
* `*resource-path*`, the default path within the resources space on which
|
||||
translation files will be sought. Initialised to `i18n`.
|
||||
* `*default-language*`, the language tag for the language to use when no
|
||||
* `:resource-path`, whose value should be a string representation of the default
|
||||
path within the resources space on which translation files will be sought. Initialised to `i18n`.
|
||||
* `:default-language`, the language tag for the language to use when no
|
||||
otherwise suitable language can be identified. Initialised to the default
|
||||
language of the runtime session, so this may well be different on your
|
||||
machine from someone elses running identical software.
|
||||
|
||||
Thus
|
||||
```clojure
|
||||
(binding [*resource-path* "language-files"
|
||||
*default-language* "en-CA"]
|
||||
(get-message :pipe "en-GB;q=0.9, fr-FR")
|
||||
)
|
||||
(binding [*config* {:resource-path "language-files"
|
||||
:default-language "en-CA"}]
|
||||
(get-message :pipe "en-GB;q=0.9, fr-FR"))
|
||||
```
|
||||
and
|
||||
```clojure
|
||||
|
|
@ -116,10 +116,27 @@ In this project you will find two very simple example files, which should give y
|
|||
|
||||
## Documentation
|
||||
|
||||
Documentation may be generated by running
|
||||
Documentation can be found here. It may be generated by running
|
||||
|
||||
lein codox
|
||||
|
||||
## Future direction
|
||||
|
||||
It's likely that in future configuration will be extended
|
||||
|
||||
1. To read per-language keys/messages from CSV files;
|
||||
2. To read per-language keys/messages from database tables;
|
||||
3. potentially, to read per-language keys/messages from other sources.
|
||||
|
||||
Pull requests implementing any of these things will be welcomed.
|
||||
|
||||
## Deprecated features
|
||||
|
||||
There are still two dynamic configuration variables, `*default-language*`
|
||||
and `*resource-path*`, but these are now superceded by the `*config*` map,
|
||||
which is extensible. Consequently, if you are using these configuration
|
||||
variables in production, you should bind `*config*` to `nil`.
|
||||
|
||||
## License
|
||||
|
||||
Copyright © 2017 Simon Brooke
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue