annotate client/docs/developer.md @ 276:863ec6010045

merge
author Thomas Junk <thomas.junk@intevation.de>
date Mon, 30 Jul 2018 13:13:26 +0200
parents e4e4a0e6338e
children 3e5ed9f40095
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
168
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
1 # Translation
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
2
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
3 We want to internationalize our application for the following
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
4 languages:
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
5
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
6 * EN
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
7 * DE
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
8 * SK
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
9 * HU
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
10 * HR
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
11 * RS
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
12 * BiH
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
13 * BG
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
14 * RO
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
15 * UA
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
16
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
17 ## Our preferred translation cycle is as follows:
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
18
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
19 Application -> .po files -> Weblate -> .po files -> Application
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
20
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
21 There are several possibilities to achieve this goal.
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
22
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
23 ## We chose [vue-gettext](https://github.com/Polyconseil/vue-gettext)
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
24
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
25 Rationale:
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
26 * No other framework supports our preferred translation cycle fully
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
27 * Relies in parts on well known utilities (xgettext)
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
28 * Allows phrases as parameters instead of Variables
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
29 $gettext("Dear Sir") opposed to $("greeting")
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
30
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
31 Downsides:
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
32 * At present (July 2018) there are some annoying issues, which demand quirky solutions:
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
33
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
34 * [xgettext fails with some .vue files](https://github.com/Polyconseil/vue-gettext/issues/28) which forces us to use `(`, `)` around templates
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
35 * [translations in attributes](https://github.com/Polyconseil/vue-gettext/issues/9) which leaves us with either interpolating in templates with `<translate></translate>` or use computed properties in Vue components (cf. Login component).
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
36 * Is dependend on external (=non JS) tools (`xgettext`) which are not able to consume `.vue`-files directly, which in turn leads to unexpected behaviour.
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
37 *
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
38
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
39
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
40 ## Commands
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
41
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
42 In order to extract the messages from the templates call `make makemessages`.
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
43 After that you have the `.po`-file which could be translated.
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
44 After translation, you have to call `make translations` to generate the `translations.json`
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
45 which is consumed by `vue-gettext`.
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
46
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
47 The workflow is as follows:
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
48
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
49 `component.vue ---> /tmp/template.pot ---> app/locale/fr_FR/LC_MESSAGES/app.po ---> app/translations.json`
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
50
e4e4a0e6338e docs: Added a developer documentation
Thomas Junk <thomas.junk@intevation.de>
parents:
diff changeset
51 (taken from the documentation of `vue-gettext`)