taler-www

Main taler.net website
Log | Files | Refs | Submodules | README | LICENSE

README (13103B)


      1 This repository contains the GNU Taler web site www.taler.net.
      2 
      3 The web site consists of basically static HTML. However, the static HTML is
      4 run through the Jinja2 template processor for internationalization.
      5 
      6 Structure:
      7 
      8 /template/
      9   Basically, you edit the English *.html.j2 files in /template/, and then run
     10   the Python script to generate static HTML. To facilitate translation, all
     11   English text in the HTML is marked for GNU Gettext using Jinja2 mark-up.
     12 
     13 /common/
     14   This directory contains files shared between the various HTML pages, such
     15   as our navigation bar.
     16 
     17 /locale/
     18   The translations of the strings into the various languages are in the
     19   /locale/ directory.
     20 
     21 /build-system/
     22   This directory contains JavaScript from other projects which we redistribute,
     23   such as bootstrap and jquery.
     24 
     25 /static/
     26   This directory contains static resources that are language-independent
     27   and never change.
     28 
     29 /inc/
     30   This directory contains various Python scripts that are included during
     31   the pre-processing with Jinja2.
     32   
     33 /rendered/
     34   This directory contains the build of the web site after you commanded 'make'.
     35   Open this file with your favourite browser and check the final result with other browsers.
     36 
     37 
     38 How To  -  Instructions for how to generate the HTML page(s):
     39 
     40 A. Preparing the environment:
     41 
     42 If not already installed, please install according to your needs and your OS:
     43 
     44 # apt install python3-babel python3-jinja2 python3-markupsafe
     45 # apt install python3-ruamel.yaml python3-ruamel.yaml.clib
     46 # apt install python3-lxml python3-bs4 python3-cssselect python3-lxml python3-soupsieve
     47 # apt install gettext gettext-base
     48 
     49 -> On some distros, you may need to use `pip install ruamel.yaml`
     50 
     51 and if not yet done:
     52 # apt install git
     53 
     54 For read-only access pass 
     55 # git clone https://git.taler.net/taler-www.git
     56 
     57 If you think you are trustworthy enough to deserve edit rights as a contributor 
     58 with Git access, you can apply for such by signing and mailing the 
     59 Copyright Assignment Agreement (https://taler.net/pdf/copyright.pdf) 
     60 to ensure that the GNUnet e.V. --- Taler Systems SA agreement on licensing and 
     61 the collaborative development of the GNUnet and GNU Taler projects 
     62 (https://git.gnunet.org/gnunet-ev.git/tree/gnunet_taler_agreement.tex) is satisfied.
     63 
     64 The agreements ensure that the code will continue to be made available under free 
     65 software licenses, which gives developers the freedom to move code between GNUnet 
     66 and GNU Taler without worrying about licenses and the company the ability to 
     67 dual-license (for example, so that we can distribute via app-stores that are hostile 
     68 to free software).
     69 
     70 Minor contributions do not require copyright assignment (basically, anyone without Git access). 
     71 Pseudonymous contributions are accepted, in this case simply sign the agreement 
     72 with your pseudonym. Scanned copies are sufficient, but snail mail is preferred.
     73 
     74 ====================
     75 Debian prerequisites
     76 ====================
     77 
     78 Simply install:
     79 
     80 # apt install python3-ruamel.yaml python3-jinja2 python3-babel git python3-lxml python3-bs4
     81 
     82 ====================
     83 NetBSD prerequisites
     84 ====================
     85 Install python3.7, py37-babel, npm, nodejs from pkgsrc.
     86 
     87 Adjust the values in config.mk:    PYTHON=python3.7    BABEL=pybabel-3.7
     88 
     89 ====================
     90 Python virtual env
     91 ====================
     92 * Install python3 i.e on Debian
     93 ```
     94 # apt install python3
     95 ```
     96 * Create virtual environment **.venv directory is excluded with git ignore paterns**
     97 ```
     98 python3 -m venv .venv
     99 ```
    100 * Activate the virtual environment
    101 ```
    102 source .venv/bin/activate
    103 ```
    104 * Install all requirements from [requirements.txt](requirements.txt) using pip
    105 ```
    106 pip install -r requirements.txt
    107 
    108 
    109 B. When reusing the existing web site from Git, get its files and folder structure:
    110 # git clone git+ssh://git@git.taler.net/taler-www.git
    111 
    112 Change into the new folder and run:
    113 ./bootstrap
    114 ./configure
    115 make
    116 
    117 The website will be installed in the /rendered/ directory.
    118 
    119 If ./configure without parameters does not work, try ./configure --variant=/rendered/
    120 
    121 Open the web site that results in /rendered/ or run
    122 $ firefox rendered/en/index.html
    123 
    124 
    125 C. Preparing for deployment:
    126 When using a web site template from a dislocated web server, you will have to check whether all files are at your hand.
    127 wget might eventually not retrieve all the files necessary for building the local site.
    128 
    129 1. wget -r https://server.foo/taler/index.html
    130 2. Download the website with all files to your home folder
    131 3. Check media resources of the web site by right-clicking and selecting from the browser sub menu 'Show page info'
    132 4. Compare and get the missing files of the online web site which will serve as your main source
    133 5. Add image resources to /images/
    134 6. Add fonts to /static/fonts/
    135 7. Add or modify CSS files in /static/css/
    136 8. Add JS files in /static/js/
    137 9. Add or modify *.html.j2 files in /template/
    138 10. Commit all files to Git
    139 
    140 Then run in the new web site's home folder (e.g. ~/taler-www/):
    141 ./bootstrap
    142 ./configure
    143 make
    144 
    145 If the page finally builds well, proceed with the following steps:
    146 
    147 1. Insert internationalization mark-up tags around any text string for translation:
    148 {% trans %} foo text {% endtrans %}
    149 2. Modify shared HTML logic in /common/
    150 3. Adjust navigation.j2.inc, header.j2.inc and footer.j2.inc in /common/
    151 4. Add more *html.j2 files to expand the web site structure and paste their URLs into navigation.j2.inc
    152 5. Modify HTML code in the other *.html.j2 files according to your needs and wishes
    153 6. Test out and deactivate unnecessary Javascript
    154 7. Check for typos and mistakes in the text strings
    155 8. Check the translation strings in /locale/*/LC_MESSAGES/messages.po
    156 9. Clean up unnecessary files and folders
    157 10. Push all files to Git
    158 11. Review the results before deploying the new web site, then publish it on the internet
    159 
    160 
    161 D. Internationalization:
    162 Weblate is used as Web-based platform for internationalization. Before registering new projects on Weblate, 
    163 please read the development docs at https://docs.taler.net/developers-manual.html#internationalization 
    164 for information on how to create projects, components, translations, and general settings.
    165 
    166 The original source text for translation stems from the *.html.j2 files in /template/ and from *.j2 files in /common/ 
    167 wherever text is in between the mark-up tags {% trans %} and {% endtrans %}. 
    168 The command 'make' gathers all these strings from all HTML files and merges them into the file messages.pot in /locale/.
    169 The base language is English in our case.
    170 
    171 Weblate has to be set up as follows:
    172 
    173 1. Fill in the variables for the Weblate project in 'Settings' on https://weblate.taler.net/settings/gnu-taler/#basic
    174 
    175 At 'Basic'
    176 - Project name [the name of the project on the Weblate platform; here: GNU Taler]
    177 - Project website [here: https://taler.net/]
    178 - Mailing list [email address of the responsible for the translators' mailing list]
    179 - Translation instructions [here: Mailing list for translators: languages@taler.net]
    180 
    181 At 'Access'
    182 - Public
    183 
    184 At 'Workflow' activate:
    185 - Set "Language-Team" header
    186 - Use shared translation memory
    187 - Contribute to shared translation memory
    188 - Enable hooks: activated
    189 - Language aliases [left empty]
    190 Leave deactivated:
    191 - Enable reviews 
    192 - Enable source reviews
    193 
    194 Go to https://weblate.taler.net/manage/ssh/
    195 scroll down to 'Add host key' and let Weblate integrate the SSH host key 
    196 by entering into the form the domain name for the project's website (here: taler.net, 'Port' left empty).
    197 
    198 2. Add components on https://weblate.taler.net/settings/gnu-taler/#components 
    199 'Components' is a synonym for the software project Weblate shall offer for collaborative translation,
    200     e.g. for the component 'Main web site' at https://weblate.taler.net/settings/gnu-taler/main-web-site/:
    201     
    202 At 'Basic'
    203 - Component name [e.g. 'Main web site']
    204 - Translation license - GNU General Public License v3.0 or Later
    205 - Contributor license agreement [left empty]
    206 - Source string bug reporting address [email address of the Weblate admin/"Superuser"]
    207 - Priority: Medium
    208 - Leave deactivated: 
    209   - Restricted component
    210   - Share in projects
    211   - Use as a glossary
    212   
    213 At 'Translation'
    214 - Turn on suggestions
    215 - Allow translation propagation
    216 
    217 At 'Version control'
    218 - Version control system: Git
    219 - Repository branch: master
    220 - Repository push URL: git+ssh://git@git.taler.net/taler-www.git
    221 - Repository browser [left empty]
    222 - Push on commit: deactivated
    223 - Age of changes to commit: 24
    224 - Merge style: Rebase
    225 - Lock on error: activated
    226 
    227 At 'Commit messages'
    228 - Commit message when translating:
    229 Translated using Weblate ({{ language_name }})
    230 Currently translated at {{ stats.translated_percent }}% ({{ stats.translated }} of {{ stats.all }} strings)
    231 Translation: {{ project_name }}/{{ component_name }}
    232 Translate-URL: {{ url }}
    233 
    234 At 'Files'
    235 - File format: gettext PO file
    236 - Language filter: locale/*/LC_MESSAGES/messages.po
    237 - Language filter: ^[^.]+$
    238 - Source language: English
    239 - Monolingual translations / Monolingual base language file [left empty]
    240 - Edit base file: deactivated
    241 - Intermediate language file [left empty]
    242 - Template for new translations: locale/messages.pot
    243 - Adding new translation: Create new language file
    244 - Language code style: Default based on the file format
    245 
    246 3. For all components 'Edit base file' in the settings (in the tab 'Files') has to be turned off, 
    247     because it is never a good idea to allow (anonymous) users to edit the base language file...
    248 4. In 'Settings', 'Repository push URL' should never be left empty.
    249 5. The messages.pot file in the local working tree /locale/ has to be pushed to Git. 
    250     Then, click in Weblate the 'Manage' link, search for the tab 'Repository maintenance', 
    251     then click on 'Update' or 'Pull'. Weblate pulls the base language strings.
    252 6. Create new components in Weblate (languages to translate to). 
    253     Edit the strings in those components, preferably using the 'Zen' mode on Weblate (look for the pencil symbol to click!). 
    254     Don't forget to save after every edit. Finish with clicking 'Commit'. 
    255     Weblate automatically pushes to Git at a set time, e.g. every 24 hours. Manual pushes are allowed, too.
    256 7. For building the web pages on a local machine, pull the messages.po files for all languages via Git (# git pull) and type 'make'. 
    257     Review the rendered pages.
    258 8. Changes in the base language (English) have to be done in the *.html.j2 files in /template/. 
    259     After every update of these files, the messages.pot AND the respective messages.po files 
    260     for any other language MUST be pushed to Git.
    261 9. Changes in any other language than the base language have to be edited with Weblate, 
    262     then committed/pushed from Weblate to Git, and 'git pull'ed to a local machine where 'make' builds the web pages for reviewing.
    263 10. If the base language (English) did not need any changes, consequently 
    264     NO message.po file in /locale/*/LC_MESSAGES/ needs to be pushed to Git, 
    265     because Weblate serves already as the preferred tool for manipulating all the different message.po files.
    266 
    267 
    268 NB: As an alternative to Weblate, language strings still may be manually edited in the .po-files 
    269     - using plain text editors or the poedit program if preferred. 
    270     This requires a manual update in Weblate, though.
    271 
    272 If Weblate sends a message like "Missing commits in the Weblate repository" 
    273     it needs a manual update of files from the Git repository. 
    274     Weblate's own local repository obviously does not get your *.po files automatically. 
    275     To solve this, click in Weblate the 'Manage' link, search for the tab 'Repository maintenance' and then click on 'Update'.
    276 
    277 Workaround for the 'lock' issue:
    278     Weblate locks translations automatically after two Weblate administrators pushed one after the other. 
    279     To solve this issue, the successor admin has to unlock translations on Weblate and 
    280     synchronize Weblate's repository and local repositories with the corresponding Git repository. 
    281     This means downloading the language files from Weblate's local repository to the admin's machine: 
    282     # git clone https://weblate.taler.net/git/gnu-taler/main-web-site/
    283     then copying the *.po files to the Git folder on the local machine, t.i. 
    284     #: ~/taler-www
    285     pushing these files again to Git, 
    286     finally clicking on 'Update' in Weblate so that it syncs all language files in Weblate's own repository.
    287 
    288 Translations components that are bound to a Git repository which is master branch (with ssh-based r/w access) have to denote 
    289     the repository push URL with git+ssh://git@git.taler.net/taler-www.git
    290     which is the normal case while other components that share strings with other components like the Taler apps denote 
    291     'Source code repository' with weblate://project/component  (e.g. weblate://gnu-taler/wallet-android)
    292     and 'Repository push URL' left blank.
    293     For every linked component, the path to 'Monolingual base language file' has to point to the respective file, e.g.
    294     Wallet Android: wallet/src/main/res/values/strings.xml
    295     Point-of-Sale Android: merchant-terminal/src/main/res/values/strings.xml
    296     Cashier Android: cashier/src/main/res/values/strings.xml