- If you want to setup development environment and deploy applications on Google App Engine Python, please refer to this README.
My development environment is Ubuntu 13.04 with Python 2.7. If you are using Windows, i18nUtils.py cannot be run unless you install GNU gettext tools, which include xgettext, msginit, msgmerge, and msgfmt. However, I do not know how to install GNU gettext tools on Windows.
The data files, including Pāḷi texts, translations, and dictionaries, are located at data repository. Some Python and JavaScript libraries are also in data repository.
Please install necessary tools for development before setting up development environment.
PALI_DIR below means the directory where you git clone pali repository.
- git clone the pali repository and data repository (put in the same directory).
# create a directory to contain both pali and data repository.
$ mkdir dev
$ cd dev
# git clone repositories
$ git clone https://github.com/siongui/pali.git
$ git clone https://github.com/siongui/data.git
- Run PALI_DIR/setup/setupdev.py to create symbolic links and i18n files (pot, po, mo files in PALI_DIR/common/locale directory) for use on dev and production server. Note that pali repository and data repository must be put in the same directory. Otherwise symbolic links will not point to correct directories.)
$ python PALI_DIR/setup/setupdev.py
- Create index of words in dictionary books.
$ cd PALI_DIR/dictionary/setup/
$ python init1parseBooks.py
$ python init2parseWords.py
$ python init3prefixWordsHtml.py
# copy succinct trie of words
$ cd PALI_DIR/dictionary/pylib/json/
$ cp ../../../../data/src/succinct_trie.json .
# (optional) build succinct trie of words
#$ cd PALI_DIR/dictionary/setup/nodejs
#$ nodejs buildSuccinctTrie.js
# create client-side JavaScript data files
$ cd PALI_DIR/dictionary/setup/
$ python init4jsonToJS.py
$ cd PALI_DIR/dictionary
# Install grunt plugins
$ npm install
# combine and minify JavaScript/CSS.
$ grunt min
# run dev server.
$ python devNotGaeRun.py
- See if dictionary website works: (Please keep above dev server running)
# open browser to test local dev server:
# http://localhost:8080/
- Create data files used for Pāḷi Tipiṭaka and path of webpages of online Pāḷi Tipiṭaka website:
$ cd PALI_DIR/tipitaka/setup/
$ python init1getTocs.py
$ python init2tocsToJson.py
$ python init3addSubpathInJson.py
# Create Tipiṭaka-related translations for server and client.
$ python setTranslationData.py
$ cd PALI_DIR/tipitaka
# Install grunt plugins
$ npm install
# combine and minify JavaScript/CSS.
$ grunt min
# run dev server.
$ python devNotGaeRun.py
- See if tipiṭaka website works: (Please keep above dev server running)
# open browser to test local dev server:
# http://localhost:8080/
Open and keep two terminals running, one for running dev server, the other for running grunt watch. The changes you make can be viewed from http://localhost:8080/ in your browser window. (reload the page if the window is already open)
# open one termimal
$ cd PALI_DIR/dictionary # if you are developing dictionary website
$ cd PALI_DIR/tipitaka # if you are developing tipitaka website
# combine and minify JavaScript/CSS. Re-combine and re-minify if any changes made.
$ grunt
# open another terminal
$ cd PALI_DIR/dictionary # if you are developing dictionary website
$ cd PALI_DIR/tipitaka # if you are developing tipitaka website
# run dev server
$ python devNotGaeRun.py
# open browser window at the following URL
# http://localhost:8080/
Everytime strings in html files are marked to be translated, remember to re-create i18n files and re-compile JavaScript files. A helper script named i18nUtils.py (located under PALI_DIR/setup/) to automate the i18n jobs.
$ cd PALI_DIR/setup/
# re-create i18n files and re-create JavaScript file for i18n
$ python i18nUtils.py all
$ cd PALI_DIR/dictionary
# re-combine and re-minify JavaScript/CSS of dictionary website
$ grunt min
$ cd PALI_DIR/tipitaka
# re-combine and re-minify JavaScript/CSS of tipiṭaka website
$ grunt min