Regenerated documentation - had failed to upversion README!
This commit is contained in:
parent
04780bfc02
commit
2d17d0b83b
|
@ -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:
|
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:
|
To use it in your namespace, require:
|
||||||
|
|
||||||
|
|
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:
|
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:
|
To use it in your namespace, require:
|
||||||
|
|
||||||
|
@ -62,21 +62,21 @@ For example:
|
||||||
(get-message :pipe "de-DE" "i18n" "ru")
|
(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
|
* `:resource-path`, whose value should be a string representation of the default
|
||||||
translation files will be sought. Initialised to `i18n`.
|
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
|
* `:default-language`, the language tag for the language to use when no
|
||||||
otherwise suitable language can be identified. Initialised to the default
|
otherwise suitable language can be identified. Initialised to the default
|
||||||
language of the runtime session, so this may well be different on your
|
language of the runtime session, so this may well be different on your
|
||||||
machine from someone elses running identical software.
|
machine from someone elses running identical software.
|
||||||
|
|
||||||
Thus
|
Thus
|
||||||
```clojure
|
```clojure
|
||||||
(binding [*resource-path* "language-files"
|
(binding [*config* {:resource-path "language-files"
|
||||||
*default-language* "en-CA"]
|
:default-language "en-CA"}]
|
||||||
(get-message :pipe "en-GB;q=0.9, fr-FR")
|
(get-message :pipe "en-GB;q=0.9, fr-FR"))
|
||||||
)
|
|
||||||
```
|
```
|
||||||
and
|
and
|
||||||
```clojure
|
```clojure
|
||||||
|
@ -116,10 +116,27 @@ In this project you will find two very simple example files, which should give y
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
|
|
||||||
Documentation may be generated by running
|
Documentation can be found here. It may be generated by running
|
||||||
|
|
||||||
lein codox
|
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
|
## License
|
||||||
|
|
||||||
Copyright © 2017 Simon Brooke
|
Copyright © 2017 Simon Brooke
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<p>A Clojure library designed to provide simple interationalisation of user-facing messages.</p>
|
<p>A Clojure library designed to provide simple interationalisation of user-facing messages.</p>
|
||||||
<h2><a href="#usage" name="usage"></a>Usage</h2>
|
<h2><a href="#usage" name="usage"></a>Usage</h2>
|
||||||
<p>To use this library in your project, add the following leiningen dependency:</p>
|
<p>To use this library in your project, add the following leiningen dependency:</p>
|
||||||
<pre><code>[org.clojars.simon_brooke/internationalisation "1.0.4"]
|
<pre><code>[org.clojars.simon_brooke/internationalisation "1.0.5"]
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>To use it in your namespace, require:</p>
|
<p>To use it in your namespace, require:</p>
|
||||||
<pre><code>[scot.weft.i18n.core :refer [get-message get-messages]]
|
<pre><code>[scot.weft.i18n.core :refer [get-message get-messages]]
|
||||||
|
@ -45,16 +45,15 @@
|
||||||
|
|
||||||
(get-message :pipe "de-DE" "i18n" "ru")
|
(get-message :pipe "de-DE" "i18n" "ru")
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>So how does this work? When one calls <code>(get-message token accept-language-header)</code>, how does it know where to find resources? The answer is that there are two dynamic variables:</p>
|
<p>So how does this work? When one calls <code>(get-message token accept-language-header)</code>, how does it know where to find resources? The answer is that there is a <code>*config*</code> map, with (currently) two significant keys:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li><code>*resource-path*</code>, the default path within the resources space on which translation files will be sought. Initialised to <code>i18n</code>.</li>
|
<li><code>:resource-path</code>, whose value should be a string representation of the default path within the resources space on which translation files will be sought. Initialised to <code>i18n</code>.</li>
|
||||||
<li><code>*default-language*</code>, 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.</li>
|
<li><code>:default-language</code>, 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.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>Thus</p>
|
<p>Thus</p>
|
||||||
<pre><code class="clojure">(binding [*resource-path* "language-files"
|
<pre><code class="clojure">(binding [*config* {:resource-path "language-files"
|
||||||
*default-language* "en-CA"]
|
:default-language "en-CA"}]
|
||||||
(get-message :pipe "en-GB;q=0.9, fr-FR")
|
(get-message :pipe "en-GB;q=0.9, fr-FR"))
|
||||||
)
|
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>and</p>
|
<p>and</p>
|
||||||
<pre><code class="clojure">(get-message :pipe "en-GB;q=0.9, fr-FR" "language-files" "en-CA")
|
<pre><code class="clojure">(get-message :pipe "en-GB;q=0.9, fr-FR" "language-files" "en-CA")
|
||||||
|
@ -79,9 +78,19 @@
|
||||||
{:pipe "Ceci n'est pas une pipe."}
|
{:pipe "Ceci n'est pas une pipe."}
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<h2><a href="#documentation" name="documentation"></a>Documentation</h2>
|
<h2><a href="#documentation" name="documentation"></a>Documentation</h2>
|
||||||
<p>Documentation may be generated by running</p>
|
<p>Documentation can be found here. It may be generated by running</p>
|
||||||
<pre><code>lein codox
|
<pre><code>lein codox
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
<h2><a href="#future-direction" name="future-direction"></a>Future direction</h2>
|
||||||
|
<p>It’s likely that in future configuration will be extended</p>
|
||||||
|
<ol>
|
||||||
|
<li>To read per-language keys/messages from CSV files;</li>
|
||||||
|
<li>To read per-language keys/messages from database tables;</li>
|
||||||
|
<li>potentially, to read per-language keys/messages from other sources.</li>
|
||||||
|
</ol>
|
||||||
|
<p>Pull requests implementing any of these things will be welcomed.</p>
|
||||||
|
<h2><a href="#deprecated-features" name="deprecated-features"></a>Deprecated features</h2>
|
||||||
|
<p>There are still two dynamic configuration variables, <code>*default-language*</code> and <code>*resource-path*</code>, but these are now superceded by the <code>*config*</code> map, which is extensible. Consequently, if you are using these configuration variables in production, you should bind <code>*config*</code> to <code>nil</code>.</p>
|
||||||
<h2><a href="#license" name="license"></a>License</h2>
|
<h2><a href="#license" name="license"></a>License</h2>
|
||||||
<p>Copyright © 2017 Simon Brooke</p>
|
<p>Copyright © 2017 Simon Brooke</p>
|
||||||
<p>Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.</p></div></div></div></body></html>
|
<p>Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.</p></div></div></div></body></html>
|
Loading…
Reference in a new issue