Since 355e89ce5, the frontend references resources via root-relative URLs.
This means that `resources` dirs in the language dirs are no longer
accessed and can be removed.
Achieve this by defining a specific `assets` production config that
doesn't include `src/resources`.
As of fd35c8f4a, this shrinks the frontend size by 55% (279M -> 124M).
Also, the nginx location configs now can be simplified.
This PR adds basic i18n support into the mempool frontend, together with
a smooth workflow for developers and translators to collaborate:
* Using the existing @angular/localize module, developers add i18n
metadata to any frontend strings their new features or changes modify
* Using the new npm script `i18n-extract-from-source`, developers
extract the i18n data from source code into `src/locale/messages.xlf`
* After pushing the updated `src/locale/messages.xlf` to GitHub, the
Transifex service will update its database from the new source data
* Using the Transifex website UI, translators can work together to
translate all the mempool frontend strings into their native languages
* Using the new npm script `i18n-pull-from-transifex`, developers can
pull in completed translations from Transifex, and commit them into git.
This flow requires an API key from Transifex, which can be obtained at
https://www.transifex.com/user/settings/api/ to be used with the python
script installed by `pip install transifex-client` - after preparing
these, run the npm script which will ask you for the API key the first
time. When downloading is complete, you can test building the frontend,
and if successful, commit the new strings files into git.
This PR implements a new locale selector in the footer of the homepage
dashboard, and includes WIP translations for the following languages:
* Czech (cs)
* German (de)
* Japanese (ja)
* Norwegian (nn)
* Spanish (es)
* Swedish (sv)
* Ukrainian (uk)
* Persian (fa)
* Portugese (pt)
* Turkish (tr)
* Dutch (nl)
* French (fr)
* Chinese (zh)
* Slovenian (sl)
* Korean (ko)
* Polish (pl)
The user-agent's `Accept-Language` header is used to automatically
detect their preferred language, which can be manually overriden by the
pull-down selector, which saves their preference to a cookie, which is
used by nginx to serve the correct HTML bundle to the user.
Remaining tasks include adding i18n metadata for strings in the Bisq and
Liquid frontend code, mouseover hover tooltip strings, hard-coded og
metadata inside HTML templates, and many other places. This will be done
in a separate PR.
When upgrading to add i18n support, mempool instance operators must take
care to install the new nginx.conf and nginx-mempool.conf files, and
tweak for their specific site configuration.
Fixes#81