File: README.md

package info (click to toggle)
puppetlabs-i18n-clojure 0.9.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 348 kB
  • sloc: sh: 173; makefile: 25
file content (63 lines) | stat: -rw-r--r-- 2,282 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Example program

This little leiningen project is meant as a simple sandbox for
experimenting with the i18n library.

If you do not have the i18n library installed, or you want to use the lates
from the git checkout, simply run (in this directory)

    > mkdir checkouts
    > ln -s ../../.. checkouts/i18n

Let's see what a German user of this program would be told:

    > LANG=de_DE lein run

Before we can bring them any joy, we need to initialize the project for
using i18n:

    > lein i18n init

This will put a `Makefile` in place; run `make help` to learn more about
what that `Makefile` can do for you. You should run `lein i18n init` every
time the i18n library is updated to make sure you have the most recent
`Makefile`.

**Prior to running `make i18n`, you will need to have at least one string wrapped with a translation function, i.e. trs or tru.**

Until you are comfortable with how `.po` files are handled, it is safest to
only run `make i18n`, which is also run automtically every time `lein
compile` is run:

    > make i18n

There is now a file `locales/messages.pot` which is the 'template' file for
all translations. Translators will generate language-specific versions of
this file by running:

    > make locales/de.po

They will run this command (which is a thin wrapper aroung
`msgmerge`/`msginit`) every time the `messages.pot` has changed and
translations need to be updated. If you don't feel like translating the
messages for this program into German yourself, you can cheat and use the
file `dev-resources/de.po.premade` which I included for convenience:

    > cp dev-resources/de.po.premade locales/de.po

We are now at the point where a translator has given you updated
translations, and we want to try out our program in different languages:

    > make i18n
    > lein run
    > LANG=de_DE lein run

If this weren't an example program, but a 'real' project, you would check
the following files into git:

* `Makefile` and `dev-resources/Makefile.i18n`. You can freely edit
  `Makefile`, but `dev-resources/Makefile.i18n` will get clobbered every
  time you run `lein i18n init`, e.g., when you update to a newer version
  of the i18n library
* `locales/messages.pot` and `locales/*.po` as they contain the raw
  messages and the translations