# HG changeset patch # User Thomas Junk # Date 1530873491 -7200 # Node ID e4e4a0e6338e57c856098b1fa5d5b979e8442ce5 # Parent a6d7ee20fc968ad12860230b9ff8c4f0fc21cc68 docs: Added a developer documentation Developer documentation was added. At present the rationale for why we chose vue-gettext is documented. Alongside comes the explanation of how to use it and what quirks vue-gettext has. diff -r a6d7ee20fc96 -r e4e4a0e6338e client/README.md --- a/client/README.md Fri Jul 06 12:09:08 2018 +0200 +++ b/client/README.md Fri Jul 06 12:38:11 2018 +0200 @@ -33,6 +33,8 @@ * Extract Messages via `make makemessages` * Translations are converted via `make translations` + For more information see [developer documentation](./docs/developer.md) + * Tests * Unit tests are started via `yarn test:unit` * e2e tests are started via `yarn test:e2e` diff -r a6d7ee20fc96 -r e4e4a0e6338e client/docs/developer.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/docs/developer.md Fri Jul 06 12:38:11 2018 +0200 @@ -0,0 +1,51 @@ +# Translation + +We want to internationalize our application for the following +languages: + +* EN +* DE +* SK +* HU +* HR +* RS +* BiH +* BG +* RO +* UA + +## Our preferred translation cycle is as follows: + +Application -> .po files -> Weblate -> .po files -> Application + +There are several possibilities to achieve this goal. + +## We chose [vue-gettext](https://github.com/Polyconseil/vue-gettext) + + Rationale: + * No other framework supports our preferred translation cycle fully + * Relies in parts on well known utilities (xgettext) + * Allows phrases as parameters instead of Variables + $gettext("Dear Sir") opposed to $("greeting") + +Downsides: +* At present (July 2018) there are some annoying issues, which demand quirky solutions: + + * [xgettext fails with some .vue files](https://github.com/Polyconseil/vue-gettext/issues/28) which forces us to use `(`, `)` around templates + * [translations in attributes](https://github.com/Polyconseil/vue-gettext/issues/9) which leaves us with either interpolating in templates with `` or use computed properties in Vue components (cf. Login component). +* Is dependend on external (=non JS) tools (`xgettext`) which are not able to consume `.vue`-files directly, which in turn leads to unexpected behaviour. +* + + +## Commands + +In order to extract the messages from the templates call `make makemessages`. +After that you have the `.po`-file which could be translated. +After translation, you have to call `make translations` to generate the `translations.json` +which is consumed by `vue-gettext`. + +The workflow is as follows: + +`component.vue ---> /tmp/template.pot ---> app/locale/fr_FR/LC_MESSAGES/app.po ---> app/translations.json` + +(taken from the documentation of `vue-gettext`)